/* ═══════════════════════════════════════════════════════════
   META CENTRAL DE SERVIÇOS — v6.0
   Design System — styles.css
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg:           #f4f6fa;
  --bg2:          #eef1f7;
  --card:         #ffffff;
  --sidebar:      #0d1117;
  --sidebar2:     #161b22;
  --line:         #e1e6ef;
  --line2:        #d0d7e3;
  --text:         #111827;
  --text2:        #4b5563;
  --text3:        #9ca3af;
  --blue:         #1d6ae5;
  --blue-dark:    #1355c0;
  --blue-soft:    #eff4ff;
  --blue-mid:     #dbeafe;
  --green:        #059669;
  --green-soft:   #ecfdf5;
  --amber:        #d97706;
  --amber-soft:   #fffbeb;
  --red:          #dc2626;
  --red-soft:     #fef2f2;
  --purple:       #7c3aed;
  --purple-soft:  #f3e8ff;
  --shadow-sm:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow:       0 4px 16px rgba(15,23,42,.08), 0 1px 4px rgba(15,23,42,.04);
  --shadow-lg:    0 12px 40px rgba(15,23,42,.12), 0 4px 12px rgba(15,23,42,.06);
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;
  --sidebar-w:    256px;
  --font:         'DM Sans', system-ui, sans-serif;
  --mono:         'DM Mono', monospace;
  --transition:   .18s cubic-bezier(.4,0,.2,1);
}

/* ── Temas alternáveis (mesmas cores do portal admin) ──────── */
[data-theme="dark"] {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --card:      #161b22;
  --line:      #30363d;
  --line2:     #21262d;
  --text:      #e6edf3;
  --text2:     #8b949e;
  --text3:     #656d76;
  --blue:      #2f81f7;
  --blue-dark: #1f6feb;
  --blue-soft: #0d2a4e;
  --blue-mid:  #0a1f3c;
  --green:     #3fb950;
  --green-soft:#0d2a0d;
  --amber:     #e3b341;
  --amber-soft:#2d1f00;
  --red:       #f85149;
  --red-soft:  #2d0e0e;
  --purple:      #a78bfa;
  --purple-soft: #2e1065;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow:    0 4px 16px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.2);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.3);
}
[data-theme="dark"] .form-row input,
[data-theme="dark"] .form-row select,
[data-theme="dark"] .form-row textarea {
  background: #0d1117;
  color: var(--text);
  border-color: var(--line);
}
[data-theme="dark"] .form-row input:focus,
[data-theme="dark"] .form-row select:focus,
[data-theme="dark"] .form-row textarea:focus { background: #0d1117; }

[data-theme="comando"] {
  --bg:        #eaecfb;
  --bg2:       #d5d8f6;
  --blue-soft: #eaecfb;
  --blue-mid:  #d5d8f6;
}
[data-theme="comando"] .panel,
[data-theme="comando"] .stat-card,
[data-theme="comando"] .form-card {
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
}

[data-theme="tecnico"] {
  --bg:        #f4f4f5;
  --bg2:       #e4e4e7;
  --line:      #d4d4d8;
  --line2:     #a1a1aa;
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;
  --font:      'DM Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
code { font-family: var(--mono); }

/* ── Screens ────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; width: 100%; }
.screen.active { display: block; }
#screen-login.active { display: flex; }

/* ══════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  align-items: stretch;
  background: linear-gradient(135deg, #0d1117 0%, #1a2332 50%, #0f1923 100%);
  position: relative;
  overflow: hidden;
}
#screen-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 20% 30%, rgba(29,106,229,.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(5,150,105,.10) 0%, transparent 50%);
  pointer-events: none;
}

.auth-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Left panel */
.auth-left {
  width: 460px;
  flex-shrink: 0;
  background:
    linear-gradient(160deg, rgba(29,106,229,.15) 0%, transparent 50%),
    rgba(255,255,255,.02);
  border-right: 1px solid rgba(255,255,255,.06);
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.brand {
  width: 100%;
  height: 130px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.brand img { width: 75%; height: auto; display: block; }

.auth-label {
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 16px;
}
.auth-title {
  font-size: 36px;
  font-weight: 300;
  color: #fff;
  line-height: 1.18;
  margin-bottom: 16px;
  letter-spacing: -.01em;
}
.auth-title strong { font-weight: 600; }
.auth-sub {
  font-size: 14px;
  color: rgba(255,255,255,.5);
  line-height: 1.75;
  max-width: 300px;
}

.auth-points {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-point {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: rgba(255,255,255,.6);
}
.auth-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

/* Right panel — form */
.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 48px;
  position: relative;
  z-index: 1;
}

.auth-form {
  width: 100%;
  max-width: 420px;
}

.form-eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 10px;
}
.form-title {
  font-size: 30px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.form-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,.45);
  margin-bottom: 28px;
  line-height: 1.6;
}

.role-toggle {
  display: flex;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}
.role-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.45);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.role-btn.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,106,229,.4);
}
.role-btn:hover:not(.active) { color: rgba(255,255,255,.75); }

.login-alert {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(220,38,38,.12);
  border: 1px solid rgba(220,38,38,.2);
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  padding: 13px 15px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.field input::placeholder { color: rgba(255,255,255,.25); }
.field input:focus {
  border-color: rgba(29,106,229,.6);
  background: rgba(29,106,229,.06);
  box-shadow: 0 0 0 3px rgba(29,106,229,.12);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(29,106,229,.35);
  letter-spacing: .01em;
}
.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(29,106,229,.45);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════ */
#screen-app { background: var(--bg); }

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-top {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar-logo img { width: 80%; height: auto; display: block; }
.sidebar-brand-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand-text span {
  font-size: 11px;
  color: rgba(255,255,255,.35);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 12px 8px 4px;
  font-weight: 500;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.55);
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 400;
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
}
.nav-btn .nav-icon {
  width: 18px;
  height: 18px;
  opacity: .6;
  flex-shrink: 0;
  transition: var(--transition);
}
.nav-btn:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.85);
}
.nav-btn:hover .nav-icon { opacity: .9; }
.nav-btn.active {
  background: rgba(29,106,229,.18);
  color: #fff;
  font-weight: 500;
}
.nav-btn.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}
.theme-switcher {
  display: flex;
  gap: 3px;
  margin-bottom: 8px;
}
.theme-btn {
  flex: 1;
  padding: 5px 2px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.45);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: var(--transition);
  font-family: 'DM Sans', system-ui, sans-serif;
}
.theme-btn:hover { background: rgba(255,255,255,.09); color: rgba(255,255,255,.8); }
.theme-btn.active { background: rgba(47,129,247,.2); color: #93bbf7; border-color: rgba(47,129,247,.35); }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; min-width: 0; }
.user-info strong {
  display: block;
  font-size: 12.5px;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info small {
  font-size: 11px;
  color: rgba(255,255,255,.35);
}
.btn-logout {
  width: 28px; height: 28px;
  border: none;
  background: rgba(255,255,255,.06);
  border-radius: 7px;
  color: rgba(255,255,255,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { background: rgba(220,38,38,.15); color: #fca5a5; }
.btn-logout svg { width: 15px; height: 15px; }

/* ── Main content ─────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 28px 0;
  flex-shrink: 0;
}
.topbar-left h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.topbar-left p { color: var(--text2); font-size: 13px; margin-top: 3px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

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

/* ── Buttons ──────────────────────────────────────────────── */
.btn, .ghost-btn, .solid-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.ghost-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
}
.ghost-btn:hover { border-color: var(--line2); background: var(--bg2); }
.solid-btn {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,106,229,.25);
}
.solid-btn:hover { background: var(--blue-dark); }
.danger-btn {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(220,38,38,.15);
}
.danger-btn:hover { background: rgba(220,38,38,.12); }

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: var(--blue-soft);
  color: var(--blue);
  transition: var(--transition);
}
.mini-btn:hover { background: var(--blue-mid); }
.mini-btn.danger { background: var(--red-soft); color: var(--red); }
.mini-btn.danger:hover { background: rgba(220,38,38,.12); }
.mini-btn.active { background: var(--blue); color: #fff; }

/* ── Cards / Stats ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 3px 3px 0 0;
}
.stat-card.green::before { background: linear-gradient(90deg, var(--green), #34d399); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.stat-card.red::before { background: linear-gradient(90deg, var(--red), #f87171); }
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.stat-card strong { font-size: 30px; font-weight: 600; letter-spacing: -.03em; }
.stat-card .stat-sub {
  display: inline-block;
  margin-top: 10px;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 500;
}
.stat-card.green .stat-sub { background: var(--green-soft); color: var(--green); }
.stat-card.amber .stat-sub { background: var(--amber-soft); color: var(--amber); }

/* ── Panel / Section ────────────────────────────────────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.panel-head p { color: var(--text2); font-size: 12.5px; margin-top: 2px; }
.panel-head-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}

/* ── Content grid ─────────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.content-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.table-empty { padding: 24px; text-align: center; color: var(--text3); }

/* ── Status badges ─────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status.open { background: var(--green-soft); color: var(--green); }
.status.open::before { background: var(--green); }
.status.pending { background: var(--amber-soft); color: var(--amber); }
.status.pending::before { background: var(--amber); }
.status.closed { background: var(--red-soft); color: var(--red); }
.status.closed::before { background: var(--red); }
.status.neutral { background: var(--bg2); color: var(--text2); }
.status.neutral::before { background: var(--text3); }

/* ── Form components ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.form-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

.form-row { margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.form-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 7px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,106,229,.1);
}
.form-row textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.form-row select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row input:disabled,
.form-row select:disabled { background: var(--bg); color: var(--text3); cursor: not-allowed; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.helper-text {
  font-size: 12.5px;
  color: var(--text3);
  margin-bottom: 14px;
  line-height: 1.6;
}
.helper-text code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--blue);
  border: 1px solid var(--line);
}

/* ── Quick items ───────────────────────────────────────────── */
.quick-list { display: flex; flex-direction: column; gap: 10px; }
.quick-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: var(--transition);
}
.quick-item:hover { border-color: var(--line2); }
.quick-item strong { display: block; font-size: 13.5px; margin-bottom: 3px; }
.quick-item > span { font-size: 12.5px; color: var(--text2); }

.quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.tab-btn.active { background: var(--card); color: var(--blue); box-shadow: var(--shadow-sm); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-screen { display: none; }
.tab-screen.active { display: block; }

/* ── Toolbar inline ───────────────────────────────────────── */
.toolbar-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar-inline .form-row { margin-bottom: 0; min-width: 200px; flex: 0 1 260px; }

/* ── Alert / info strip ────────────────────────────────────── */
.info-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.info-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  background: var(--card);
}
.info-box small { display: block; color: var(--text3); font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 5px; }
.info-box strong { font-size: 20px; font-weight: 600; }

.alert-banner {
  display: none;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #92400e;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-banner.show { display: flex; align-items: center; gap: 12px; }
.alert-banner strong { font-weight: 600; margin-right: 4px; }

/* ── Grade de programação ─────────────────────────────────── */
.grade-empresa {
  border-radius: var(--radius);
  transition: box-shadow .3s, background .3s;
}
.grade-empresa.grade-highlight {
  box-shadow: 0 0 0 3px var(--blue);
  background: var(--blue-soft);
}
.grade-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.grade-table th,
.grade-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
.grade-table th:first-child,
.grade-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; font-weight: 500; }
.grade-table th { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); }
.grade-table input {
  width: 80px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  background: var(--bg);
}
.grade-table input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29,106,229,.08);
}

.grade-bloqueio {
  display: none;
  padding: 14px 16px;
  background: var(--red-soft);
  border: 1px solid rgba(220,38,38,.15);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13.5px;
  margin-bottom: 14px;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px) scale(.97);
  pointer-events: none;
  transition: all .22s cubic-bezier(.4,0,.2,1);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text3);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.error { border-color: rgba(220,38,38,.2); color: var(--red); }
.toast.error::before { background: var(--red); }
.toast.success { border-color: rgba(5,150,105,.2); color: var(--green); }
.toast.success::before { background: var(--green); }

/* ── Bloqueio / vazio ─────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text3);
}
.empty-state svg { width: 40px; height: 40px; opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 13.5px; max-width: 260px; line-height: 1.6; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .content-grid-3 { grid-template-columns: 1fr 1fr; }
  .col-span-2, .col-span-3 { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .auth-left { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 16px 16px 0; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .info-strip { grid-template-columns: 1fr; }
}

/* ── Visão diária — linhas expansíveis ───────────────────── */
.rel-dia-expandable:hover { background: var(--blue-soft); }
.rel-dia-expanded { background: var(--blue-soft); }
.rel-dia-detalhe > td { padding: 0 !important; border-bottom: 2px solid var(--blue-mid) !important; }

/* ══════════════════════════════════════════════════════════
   COMPATIBILIDADE v7 — classes usadas pelo HTML atual
   (seção aditiva; não altera os tokens/componentes acima)
   ══════════════════════════════════════════════════════════ */

/* ── Layout principal ─────────────────────────────────────── */
#screen-app.active {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.content { min-width: 0; }

/* ── Sidebar v7 ───────────────────────────────────────────── */
.sidebar-logo {
  width: auto; height: auto;
  border-radius: 0;
  background: none;
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}
.sidebar-logo-inner { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sidebar-title { font-size: 15px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar-version { font-size: 11px; color: rgba(255,255,255,.35); }
.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); }

/* ── Sidebar recolhida ───────────────────────────────────── */
[data-sidebar="collapsed"] { --sidebar-w: 58px; }
[data-sidebar="collapsed"] .sidebar { overflow: hidden; }
[data-sidebar="collapsed"] .sidebar-logo { justify-content: center; padding: 16px 0; }
[data-sidebar="collapsed"] .sidebar-logo-inner { display: none; }
[data-sidebar="collapsed"] .sidebar-toggle { transform: rotate(180deg); }
[data-sidebar="collapsed"] .nav-btn { font-size: 0; justify-content: center; padding: 10px 0; }
[data-sidebar="collapsed"] .nav-icon { width: 20px; height: 20px; opacity: .8; }
[data-sidebar="collapsed"] .nav-btn.active .nav-icon { opacity: 1; }
[data-sidebar="collapsed"] .nav-btn:hover .nav-icon { opacity: 1; }
[data-sidebar="collapsed"] .sidebar-empresa-info { display: none; }
[data-sidebar="collapsed"] .sidebar-user-name { display: none; }
[data-sidebar="collapsed"] .theme-switcher { display: none; }
[data-sidebar="collapsed"] .logout-btn { font-size: 0; padding: 10px 0; gap: 0; }
[data-sidebar="collapsed"] .sidebar-footer { padding: 12px 0; }

.nav-links {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.sidebar-user-name {
  display: block;
  font-size: 12.5px;
  color: rgba(255,255,255,.7);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logout-btn {
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.logout-btn:hover { background: rgba(220,38,38,.15); color: #fca5a5; border-color: rgba(220,38,38,.2); }

/* ── Cabeçalho de página ──────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.page-subtitle { color: var(--text2); font-size: 13px; margin-top: 3px; }

/* ── Dashboard: tiras de cards e gráficos ─────────────────── */
.cards-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.cards-strip-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  height: 300px;
  position: relative;
}
.chart-card canvas { max-width: 100%; }

/* ── Sub-abas (Relatórios, Mala direta) ───────────────────── */
.subtab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
  flex-wrap: wrap;
}
.subtab-btn {
  border: none;
  background: transparent;
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.subtab-btn.active { background: var(--card); color: var(--blue); box-shadow: var(--shadow-sm); }
.subtab-btn:hover:not(.active) { color: var(--text); }
.subtab-screen { display: none; }
.subtab-screen.active { display: block; }

/* ── Tabelas (alias) e selects de filtro ──────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.filter-select {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  outline: none;
}
.filter-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,106,229,.1); }

/* ── Badges de status (gerados pelo JS) ───────────────────── */
.status.status-ativo    { background: var(--green-soft); color: var(--green); }
.status.status-ativo::before    { background: var(--green); }
.status.status-inativo  { background: var(--red-soft); color: var(--red); }
.status.status-inativo::before  { background: var(--red); }
.status.status-pendente { background: var(--amber-soft); color: var(--amber); }
.status.status-pendente::before { background: var(--amber); }

/* ── Nível (pílula reutilizável — mesmas cores do admin) ── */
.nivel-pill {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; border: 1px solid transparent;
  line-height: 1.6; white-space: nowrap;
}
.nivel-pill.nivel-1 { background: var(--blue-soft);   color: var(--blue); }
.nivel-pill.nivel-2 { background: var(--green-soft);  color: var(--green); }
.nivel-pill.nivel-3 { background: var(--amber-soft);  color: var(--amber); }
.nivel-pill.nivel-4 { background: var(--purple-soft); color: var(--purple); }
.nivel-pill.nivel-5 { background: var(--red-soft);    color: var(--red); }

/* ── Toast: variantes por tipo (JS aplica .show + tipo) ───── */
.toast.toast-success { border-color: rgba(5,150,105,.2); color: var(--green); }
.toast.toast-success::before { background: var(--green); }
.toast.toast-error { border-color: rgba(220,38,38,.2); color: var(--red); }
.toast.toast-error::before { background: var(--red); }

/* ══════════════════════════════════════════════════════════
   LOGIN v7 — card central sobre o gradiente
   ══════════════════════════════════════════════════════════ */
.login-box {
  margin: auto;
  width: 100%;
  max-width: 380px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  text-align: center;
}
.login-logo { max-height: 64px; width: auto; margin: 0 auto 18px; display: block; }
.login-title { font-size: 26px; font-weight: 600; color: #fff; letter-spacing: -.02em; }
.login-sub { font-size: 13px; color: rgba(255,255,255,.5); margin-bottom: 26px; }
.login-input {
  width: 100%;
  padding: 13px 15px;
  margin-bottom: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.login-input::placeholder { color: rgba(255,255,255,.3); }
.login-input:focus { border-color: rgba(29,106,229,.6); background: rgba(29,106,229,.06); box-shadow: 0 0 0 3px rgba(29,106,229,.12); }
.login-btn {
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  background: var(--blue);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(29,106,229,.35);
}
.login-btn:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; }
.login-erro { color: #fca5a5; font-size: 13px; margin-top: 14px; min-height: 18px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVO v7 — navegação acessível no mobile
   (sobrepõe o "display:none" da seção responsiva anterior)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #screen-app.active { grid-template-columns: 1fr; }
  .cards-strip, .cards-strip-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-grid { grid-template-columns: 1fr; }
  .sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 50;
    overflow: visible;
  }
  .sidebar-logo { padding: 12px 14px; border-bottom: none; border-right: 1px solid rgba(255,255,255,.06); }
  .nav-links { flex-direction: row; overflow-x: auto; flex: 1; padding: 8px; gap: 4px; }
  .nav-btn { width: auto; white-space: nowrap; }
  .sidebar-footer { border-top: none; padding: 8px 12px; flex-shrink: 0; }
  .sidebar-user-name { display: none; }
  .logout-btn { width: auto; padding: 8px 12px; }
}
@media (max-width: 560px) {
  .cards-strip, .cards-strip-5 { grid-template-columns: 1fr; }
  .login-box { padding: 32px 24px; }
}
