/* Identidade Visual ZYNTH: marinho, ciano, azul e violeta */
:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #e5edf9;
  background: #07111f;
  --cyan: #29d7ee;
  --line: #22334c;
  --muted: #91a3bc;
  --nav: #081421;
}
* { box-sizing: border-box; }
html, body { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0px; height: 7px; }
*::-webkit-scrollbar-track { background: #0c192b; border-radius: 6px; }
*::-webkit-scrollbar-thumb { background: #234368; border-radius: 6px; border: 1px solid #162b44; }
*::-webkit-scrollbar-thumb:hover { background: #2f5b8c; }
.table-wrap { scrollbar-width: thin; scrollbar-color: #234368 #0c192b; }

body { margin: 0; background: radial-gradient(ellipse at 90% 0, #132640 0, transparent 48%), #07111f; min-height: 100vh; }
button, input, select, textarea { font: inherit; min-height: 40px; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px;
}

.sidebar {
  width: 254px; background: linear-gradient(180deg, #091827, #07111e);
  border-right: 1px solid #1c2e45; position: fixed; inset: 0 auto 0 0;
  padding: 20px 14px; display: flex; flex-direction: column; overflow-y: auto;
  scrollbar-width: none; z-index: 40; transition: width .18s ease, transform .2s ease;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; color: inherit; text-decoration: none; padding: 0 4px; overflow: hidden; }
.brand-art { display: block; width: 170px; height: 54px; position: relative; overflow: hidden; }
.brand-art img { position: absolute; width: 225px; height: auto; left: -27px; top: -76px; }
.brand-product { display: block; letter-spacing: 5px; font-size: 9px; color: #839bb8; margin-left: 10px; font-weight: 600; }
.collapse-btn {
  background: #102236; border: 1px solid #243b55; color: #9ec0e0; border-radius: 7px;
  width: 32px; height: 32px; min-height: 32px; display: grid; place-items: center; flex-shrink: 0;
}
.collapse-btn:hover { background: #193452; color: #e5faff; }

.workspace {
  border: 1px solid #263d55; background: #0e2033; border-radius: 10px;
  margin: 16px 0; padding: 10px; display: flex; align-items: center; gap: 10px; font-size: 12px;
}
.workspace small { display: block; color: #7f97b3; font-size: 10px; margin-top: 2px; word-break: break-all; }
.workspace-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: linear-gradient(135deg, #124e65, #39326c); color: #88ecfa; font-weight: 700; flex-shrink: 0; }
.workspace-dot { width: 8px; height: 8px; background: #29b784; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.nav-caption { font-size: 9px; letter-spacing: 1.6px; color: #7f97b3; padding: 0 10px; margin: 0 0 8px; }
nav { display: grid; gap: 3px; margin-bottom: 16px; }
.nav {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px;
  background: transparent; border: 0; text-align: left; border-radius: 8px; font-size: 13px; color: #9cb0c9;
  min-height: 38px; white-space: nowrap;
}
.nav svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav:hover { background: #183049; color: #e5faff; }
.nav.active { background: linear-gradient(90deg, #123447, #17263c); color: #6be9f7; box-shadow: inset 3px 0 #2bdaec; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid #23364c; padding-top: 14px; font-size: 11px; color: #9fb2c9; }
.sidebar-bottom small { display: block; color: #7f97b3; font-size: 10px; margin-top: 2px; }
.mini-logo { border: 1px solid #2a4565; color: #43d9eb; width: 28px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }

/* Estado recolhido no desktop */
body.sidebar-collapsed .sidebar { width: 74px; padding: 18px 10px; }
body.sidebar-collapsed .app { margin-left: 74px; }
body.sidebar-collapsed .brand,
body.sidebar-collapsed .workspace-meta,
body.sidebar-collapsed .workspace-dot,
body.sidebar-collapsed .nav-caption,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .sidebar-bottom-meta,
body.sidebar-collapsed #logoutBtn { display: none; }
body.sidebar-collapsed .sidebar-head { justify-content: center; }
body.sidebar-collapsed .workspace { justify-content: center; padding: 8px; }
body.sidebar-collapsed .nav { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar-bottom { justify-content: center; }

.app { margin-left: 254px; transition: margin-left .18s ease; min-width: 0; }
.topbar {
  height: 64px; background: #0b1829; border-bottom: 1px solid #1d3048;
  padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 30;
}
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu-btn {
  display: none; background: #14263b; border: 1px solid #2a405d; color: #d8e6f8;
  border-radius: 8px; width: 38px; height: 38px; min-height: 38px; align-items: center; justify-content: center;
}
.breadcrumb { font-size: 12px; color: #92a7c1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb span { color: #4f6681; padding: 0 8px; }
.top-right { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.env-pill {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 4px 10px; border-radius: 20px;
  background: #142d47; color: #6be9f7; border: 1px solid #284f75;
}
.env-pill.prod { background: #133f3b; color: #73dcb9; border-color: #21665e; }
.env-pill.staging { background: #2c2445; color: #c9b5ff; border-color: #4d3d7a; }
.version { font-size: 11px; color: #708aa8; }

main { padding: 26px 28px; max-width: 1520px; margin: auto; }
.kicker { font-size: 9px; font-weight: 800; color: #47cfe2; letter-spacing: 2px; }
h1 { font-size: 28px; margin: 6px 0; color: #e7f1ff; }
h2 { font-size: 16px; margin: 0 0 12px; color: #e7f1ff; }
p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.page-heading { margin-bottom: 18px; }
.primary { border: 1px solid #4cc7ed; border-radius: 8px; background: linear-gradient(110deg, #35d5e8, #5e89eb 72%, #8564e3); color: #071421; font-size: 12px; font-weight: 700; padding: 9px 15px; }
.primary:hover { background: linear-gradient(110deg, #63e9f6, #7da2f6 72%, #9c7aed); }
.secondary { background: #14263b; border: 1px solid #2a405d; border-radius: 7px; font-size: 11px; color: #b8cbe3; padding: 7px 11px; }
.secondary:hover { background: #1d3550; }
.danger { background: #3b1d28; border: 1px solid #6b3446; border-radius: 7px; font-size: 11px; color: #f6b0a6; padding: 7px 11px; }
.danger:hover { background: #4f2535; }
input, select, textarea { border: 1px solid #2a405c; background: #0c1b2d; color: #d8e6f8; border-radius: 7px; font-size: 13px; padding: 8px 11px; }
textarea { width: 100%; min-height: 82px; resize: vertical; }
label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 6px; color: #b8cbe3; }
.card { background: #101e32; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: linear-gradient(125deg, #112239, #101d30); border: 1px solid #22374f; border-radius: 11px; padding: 16px; }
.stat-top { font-size: 11px; color: #99aec7; }
.stat strong { display: block; font-size: 26px; font-weight: 700; margin: 10px 0 4px; color: #eaf3ff; }
.stat small { font-size: 10px; color: #6f87a6; }
.green-text { color: #49d4b1 !important; }
.orange-text { color: #4edce8 !important; }
.blue-text { color: #9c8bf0 !important; }
.notice { border: 1px solid #233b55; border-radius: 8px; padding: 11px 14px; font-size: 12px; color: #91a8c4; margin-bottom: 14px; background: #0f2034; }
.notice[data-state="success"] { color: #83dbc1; background: #0d2b2d; border-color: #1d514b; }
.notice[data-state="error"] { color: #f3a69c; background: #31212b; border-color: #65404c; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form input, .inline-form select { flex: 1 1 170px; min-width: 0; }
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { font-size: 10px; letter-spacing: .7px; color: #6f8dad; background: #0c192b; padding: 12px 14px; border-bottom: 1px solid #22344c; text-transform: uppercase; }
td { font-size: 12px; color: #a3b7d0; padding: 12px 14px; border-bottom: 1px solid #1b3048; }
.badge { display: inline-block; font-size: 10px; font-weight: 650; border-radius: 20px; padding: 4px 9px; background: #133f3b; color: #73dcb9; }
.badge.warn { background: #3e293e; color: #da9bca; }
.badge.neutral { background: #1e3049; color: #9bafc9; }

/* Filtros, operacoes coletivas e cards de 2 niveis (Mensagens & Agendamentos) */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filter-bar input, .filter-bar select { flex: 1 1 140px; min-width: 0; min-height: 36px; font-size: 12px; padding: 6px 10px; }
.bulk-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  background: #0c1a2c; border: 1px solid #223854; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 12px;
}
.bulk-left, .bulk-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg-cards { display: grid; gap: 10px; }
.msg-card {
  background: #101e32; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: grid; gap: 10px;
}
.msg-card.selected { border-color: var(--cyan); background: #12253d; }
.msg-top {
  display: grid; grid-template-columns: 24px minmax(120px, 1.1fr) minmax(120px, 1fr) minmax(110px, .9fr) auto minmax(130px, 1fr) minmax(130px, 1fr) minmax(140px, 1.3fr);
  gap: 10px; align-items: center; font-size: 12px;
}
.msg-cell small { display: block; font-size: 9px; letter-spacing: .5px; color: #6e90b5; text-transform: uppercase; margin-bottom: 2px; }
.msg-cell span, .msg-cell code { word-break: break-word; }
.msg-actions {
  border-top: 1px solid #1d314b; padding-top: 9px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between;
}
.msg-actions-main { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.msg-actions-main .secondary, .msg-actions-main .danger { min-height: 30px; padding: 4px 10px; font-size: 11px; }
.more-wrap { position: relative; }
.more-menu {
  position: absolute; right: 0; bottom: 34px; background: #0c1a2e; border: 1px solid #2a4768;
  border-radius: 8px; padding: 6px; display: grid; gap: 4px; min-width: 170px; z-index: 25; box-shadow: 0 10px 28px #0008;
}
.more-menu button { text-align: left; width: 100%; min-height: 32px; }
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); }
dialog.modal {
  background: #101e32; color: #e5edf9; border: 1px solid #2b4a6c; border-radius: 12px;
  max-width: 560px; width: 94vw; padding: 20px; box-shadow: 0 24px 60px #000a;
}
dialog.modal::backdrop { background: #030912b3; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-body { display: grid; gap: 10px; font-size: 12px; }
.event-list { display: grid; gap: 6px; max-height: 200px; overflow-y: auto; border-top: 1px solid #22344c; padding-top: 8px; }
.event-item { background: #0b1727; border: 1px solid #1d3048; border-radius: 6px; padding: 7px 10px; font-size: 11px; }

.auth-only .sidebar, .auth-only .topbar { display: none !important; }
.auth-only .app { margin-left: 0; }
.auth-card form > div { margin-bottom: 14px; }
.auth-card input, .auth-card .primary { width: 100%; }
.mobile-backdrop { display: none; position: fixed; inset: 0; background: #020812a8; z-index: 50; }
.mobile-backdrop.open { display: block; }
[hidden] { display: none !important; }

@media (max-width: 1240px) {
  .msg-top { grid-template-columns: 24px repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  * { scrollbar-width: none !important; }
  *::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
  .sidebar { transform: translateX(-100%); width: 260px; z-index: 60; }
  .sidebar.open { transform: translateX(0); }
  .collapse-btn { display: none; }
  .app { margin-left: 0 !important; }
  .mobile-menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; height: 56px; }
  main { padding: 16px 12px; }
  h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 21px; }
  .version { display: none; }
  .msg-top { grid-template-columns: 24px 1fr 1fr; gap: 8px; }
  .msg-cell.wide { grid-column: 1 / -1; }
  .bulk-bar { padding: 10px; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .msg-top { grid-template-columns: 24px 1fr; }
}
