/* =====================================================================
   ERP Solicitadoria & Execução — Tema visual
   Identidade: Navy (notarial) · Verde (execução) · Dourado (acento)
   Suporta modo claro e escuro via [data-theme]
   ===================================================================== */
:root {
  --navy: #16315c;
  --navy-600: #1f4079;
  --green: #1f6b43;
  --gold: #c49a3a;
  --danger: #b00020;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --sidebar-bg: #0f2342;
  --sidebar-text: #c8d4e8;
  --sidebar-active: #1f4079;
  --shadow: 0 1px 3px rgba(15,35,66,.08), 0 1px 2px rgba(15,35,66,.06);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #1a2438;
  --border: #243049;
  --text: #e6edf7;
  --muted: #93a1bb;
  --sidebar-bg: #0a1322;
  --sidebar-text: #aebbd4;
  --sidebar-active: #1d2c49;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  transition: transform .25s ease;
  z-index: 1040;
}
.sidebar .brand {
  padding: 20px 22px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .brand .logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--navy-600), var(--gold));
  display: grid; place-items: center; color: #fff; font-weight: 700; flex: none;
}
.sidebar .brand b { color: #fff; font-size: 15px; line-height: 1.15; }
.sidebar .brand small { color: var(--gold); font-size: 11px; letter-spacing: .5px; }

.nav-menu {
  padding: 12px 8px 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,212,232,.32) transparent;
}
.nav-menu::-webkit-scrollbar { width: 6px; }
.nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(200,212,232,.26);
  border-radius: 999px;
}
.nav-menu:hover::-webkit-scrollbar-thumb { background: rgba(200,212,232,.42); }
.nav-menu .nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: #6f80a3; padding: 14px 12px 6px;
}
.nav-menu a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  color: var(--sidebar-text); text-decoration: none;
  border-radius: 9px; font-size: 14px; transition: background .15s, color .15s;
}
.nav-menu a i { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
.nav-menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-menu a.active { background: var(--sidebar-active); color: #fff; }
.nav-menu a.active i { color: var(--gold); opacity: 1; }

.main { flex: 1; margin-left: 248px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px; position: sticky; top: 0; z-index: 1030;
}
.topbar .menu-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 20px; }
.topbar .search-box { flex: 1; max-width: 460px; position: relative; }
.topbar .search-box input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.topbar .search-box i { position: absolute; left: 13px; top: 11px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .tb-icon {
  position: relative; color: var(--muted); background: none; border: 0;
  font-size: 17px; cursor: pointer; padding: 8px; border-radius: 8px;
}
.topbar .tb-icon:hover { background: var(--surface-2); color: var(--text); }
.topbar .badge-dot {
  position: absolute; top: 4px; right: 4px; background: var(--danger);
  color: #fff; font-size: 9px; border-radius: 10px; padding: 1px 5px; font-weight: 600;
}
.topbar .user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px;
  border-radius: 9px; cursor: pointer;
}
.topbar .user-chip:hover { background: var(--surface-2); }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}

.content { padding: 26px 28px; flex: 1; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 650; }
.page-head .subtitle { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Cards ---------- */
.card-x {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-x .card-x-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
.card-x .card-x-body { padding: 18px 20px; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px;
}
.kpi .kpi-icon {
  width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  font-size: 19px; color: #fff; flex: none;
}
.kpi .kpi-val { font-size: 23px; font-weight: 700; line-height: 1; }
.kpi .kpi-label { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.bg-navy { background: var(--navy); } .bg-green { background: var(--green); }
.bg-gold { background: var(--gold); } .bg-danger2 { background: var(--danger); }
.bg-blue { background: #0d6efd; } .bg-teal { background: #0d9488; }

/* ---------- Tables ---------- */
.table-x { width: 100%; border-collapse: collapse; }
.table-x th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 11px 14px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.table-x td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table-x tbody tr:hover { background: var(--surface-2); }
.table-x a { color: var(--navy-600); text-decoration: none; font-weight: 500; }
[data-theme="dark"] .table-x a { color: #7fa8e6; }

/* ---------- Badges ---------- */
.badge-x {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-primary { background: #e3edff; color: #1d4ed8; }
.badge-success { background: #dcf5e7; color: #157347; }
.badge-warning { background: #fff3cd; color: #997404; }
.badge-danger  { background: #fde2e4; color: #b00020; }
.badge-info    { background: #d7f1f7; color: #0a7ea3; }
.badge-secondary { background: #e9edf3; color: #475569; }
.badge-dark    { background: #d5dae3; color: #1e293b; }
[data-theme="dark"] .badge-x { filter: brightness(.92); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface); color: var(--text); font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(31,64,121,.12);
}
.field .err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.control-x {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface); color: var(--text); font-size: 14px;
}
.control-x:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(31,64,121,.12);
}

/* ---------- Buttons ---------- */
.btn-x {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; text-decoration: none; transition: filter .15s;
}
.btn-x:hover { filter: brightness(.94); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.flash-success { background: #dcf5e7; color: #157347; border: 1px solid #a7e0c0; }
.flash-error { background: #fde2e4; color: #b00020; border: 1px solid #f3b9bf; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--navy); border: 2px solid var(--surface);
}
.timeline .tl-date { font-size: 12px; color: var(--muted); }

/* ---------- Phase stepper ---------- */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; }
.stepper .step {
  flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; text-align: center;
}
.stepper .step.done { background: var(--navy); color: #fff; border-color: var(--navy); }
.stepper .step.done.exec { background: var(--green); border-color: var(--green); }
.stepper .step .num { font-weight: 700; display: block; font-size: 15px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f2342, #16315c 60%, #1f6b43); padding: 20px; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 36px 34px; width: 100%; max-width: 410px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card .logo { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--navy-600), var(--gold)); display: grid; place-items: center; color: #fff; font-size: 24px; margin: 0 auto 16px; }
.auth-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.gap-sm { gap: 8px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart-box { position: relative; height: 260px; }

/* ---------- Orçamentos: responsive ---------- */
.quote-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.quote-actions .btn-x,
.quote-inline-actions .btn-x,
.quote-items-footer .btn-x {
  justify-content: center;
  white-space: normal;
}
.quote-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.quote-table-scroll .table-x {
  min-width: 680px;
}
.quote-items-table td:first-child {
  min-width: 260px;
}
.quote-summary {
  line-height: 1.8;
}
.quote-design-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.quote-design-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 14px;
}
.quote-design-preview iframe {
  display: block;
  width: 100%;
  height: 360px;
  border: 0;
  background: #fff;
}
.quote-form,
.quote-template-form,
.quote-settings-form,
.quote-email-form {
  max-width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-toggle { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .layout {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
  }
  .topbar {
    width: 100%;
    max-width: 100vw;
    height: 56px;
    gap: 8px;
    padding: 0 10px;
  }
  .topbar .menu-toggle {
    flex: 0 0 34px;
    width: 34px;
    height: 40px;
    padding: 0;
  }
  .topbar .search-box {
    flex: 1 1 44px;
    min-width: 44px;
    max-width: none;
  }
  .topbar .search-box input {
    height: 40px;
    padding-left: 34px;
    padding-right: 8px;
    text-overflow: ellipsis;
  }
  .topbar .spacer {
    display: none;
  }
  .topbar .tb-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
  }
  .topbar .user-chip {
    flex: 0 0 auto;
    gap: 6px;
    padding: 0;
  }
  .topbar .user-chip > div:last-child {
    display: none;
  }
  .topbar .avatar {
    width: 36px;
    height: 36px;
  }
  .content {
    width: 100%;
    max-width: 100%;
    padding: 18px 10px;
    overflow-x: hidden;
  }
  .page-head {
    align-items: flex-start;
  }
  .page-head > div:first-child,
  .card-x,
  .card-x .card-x-body,
  .grid-2,
  .form-grid,
  .field,
  .quote-form,
  .quote-template-form,
  .quote-settings-form {
    min-width: 0;
    max-width: 100%;
  }
  .page-head h1 {
    font-size: 21px;
    overflow-wrap: anywhere;
  }
  .page-head .subtitle {
    overflow-wrap: anywhere;
  }
  .quote-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    width: 100%;
    justify-content: stretch;
    gap: 8px;
  }
  .quote-actions .btn-x {
    width: 100%;
    padding: 9px 10px;
    font-size: 13px;
  }
  .quote-inline-actions,
  .quote-items-footer {
    flex-wrap: wrap;
    align-items: stretch !important;
  }
  .quote-inline-actions select,
  .quote-inline-actions .btn-x,
  .quote-items-footer .btn-x,
  .quote-items-footer .quote-summary {
    flex: 1 1 100%;
    width: 100%;
  }
  .quote-summary {
    text-align: left;
  }
  .quote-design-tools .btn-x {
    flex: 1 1 140px;
  }
  .quote-design-preview iframe {
    height: 300px;
  }
  .field input,
  .field select,
  .field textarea,
  .control-x {
    min-width: 0;
  }
  .quote-table-scroll .table-x {
    min-width: 620px;
  }
  .quote-table-scroll .quote-list-table,
  .quote-table-scroll .mobile-card-table {
    min-width: 0;
  }
  .quote-list-table,
  .mobile-card-table,
  .quote-list-table tbody,
  .mobile-card-table tbody,
  .quote-list-table tr,
  .mobile-card-table tr,
  .quote-list-table td {
    display: block;
    width: 100%;
  }
  .mobile-card-table td {
    display: block;
    width: 100%;
  }
  .quote-list-table thead,
  .mobile-card-table thead {
    display: none;
  }
  .quote-list-table tr,
  .mobile-card-table tr {
    margin: 0;
    padding: 12px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .quote-list-table tr:hover,
  .mobile-card-table tr:hover {
    background: var(--surface);
  }
  .quote-list-table td,
  .mobile-card-table td {
    display: grid;
    grid-template-columns: minmax(88px, 35%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 7px 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }
  .quote-list-table td::before,
  .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
  }
  .quote-list-table td[data-label=""],
  .mobile-card-table td[data-label=""],
  .mobile-card-table td[data-empty="1"] {
    display: flex;
    justify-content: stretch;
  }
  .quote-list-table td[data-label=""]::before,
  .mobile-card-table td[data-label=""]::before,
  .mobile-card-table td[data-empty="1"]::before {
    display: none;
  }
  .mobile-card-table td[data-empty="1"] {
    padding: 18px 10px !important;
    text-align: center;
    justify-content: center;
  }
  .quote-list-table td[data-label=""] .btn-x,
  .mobile-card-table td[data-label=""] .btn-x {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 460px) {
  .quote-actions {
    grid-template-columns: 1fr;
  }
  .page-head {
    gap: 12px;
  }
  .page-head h1 {
    font-size: 20px;
  }
  .quote-list-table td,
  .mobile-card-table td {
    grid-template-columns: 82px minmax(0, 1fr);
  }
  .btn-x {
    max-width: 100%;
    white-space: normal;
  }
}
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
.backdrop.show { display: block; }

/* =====================================================================
   Agendamento público + sistema de senhas
   ===================================================================== */
.pub { background: var(--bg); }
.pub-header {
  background: var(--sidebar-bg); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 16px 32px; flex-wrap: wrap; gap: 12px;
}
.pub-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.pub-brand .logo { width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--navy-600), var(--gold)); display: grid; place-items: center; font-weight: 700; }
.pub-brand small { color: var(--gold); font-size: 11.5px; }
.pub-nav { display: flex; gap: 10px; }
.pub-nav a { color: #d7e0f0; text-decoration: none; padding: 9px 16px; border-radius: 9px;
  background: rgba(255,255,255,.08); font-size: 14px; }
.pub-nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.pub-main { max-width: 1000px; margin: 0 auto; padding: 36px 24px; }
.pub-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px; }
.pub-hero { text-align: center; margin-bottom: 30px; }
.pub-hero h1 { font-size: 28px; margin: 0 0 8px; color: var(--navy); }
[data-theme="dark"] .pub-hero h1 { color: #7fa8e6; }
.pub-hero p { color: var(--muted); font-size: 15px; }

/* Cartões de solicitador */
.solic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 18px; }
.solic-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); text-align: center; }
.solic-card .av { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 600; }
.solic-card .av.exec { background: var(--green); }
.solic-card h3 { margin: 0 0 4px; font-size: 17px; }
.solic-card .role { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

/* Horas / slots */
.day-block { margin-bottom: 22px; }
.day-block h4 { font-size: 14px; color: var(--navy); margin: 0 0 10px; text-transform: capitalize; }
[data-theme="dark"] .day-block h4 { color: #7fa8e6; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-chip { position: relative; }
.slot-chip input { position: absolute; opacity: 0; }
.slot-chip label { display: block; padding: 9px 16px; border: 1.5px solid var(--border);
  border-radius: 9px; cursor: pointer; font-size: 14px; background: var(--surface); transition: all .12s; }
.slot-chip input:checked + label { background: var(--navy); color: #fff; border-color: var(--navy); }
.slot-chip label:hover { border-color: var(--navy-600); }

/* Quiosque de senhas */
.kiosk-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.kiosk-services { display: grid; gap: 16px; margin-top: 28px; }
.kiosk-btn { display: flex; align-items: center; justify-content: space-between;
  padding: 26px 30px; border-radius: 16px; border: 0; cursor: pointer; color: #fff;
  font-size: 22px; font-weight: 600; box-shadow: var(--shadow); }
.kiosk-btn .pfx { font-size: 30px; opacity: .85; background: rgba(255,255,255,.2); width: 56px; height: 56px;
  border-radius: 12px; display: grid; place-items: center; }
.ticket-paper { max-width: 420px; margin: 30px auto; background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow); padding: 36px; text-align: center; border: 1px dashed var(--border); }
.ticket-paper .code { font-size: 76px; font-weight: 800; color: var(--navy); letter-spacing: 2px; line-height: 1; }
[data-theme="dark"] .ticket-paper .code { color: #7fa8e6; }
.ticket-paper .svc { font-size: 18px; color: var(--muted); margin: 8px 0 4px; }

/* Ecrã de TV (chamada) */
.screen-body { margin: 0; background: #0a1322; color: #fff; height: 100vh; overflow: hidden; }
.screen-grid { display: grid; grid-template-columns: 1.6fr 1fr; height: 100vh; }
.screen-main { display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2342, #16315c); }
.screen-main .lbl { font-size: 26px; color: #aebbd4; letter-spacing: 3px; text-transform: uppercase; }
.screen-main .big { font-size: 170px; font-weight: 800; color: #fff; line-height: 1; margin: 10px 0; }
.screen-main .counter { font-size: 40px; color: var(--gold); }
.screen-side { background: #0a1322; padding: 40px; display: flex; flex-direction: column; }
.screen-side h2 { color: #6f80a3; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; margin: 0 0 18px; }
.screen-side .row { display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid #1d2c49; font-size: 30px; }
.screen-side .row .c { font-weight: 700; }
.screen-side .row .b { color: #93a1bb; font-size: 22px; }

/* Painel de atendimento (balcão) */
.queue-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.q-ticket { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--border); }
.q-ticket .code { font-weight: 700; font-size: 17px; color: var(--navy); }
[data-theme="dark"] .q-ticket .code { color: #7fa8e6; }
.q-now { text-align: center; padding: 26px; }
.q-now .big { font-size: 64px; font-weight: 800; color: var(--green); line-height: 1; }

/* =====================================================================
   Assistente IA + Painel TV
   ===================================================================== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr; } }
.ai-output { white-space: pre-wrap; font-size: 14px; line-height: 1.6; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 18px;
  max-height: 520px; overflow: auto; font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Painel TV */
.tv-body { margin: 0; background: #0a1322; color: #eaf0fb; min-height: 100vh; }
.tv-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 30px;
  background: linear-gradient(135deg, #0f2342, #16315c); border-bottom: 2px solid var(--gold); }
.tv-brand { display: flex; align-items: center; gap: 12px; font-size: 20px; }
.tv-brand .logo { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg,#1f4079,#c49a3a);
  display: grid; place-items: center; font-weight: 700; color: #fff; }
.tv-clock { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.tv-clock small { font-size: 14px; color: #9fb0d0; font-weight: 400; }
.tv-live { font-size: 12px; color: #3ad29f; background: rgba(58,210,159,.12); padding: 4px 10px; border-radius: 20px; }
.tv-live .fa-circle { font-size: 8px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.tv-wrap { padding: 24px 30px; }
.tv-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.tv-kpi { background: #11203a; border: 1px solid #1d2f4e; border-radius: 14px; padding: 18px 20px; }
.tv-kpi .v { font-size: 38px; font-weight: 800; color: #fff; line-height: 1; }
.tv-kpi .v.gold { color: var(--gold); } .tv-kpi .v.green { color: #3ad29f; }
.tv-kpi .l { color: #9fb0d0; font-size: 13px; margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; }
.tv-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.tv-panel { background: #11203a; border: 1px solid #1d2f4e; border-radius: 14px; padding: 20px; }
.tv-panel h2 { font-size: 16px; color: #9fb0d0; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 16px; }
.tv-staff { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #1d2f4e; }
.tv-staff:last-child { border-bottom: 0; }
.tv-staff .av { width: 46px; height: 46px; border-radius: 50%; background: #1f4079; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.tv-staff .av.idle { background: #33415f; }
.tv-staff .who { min-width: 180px; }
.tv-staff .who .n { font-weight: 600; font-size: 16px; }
.tv-staff .who .r { color: #8295b6; font-size: 12.5px; }
.tv-staff .doing { flex: 1; }
.tv-staff .doing .proc { font-size: 15px; color: #eaf0fb; }
.tv-staff .doing .proc b { color: #7fb0ff; }
.tv-staff .doing .meta { color: #8295b6; font-size: 12.5px; margin-top: 2px; }
.tv-staff .doing .idle-txt { color: #5e6f8f; font-style: italic; }
.tv-staff .dot { width: 10px; height: 10px; border-radius: 50%; background: #3ad29f; flex-shrink: 0; }
.tv-staff .dot.off { background: #44557a; }
.tv-staff .tasks { color: #9fb0d0; font-size: 13px; white-space: nowrap; }
.tv-feed .row { padding: 10px 0; border-bottom: 1px solid #1d2f4e; font-size: 13.5px; color: #c4d0e6; }
.tv-feed .row:last-child { border-bottom: 0; }
.tv-feed .row b { color: #fff; } .tv-feed .row .t { color: #8295b6; font-size: 12px; }

/* Hub de relatórios */
.report-hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .report-hub { grid-template-columns: 1fr; } }
.report-link { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: transform .12s, border-color .12s; }
.report-link:hover { transform: translateY(-2px); border-color: var(--navy-600); }
.report-link .ic { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 17px; flex-shrink: 0; }
.report-link b { display: block; font-size: 15px; }
.report-link small { color: var(--muted); font-size: 12.5px; }

/* Abas segmentadas (relatório financeiro) */
.seg-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; }
.seg-tab { padding: 7px 16px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: var(--navy); color: #fff; }
