/* Linguagem visual do conceito de Dashboard publicado (paleta escura, Sora/Work Sans,
   cards com borda #1D2433 e raio 16–18px, botões em pílula, ícones em stroke). */
:root {
  --bg: #090C12;
  --sidebar: #0C1019;
  --surface: #11151F;
  --surface-2: #1B2231;
  --border: #1D2433;
  --border-strong: #262D3F;
  --sidebar-border: #1A2030;
  --text: #F2F4F8;
  --text-strong: #F7F8FA;
  --text-soft: #DCE0E8;
  --text-muted: #AEB5C4;
  --text-dim: #8D96AC;
  --text-faint: #6B7488;
  --text-label: #4C5469;
  --accent: #F0A93E;
  --accent-hover: #F7C16E;
  --accent-ink: #241502;
  --teal: #30D8B9;
  --blue: #5C8DF6;
  --red: #F2555D;
  --font-display: 'Sora', sans-serif;
  --font-body: 'Work Sans', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232a3b; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------ shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.sidebar {
  width: 272px; flex: 0 0 272px; background: var(--sidebar); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; padding: 28px 18px;
}
.content { flex: 999 1 560px; min-width: 0; padding: 26px 36px 48px; display: flex; flex-direction: column; gap: 26px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 28%, #FBCB7A 0%, #F0A93E 45%, #B9740B 100%);
  box-shadow: 0 0 0 1px rgba(240,169,62,0.35), 0 6px 18px rgba(240,169,62,0.25);
  font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--accent-ink);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text-strong); letter-spacing: 0.2px; }
.brand-sub { font-size: 11.5px; color: var(--text-faint); font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }

.profile {
  display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 22px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--accent);
}
.profile-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-role { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 22px; flex: 1 1 auto; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; color: var(--text-label); padding: 0 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
}
.nav-item svg { width: 18px; height: 18px; stroke: var(--text-muted); flex: 0 0 auto; }
.nav-item.active { background: rgba(240,169,62,0.12); color: var(--text-strong); font-weight: 600; }
.nav-item.active svg { stroke: var(--accent); }

.sidebar-footer { margin-top: 20px; }

/* ------------------------------------------------------------ elementos */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.page-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -0.03em; color: var(--text-strong); }
.page-sub { font-size: 13px; color: var(--text-faint); }
.stack-3 { display: flex; flex-direction: column; gap: 3px; }

.card {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; padding: 22px 24px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 14px 34px rgba(0,0,0,0.22);
}
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); margin: 0; }
.card-note { font-size: 12.5px; color: var(--text-faint); margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 18px; }
.row > .card { flex: 1 1 340px; min-width: 0; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-strong); overflow-wrap: anywhere; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; }

.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv span:first-child { color: var(--text-muted); }
.kv span:last-child { font-weight: 700; font-size: 15px; color: var(--text-strong); overflow-wrap: anywhere; text-align: right; }

.list-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap;
  background: #141a26; border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.18);
}
.list-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 200px; }
.list-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-strong); }
.list-sub { font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; }
.empty { padding: 30px 0; color: var(--text-label); font-size: 13px; text-align: center; }

.pill { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; flex: 0 0 auto; }
.pill-teal { color: var(--teal); background: rgba(48,216,185,0.12); }
.pill-muted { color: var(--text-faint); background: rgba(107,116,136,0.14); }
.pill-amber { color: var(--accent); background: rgba(240,169,62,0.12); }
.pill-red { color: #FF8A90; background: rgba(242,85,93,0.12); }
.pill-blue { color: var(--blue); background: rgba(92,141,246,0.12); }

/* cards de catálogo (conceito: ícone em quadrado tingido + número grande) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 28px rgba(0,0,0,0.24);
}
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.tile-icon.amber { background: rgba(240,169,62,0.14); } .tile-icon.amber svg { stroke: var(--accent); }
.tile-icon.blue { background: rgba(93,141,246,0.14); } .tile-icon.blue svg { stroke: var(--blue); }
.tile-icon.purple { background: rgba(157,123,240,0.14); } .tile-icon.purple svg { stroke: #9D7BF0; }
.tile-icon.teal { background: rgba(48,216,185,0.14); } .tile-icon.teal svg { stroke: var(--teal); }
.tile-value { font-family: var(--font-display); font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; color: var(--text-strong); }
.tile-label { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 6px; }

.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.check-row:last-child { border-bottom: none; }
.check-row .pill { min-width: 86px; text-align: center; }
.fields { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-faint); overflow-wrap: anywhere; }
.fields strong { color: #FF8A90; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-danger { color: #FF8A90; border-color: rgba(242,85,93,0.35); }
.btn-danger svg { stroke: #FF8A90; }
details.more summary { cursor: pointer; font-size: 12.5px; color: var(--text-dim); min-height: 32px; display: flex; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 20px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft);
  font-family: var(--font-body); font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer;
}
.btn:hover { border-color: #34405a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.courtesy-note { flex: 1 1 100%; }
.btn svg { stroke: var(--text-dim); }
.btn-icon { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; }
.btn-primary { border: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: 0 6px 16px rgba(240,169,62,0.22); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary svg { stroke: var(--accent-ink); }
.btn-block { width: 100%; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field input {
  min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.field textarea {
  min-height: 120px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(240,169,62,0.5); outline-offset: 1px; border-color: var(--accent); }
.delivery { display: flex; flex-direction: column; gap: 6px; }
.delivery > span { font-size: 13px; color: var(--text-muted); }
.message-body {
  margin: 0; white-space: pre-wrap; text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 500; line-height: 1.5;
  color: var(--text-strong); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
a.list-row { text-decoration: none; }
.field select {
  min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.field-hint { font-size: 11.5px; color: var(--text-faint); }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix input { flex: 1 1 auto; min-width: 0; }
.input-suffix span { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

.alert { border-radius: 14px; padding: 12px 14px; font-size: 13px; border: 1px solid; }
.alert-error { color: #FFC9CC; background: rgba(242,85,93,0.10); border-color: rgba(242,85,93,0.35); }
.alert-success { color: #C6F5EC; background: rgba(48,216,185,0.08); border-color: rgba(48,216,185,0.35); display: flex; flex-direction: column; gap: 10px; }
.alert-success strong { color: var(--text-strong); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; color: var(--text-strong); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ página pública */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.public-bar .brand { padding: 0; }
.public-main {
  width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 16px 48px;
  display: flex; flex-direction: column; gap: 18px;
}
.public-footer {
  margin-top: auto; display: flex; gap: 18px; padding: 20px 24px;
  border-top: 1px solid var(--border); font-size: 13px;
}

/* ------------------------------------------------------------ login / erro */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 24px; display: flex; flex-direction: column; gap: 22px; }
.auth-card .brand { padding: 0; }

.transcript { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble.mine { align-self: flex-end; background: #2A2114; border-color: #3A2E1C; }
.bubble.theirs { align-self: flex-start; }
.bubble time { display: block; margin-top: 4px; color: var(--text-faint); font-size: 11px; }
.qr { width: 220px; height: auto; border-radius: 12px; background: white; }

.quick-search { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.quick-search input {
  min-height: 40px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 13px;
}
.nav-count {
  margin-left: auto; min-width: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center;
}
.nav-item { display: flex; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.copy-block {
  width: 100%; margin: 0; white-space: pre-wrap; text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.45;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.shell.sidebar-collapsible.sidebar-collapsed .sidebar { width: 88px; flex-basis: 88px; }
.shell.sidebar-collapsible.sidebar-collapsed .profile-text,
.shell.sidebar-collapsible.sidebar-collapsed .nav-label,
.shell.sidebar-collapsible.sidebar-collapsed .quick-search,
.shell.sidebar-collapsible.sidebar-collapsed .nav-item { font-size: 0; }
.shell.sidebar-collapsible.sidebar-collapsed .nav-item svg { width: 18px; height: 18px; }
.mobile-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { width: 100%; flex: 1 1 100%; border-right: none; border-bottom: 1px solid var(--sidebar-border); padding: 20px 16px; }
  .content { padding: 22px 16px 40px; }
}
@media (max-width: 760px) {
  .shell.mobile-nav-on { display: block; }
  .shell.mobile-nav-on .sidebar { display: none; }
  .shell.mobile-nav-on.mobile-menu-open .sidebar {
    display: flex; position: fixed; z-index: 40; top: 0; right: 0; left: 0; bottom: 72px;
    width: auto; flex-basis: auto; overflow: auto; border-bottom: 1px solid var(--sidebar-border);
  }
  .shell.mobile-nav-on .content { padding: 18px 16px 104px; }
  .shell.mobile-nav-on .mobile-nav {
    display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    height: 72px; margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--sidebar); border-top: 1px solid var(--border-strong);
    box-shadow: 0 -12px 28px rgba(0,0,0,0.35);
    justify-content: space-around; align-items: stretch;
  }
  .shell.mobile-nav-on .mobile-nav a,
  .shell.mobile-nav-on .mobile-nav button {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 0; background: transparent; color: var(--text-dim); text-decoration: none;
    font-family: var(--font-body); font-size: 10px; font-weight: 600; line-height: 1.1; padding: 0 2px;
  }
  .shell.mobile-nav-on .mobile-nav svg { stroke: currentColor; }
  .shell.mobile-nav-on .mobile-nav a[aria-current="page"],
  .shell.mobile-nav-on.mobile-menu-open .mobile-nav button {
    color: var(--accent);
  }
  .shell.mobile-nav-off .mobile-nav { display: none; }
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.client-cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.client-card {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative;
  padding: 12px; border: 1px solid var(--border-strong); border-radius: 16px;
  background: #141a26;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.18);
}
.client-card.expiry-ok { border-color: var(--teal); }
.client-card.expiry-soon { border-color: var(--accent); }
.client-card.expiry-over { border-color: var(--red); }
.client-card .list-row { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.client-card .copy-block,
.client-card .row-actions,
.client-card details.more,
.client-card .form-grid { max-width: 100%; min-width: 0; }
.data-table tr.expiry-ok td { background: rgba(48, 216, 185, 0.07); }
.data-table tr.expiry-soon td { background: rgba(240, 169, 62, 0.08); }
.data-table tr.expiry-over td { background: rgba(242, 85, 93, 0.08); }
.data-table tr.expiry-ok td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
.data-table tr.expiry-soon td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.data-table tr.expiry-over td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.client-card .row-actions { margin: 0; }
.client-card .row-actions .btn svg,
.client-card details.more > summary svg { width: 16px; height: 16px; flex: 0 0 auto; }
.client-card details.more > summary { gap: 6px; }
.client-card details.more > summary svg { stroke: var(--text-dim); }
.client-card details.more form { margin-top: 8px; }
@media (min-width: 900px) {
  .client-cards { grid-template-columns: 1fr 1fr; }
}
dialog.playlist-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  margin: auto;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.22);
}
dialog.playlist-dialog::backdrop { background: rgba(0,0,0,0.55); }
dialog.playlist-dialog .playlist-body { max-height: 50vh; overflow: auto; }
