/* ============================================================================
   HOSPITAL SUL — Sistema visual
   Painel clínico: superfícies neutras, um único azul de destaque, tipografia
   forte e bordas finas. Sem gradientes, brilhos ou desfoque.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. RESET
   ---------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-0);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { background: none; border: none; padding: 0; cursor: pointer; }
svg { width: 16px; height: 16px; flex-shrink: 0; display: block; }
a { color: var(--accent); }

/* ----------------------------------------------------------------------------
   2. TOKENS — tema claro (padrão)
   ---------------------------------------------------------------------------- */
:root {
  --bg:            #f4f5f7;
  --panel:         #ffffff;
  --panel-2:       #fafbfc;
  --overlay-1:     #f4f5f7;
  --overlay-2:     #e9ebee;

  --border:        #e2e5e9;
  --border-strong: #d0d5db;

  --text-0: #14181d;
  --text-1: #444d57;
  --text-2: #6b757f;
  --text-3: #98a1ab;

  --accent:      #2547d0;
  --accent-hover:#1d3ab0;
  --accent-soft: #eaeeff;
  --accent-text: #ffffff;

  --green:  #0f7a48;  --green-soft:  #e3f5ec;
  --red:    #c02736;  --red-soft:    #fdeaec;
  --amber:  #9a6206;  --amber-soft:  #fdf1dc;
  --purple: #6b3fc4;  --purple-soft: #f0eafc;
  --cyan:   #0f6d84;  --cyan-soft:   #e2f3f7;
  --gold:   #96690b;  --gold-soft:   #fbf1d8;

  --radius:    10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow:    0 8px 28px rgba(16, 24, 40, 0.14);

  --topbar-h: 60px;
  --transition: 130ms cubic-bezier(.4, 0, .2, 1);
  --mono: 'JetBrains Mono', ui-monospace, 'Consolas', monospace;
}

/* Tema escuro — cinza neutro, não azul-marinho */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #16181c;
    --panel:         #1e2126;
    --panel-2:       #23272d;
    --overlay-1:     #24282e;
    --overlay-2:     #2d323a;

    --border:        #2f343b;
    --border-strong: #3d434c;

    --text-0: #f2f4f7;
    --text-1: #c3cad3;
    --text-2: #8d97a3;
    --text-3: #6b747f;

    --accent:      #6f8cff;
    --accent-hover:#8aa2ff;
    --accent-soft: #232a45;
    --accent-text: #10131a;

    --green:  #4ec98a;  --green-soft:  #1a3329;
    --red:    #f2707d;  --red-soft:    #3a2126;
    --amber:  #e0a640;  --amber-soft:  #362a17;
    --purple: #b294f5;  --purple-soft: #2a2340;
    --cyan:   #5cc0d8;  --cyan-soft:   #17303a;
    --gold:   #d9ad4f;  --gold-soft:   #362d16;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow:    0 10px 34px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  --bg:            #16181c;
  --panel:         #1e2126;
  --panel-2:       #23272d;
  --overlay-1:     #24282e;
  --overlay-2:     #2d323a;

  --border:        #2f343b;
  --border-strong: #3d434c;

  --text-0: #f2f4f7;
  --text-1: #c3cad3;
  --text-2: #8d97a3;
  --text-3: #6b747f;

  --accent:      #6f8cff;
  --accent-hover:#8aa2ff;
  --accent-soft: #232a45;
  --accent-text: #10131a;

  --green:  #4ec98a;  --green-soft:  #1a3329;
  --red:    #f2707d;  --red-soft:    #3a2126;
  --amber:  #e0a640;  --amber-soft:  #362a17;
  --purple: #b294f5;  --purple-soft: #2a2340;
  --cyan:   #5cc0d8;  --cyan-soft:   #17303a;
  --gold:   #d9ad4f;  --gold-soft:   #362d16;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 10px 34px rgba(0, 0, 0, 0.55);
}

/* Compatibilidade com nomes antigos ainda citados em estilos inline do JS */
:root, :root[data-theme="dark"] {
  --panel-border: var(--border);
  --panel-border-strong: var(--border-strong);
  --bg-surface: var(--panel);
}

/* ----------------------------------------------------------------------------
   3. SHELL — topo fixo + abas + painel
   ---------------------------------------------------------------------------- */
#app { height: 100vh; height: 100dvh; }
.shell { display: flex; flex-direction: column; height: 100%; }

.topbar {
  flex: 0 0 auto;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 9px 22px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar-logo {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.topbar-logo svg { width: 19px; height: 19px; }
.topbar-brand-info { display: flex; flex-direction: column; min-width: 0; }
.topbar-title {
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text-0); line-height: 1.2; white-space: nowrap;
}
.topbar-subtitle {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.topbar-right {
  display: flex; align-items: center; flex-wrap: wrap;
  justify-content: flex-end; gap: 8px; margin-left: auto;
}

.icon-btn, .theme-toggle {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); border: 1px solid var(--border);
  background: var(--panel);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.icon-btn:hover, .theme-toggle:hover {
  color: var(--text-0); background: var(--overlay-1); border-color: var(--border-strong);
}
/* Ação destrutiva em linha (excluir lançamento) */
.icon-btn.danger { width: 30px; height: 30px; color: var(--text-3); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.icon-btn.danger svg { width: 15px; height: 15px; }

.duty-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--panel);
  font-size: 12px; font-weight: 650; color: var(--text-1); white-space: nowrap;
}
.duty-label { white-space: nowrap; }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
}
.pulse-dot.on { background: var(--green); }
.pulse-dot.paused { background: var(--amber); }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
}
.user-chip:hover { background: var(--overlay-1); border-color: var(--border-strong); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0; letter-spacing: 0.02em;
}
.user-chip .u-info { min-width: 0; line-height: 1.15; }
.user-chip .u-name { font-size: 12.5px; font-weight: 700; color: var(--text-0); white-space: nowrap; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-2); white-space: nowrap; }

/* Abas — indicador por sublinhado */
.tabbar {
  flex: 0 0 auto;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tabbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 22px;
  display: flex; gap: 4px; overflow-x: auto;
  scrollbar-width: none;
}
.tabbar-inner::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 14px; white-space: nowrap;
  font-size: 13.5px; font-weight: 650; color: var(--text-2);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text-0); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-label-short { display: none; }
.tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full);
  background: var(--amber-soft); color: var(--amber);
  font-size: 10.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

.dashboard-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.dashboard-container {
  max-width: 1320px; margin: 0 auto;
  padding: 22px 22px 56px;
  display: flex; flex-direction: column; gap: 16px;
  width: 100%;
}

/* Cabeçalho de cada aba */
.tab-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px;
}
.tab-head h2 {
  font-size: 20px; font-weight: 800; letter-spacing: -0.03em; color: var(--text-0);
}
.tab-head p { margin-top: 2px; font-size: 13px; color: var(--text-2); }

/* ----------------------------------------------------------------------------
   4. LOGIN
   ---------------------------------------------------------------------------- */
.login-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; background: var(--bg);
}
.login-theme-toggle { position: fixed; top: 18px; right: 18px; }
.login-box, .glass {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px 26px;
  box-shadow: var(--shadow-xs);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.logo-badge {
  width: 52px; height: 52px; border-radius: var(--radius); margin: 0 auto 14px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.logo-badge svg { width: 27px; height: 27px; }
.login-brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.login-brand p { margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.login-error, .login-lock {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; margin-bottom: 14px;
}
.login-error { background: var(--red-soft); color: var(--red); }
.login-lock { background: var(--amber-soft); color: var(--amber); flex-direction: column; align-items: flex-start; }
.login-footer { margin-top: 16px; }
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-3); font-size: 11.5px; margin: 16px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.pin-input { letter-spacing: 0.5em; text-align: center; font-family: var(--mono); }

.center-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------------------
   5. BOTÕES
   ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel);
  color: var(--text-0); font-size: 13px; font-weight: 650;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { background: var(--overlay-1); }
.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--overlay-1); color: var(--text-0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ----------------------------------------------------------------------------
   6. FORMULÁRIOS
   ---------------------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 650; color: var(--text-1);
}
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text-0);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { min-height: 74px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field .hint { margin-top: 5px; font-size: 11.5px; color: var(--text-3); min-height: 15px; }
.field .hint-ok { color: var(--green); font-weight: 650; }
.field .hint-bad { color: var(--red); font-weight: 650; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 620px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.input-row { display: flex; gap: 8px; align-items: center; }

/* Seletor Kit Médico / Cirurgia */
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-option {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel-2);
  color: var(--text-1); font-size: 13px; font-weight: 650;
  transition: all var(--transition);
}
.type-option:hover { color: var(--text-0); border-color: var(--accent); }
.type-option.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ----------------------------------------------------------------------------
   7. CARDS E GRIDS
   ---------------------------------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.hero-grid, .admin-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start;
}
@media (min-width: 980px) {
  .hero-grid { grid-template-columns: 1.1fr 1fr; align-items: stretch; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
}

.page-subhead {
  font-size: 11px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-3);
  margin: 20px 0 11px; display: flex; align-items: center; gap: 9px;
}
.page-subhead::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider-line { height: 1px; background: var(--border); margin: 14px 0; }

/* Indicadores */
.stat-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
}
.stat-card .ic {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--overlay-1); color: var(--text-2);
}
.stat-card .ic svg { width: 18px; height: 18px; }
.stat-card .stat-body { min-width: 0; }

/* Caixa do hospital — destaque no topo de Vendas & Cirurgias */
.caixa-card { padding: 20px 22px; }
.caixa-topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.caixa-rotulo {
  font-size: 11.5px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-2);
}
.caixa-valor {
  font-size: clamp(28px, 6vw, 40px); font-weight: 800;
  letter-spacing: -0.03em; color: var(--green);
  line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums;
}
.caixa-valor.negativo { color: var(--red); }
.caixa-detalhe {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.caixa-detalhe > div { display: flex; flex-direction: column; gap: 2px; }
.caixa-detalhe b { color: var(--text-0); font-size: 14px; }
.caixa-modos { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 480px) {
  .caixa-modos { grid-template-columns: 1fr; }
}

/* Cartões da premiação semanal */
.award-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 15px; background: var(--panel-2);
}
.award-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-2);
}
.award-head .ic {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--overlay-2); color: var(--text-2); flex-shrink: 0;
}
.award-head .ic svg { width: 14px; height: 14px; }
.award-card.tone-blue .ic   { background: var(--accent-soft); color: var(--accent); }
.award-card.tone-green .ic  { background: var(--green-soft);  color: var(--green); }
.award-card.tone-purple .ic { background: var(--purple-soft); color: var(--purple); }
.award-card .avatar { width: 32px; height: 32px; font-size: 12px; }
.stat-card .val {
  font-size: 21px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text-0); line-height: 1.15; font-variant-numeric: tabular-nums;
}
.stat-card .lbl { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.stat-card.tone-green .ic  { background: var(--green-soft);  color: var(--green); }
.stat-card.tone-blue .ic   { background: var(--accent-soft); color: var(--accent); }
.stat-card.tone-purple .ic { background: var(--purple-soft); color: var(--purple); }
.stat-card.tone-amber .ic  { background: var(--amber-soft);  color: var(--amber); }
.stat-card.tone-red .ic    { background: var(--red-soft);    color: var(--red); }

/* ----------------------------------------------------------------------------
   8. PONTO / RELÓGIO
   ---------------------------------------------------------------------------- */
.clock-card {
  text-align: center;
  display: flex; flex-direction: column; justify-content: center;
  padding: 26px 20px;
}
.clock-live-date {
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
  text-transform: capitalize; letter-spacing: 0.01em;
}
.clock-live-time {
  font-family: var(--mono);
  font-size: clamp(38px, 8vw, 54px); font-weight: 700;
  letter-spacing: 0.01em; color: var(--text-0);
  line-height: 1.1; margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}
.clock-status {
  display: inline-flex; align-items: center; gap: 8px; align-self: center;
  padding: 6px 14px; border-radius: var(--radius-full);
  background: var(--overlay-1); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 650; color: var(--text-1);
  margin-bottom: 16px;
}
.clock-status .mono { font-family: var(--mono); color: var(--text-0); font-weight: 700; }

/* ----------------------------------------------------------------------------
   9. BADGES
   ---------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; white-space: nowrap;
  background: var(--overlay-2); color: var(--text-1);
}
.badge-role-1 { background: var(--overlay-2);   color: var(--text-1); }
.badge-role-2 { background: var(--cyan-soft);   color: var(--cyan); }
.badge-role-3 { background: var(--accent-soft); color: var(--accent); }
.badge-role-4 { background: var(--purple-soft); color: var(--purple); }
.badge-role-5 { background: var(--amber-soft);  color: var(--amber); }
.badge-role-6 { background: var(--gold-soft);   color: var(--gold); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red   { background: var(--red-soft);   color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray  { background: var(--overlay-2);  color: var(--text-2); }
.badge-gold  { background: var(--gold-soft);  color: var(--gold); }
.eligible-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-full);
  background: var(--green-soft); color: var(--green);
  font-size: 11.5px; font-weight: 700;
}
.eligible-tag svg { width: 13px; height: 13px; }

/* ----------------------------------------------------------------------------
   10. TABELAS
   ---------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 13px; white-space: nowrap;
  background: var(--panel-2);
  font-size: 10.5px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 13px; color: var(--text-1);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
.empty-row td { text-align: center; color: var(--text-3); padding: 34px 14px; }
.empty-row:hover { background: transparent; }

/* Em telas estreitas cada linha vira um cartão — sem arrastar para o lado */
@media (max-width: 720px) {
  .table-wrap { border: none; background: transparent; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody tr {
    display: block; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--panel); overflow: hidden;
  }
  tbody tr:last-child { margin-bottom: 0; }
  tbody tr:hover { background: var(--panel); }
  tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 13px; text-align: right; white-space: normal;
    min-width: 0 !important;
  }
  tbody td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label);
    font-size: 10.5px; font-weight: 750; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-3);
    text-align: left; flex-shrink: 0;
  }
  .empty-row { border: none; }
  .empty-row td { display: block; text-align: center; }
  .empty-row td::before { content: none; }
}

/* ----------------------------------------------------------------------------
   11. LISTAS
   ---------------------------------------------------------------------------- */
.card-list { display: flex; flex-direction: column; gap: 7px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel);
  transition: background var(--transition), border-color var(--transition);
}
.list-item.row-clickable { cursor: pointer; }
.list-item.row-clickable:hover { background: var(--panel-2); border-color: var(--border-strong); }
.list-item .info { flex: 1; min-width: 0; }
/* Posição no ranking, à esquerda de cada pessoa */
.rank-pos {
  flex-shrink: 0; min-width: 30px; text-align: center;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}
.rank-pos.top { color: var(--gold); }
/* Bloco à direita: horas da semana, meta, total vendido e contratações */
.team-metrics { flex-shrink: 0; width: 190px; display: flex; flex-direction: column; gap: 3px; }
.team-metrics .tm-linha {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px;
}
.team-metrics .tm-rot { color: var(--text-3); white-space: nowrap; }
.team-metrics .tm-linha b { font-size: 12.5px; color: var(--text-0); white-space: nowrap; }
.team-metrics .team-goal { margin: 2px 0 4px; }
/* Em telas estreitas a barra de meta sai de cena para o nome não quebrar;
   os números continuam visíveis, que é a informação principal da linha. */
@media (max-width: 620px) {
  .team-metrics { width: 138px; }
  .team-metrics .team-goal { display: none; }
  .team-metrics .tm-rot { font-size: 11px; }
  .rank-pos { min-width: 22px; font-size: 11.5px; }
  .list-item { gap: 9px; padding: 10px 11px; }
}
.list-item .info .t1 { font-size: 13.5px; font-weight: 700; color: var(--text-0); }
.list-item .info .t2 { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.row-clickable { cursor: pointer; }

/* ----------------------------------------------------------------------------
   12. PROGRESSO E PÓDIO
   ---------------------------------------------------------------------------- */
.progress {
  height: 7px; border-radius: var(--radius-full);
  background: var(--overlay-2); overflow: hidden;
}
.progress > div, .progress .bar {
  height: 100%; background: var(--accent);
  border-radius: var(--radius-full); transition: width 300ms ease;
}
.progress.thin { height: 5px; }
.progress.done > div { background: var(--green); }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin-bottom: 16px; }
.podium-item { flex: 1; max-width: 130px; text-align: center; }
.podium-item .crown { font-size: 15px; margin-bottom: 3px; color: var(--gold); }
.podium-item .avatar { margin: 0 auto 7px; width: 42px; height: 42px; font-size: 14px; }
.podium-item .pname {
  font-size: 12px; font-weight: 700; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-item .phours { font-size: 11px; color: var(--text-2); font-family: var(--mono); }
.podium-item .pos {
  margin-top: 7px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--overlay-1); border: 1px solid var(--border); border-bottom: none;
  font-weight: 800; font-size: 13px; color: var(--text-2);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 7px;
}
/* Baseado na colocação real (p1/p2/p3), não na ordem do DOM — o pódio é
   renderizado como [2º, 1º, 3º] para o vencedor aparecer ao centro. */
.podium-item.p1 .pos { height: 54px; background: var(--gold-soft); color: var(--gold); }
.podium-item.p2 .pos { height: 42px; }
.podium-item.p3 .pos { height: 34px; }
.podium-item.p1 .avatar { width: 48px; height: 48px; font-size: 15px; }

/* ----------------------------------------------------------------------------
   13. MODAIS
   ---------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 15, 20, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 150ms ease;
}
.modal-backdrop.show { opacity: 1; }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.modal-head p { margin-top: 3px; font-size: 12.5px; color: var(--text-2); }
.modal-close {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); border: 1px solid var(--border);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--overlay-1); color: var(--text-0); }
.modal-section-title {
  font-size: 11px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-3); margin: 18px 0 10px;
}
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.modal-actions .btn { flex: 1; min-width: 120px; }

@media (max-width: 620px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
}

/* ----------------------------------------------------------------------------
   14. TOASTS
   ---------------------------------------------------------------------------- */
.toast-root {
  position: fixed; top: 16px; right: 16px; left: 16px; z-index: 200;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
@media (min-width: 620px) { .toast-root { left: auto; } }
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
  color: var(--text-0); max-width: 380px; pointer-events: auto;
}

/* ----------------------------------------------------------------------------
   15. UTILITÁRIOS
   ---------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-2); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ----------------------------------------------------------------------------
   16. RESPONSIVO
   ---------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .topbar-container { padding: 8px 13px; gap: 8px; }
  .topbar-subtitle { display: none; }
  /* As 4 abas passam a caber na largura da tela: rótulo curto e divisão igual,
     para não ser preciso arrastar a barra para o lado. */
  .tabbar-inner { padding: 0 8px; overflow-x: visible; }
  .tab { flex: 1; min-width: 0; justify-content: center; padding: 11px 4px; font-size: 12.5px; gap: 6px; }
  .tab-label-full { display: none; }
  .tab-label-short { display: inline; }
  .dashboard-container { padding: 16px 13px 48px; gap: 14px; }
  .user-chip { padding: 3px; border-color: transparent; background: transparent; }
  .user-chip .u-info { display: none; }
  .tab-head h2 { font-size: 18px; }
  .card { padding: 15px; }
}
@media (max-width: 440px) {
  .duty-pill { order: 3; width: 100%; justify-content: center; }
  .podium-item .avatar { width: 36px; height: 36px; font-size: 12px; }
}
