/* Interface compartilhada. Tokens semânticos preservam os componentes legados. */
:root {
  --page: #101419; --surface: #181e25; --surface-2: #222a34; --surface-3: #2c3743;
  --text: #f0f3f7; --text-2: #b9c4d1; --muted: #9aa8b8;
  --border: #303a46; --border-strong: #536173;
  --brand: #93c5fd; --brand-2: #bfdbfe; --brand-ink: #102c4d;
  --brand-glow: transparent; --good: #6ee7b7;
  /* Ação primária do protótipo aprovado (#313): mesmo azul nos dois temas, texto branco (4,57:1). */
  --action: #2f6feb; --action-hover: #2559c9; --action-ink: #ffffff;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --shadow-sm: 0 2px 5px #00000014; --shadow: 0 8px 28px #00000024;
}
body.theme-light {
  --page: #f4f6f8; --surface: #fff; --surface-2: #f0f3f6; --surface-3: #e5eaf0;
  --text: #1b2838; --text-2: #48596d; --muted: #617084;
  --border: #e0e6ec; --border-strong: #a4b1c0; --good: #137957;
  --warning: #9b6500; --critical: #bc303a;
  --brand: #2563eb; --brand-2: #1d4ed8; --brand-ink: #ffffff;
  --shadow-sm: 0 2px 5px #182b4306; --shadow: 0 8px 28px #182b430d;
}
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 3000; padding: 14px; background: var(--surface); color: var(--text); border: 2px solid var(--text); border-radius: 8px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #5288c8; outline-offset: 3px; }
.btn { min-height: 38px; box-shadow: none; }
.btn:hover, .icon-btn:hover { transform: none; filter: none; }
.btn-primary { background: var(--action); color: var(--action-ink); box-shadow: none; }
.btn-primary:hover { background: var(--action-hover); box-shadow: none; }
.link-btn { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.sidebar { width: 252px; padding: 24px 14px 14px; }
.brand { padding: 0 10px 28px; gap: 10px; }
.brand-name { font-size: 18px; letter-spacing: -.7px; }
.brand-name small { display: block; font-size: 8px; letter-spacing: 1.5px; margin-top: 6px; color: var(--muted); font-weight: 600; }
.brand-accent { font-weight: 500; }
.nav { gap: 2px; padding: 2px 0; }
.nav-item { min-height: 40px; font-size: 12px; padding: 10px 12px; gap: 11px; margin-bottom: 3px; border: 1px solid transparent; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item.active { background: var(--surface-2); border-color: var(--border); font-weight: 650; }
.nav-item.active svg { color: var(--text); }
.nav-item.active::before { left: 0; width: 3px; top: 28%; bottom: 28%; background: var(--brand); box-shadow: none; }
.sidebar-footer { font-size: 11px; padding-top: 16px; }
.sidebar-footer .dot { display: none; }
.topbar, body.theme-light .topbar { background: var(--surface); height: 86px; padding: 0 32px; backdrop-filter: none; }
.topbar h2 { font-size: 21px; letter-spacing: -.7px; margin-top: 5px; }
.topbar-actions { gap: 12px; }
.user-menu { padding-left: 16px; border-left: 1px solid var(--border); }
.avatar { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); box-shadow: none; border-radius: 12px; }
.content { padding: 20px 32px 36px; }
.card { box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.card h3 { letter-spacing: -.3px; }
.cam-side-item { padding: 12px; background: var(--surface); border: 1px solid var(--border); }
.cam-side-item:hover { filter: none; background: var(--surface-2); }
.cam-side-item.active { background: var(--surface-2); border-color: var(--border-strong); box-shadow: inset 3px 0 var(--brand); }
.cam-side-thumb { width: 80px; height: 48px; }
.cam-side-info .csi-name { font-size: 13px; }
.cam-side-info .csi-loc { margin-top: 4px; }
.mc-player-view { background: #080c12; }
.mc-player-footer { padding: 16px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
td { font-size: 13px; }
tbody tr:hover { background: var(--surface-2); }
input, select, textarea { accent-color: var(--brand); }
@media (min-width: 721px) and (max-width: 1100px) {
  .sidebar { width: 218px; }
  .topbar, body.theme-light .topbar { padding: 0 20px; }
  .content { padding: 20px; }
  .topbar-actions { gap: 8px; }
  .user-info { display: none; }
}
@media (max-width: 720px) {
  .sidebar { width: 100%; padding: 10px; }
  .brand-name small { display: none; }
  :is(#client-area-screen, #tecnico-screen) .topbar { height: 64px; }
  :is(#platform-admin-screen, #app-shell) .sidebar .brand { display: none; }
  :is(#platform-admin-screen, #app-shell) .nav-item span { display: inline; }
  :is(#platform-admin-screen, #app-shell) .topbar { padding: 12px; height: auto; gap: 12px; flex-wrap: wrap; }
  :is(#platform-admin-screen, #app-shell) .content { padding: 16px; }
}

.workspace-empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.workspace-empty svg { width: 32px; height: 32px; margin: 0 auto 16px; }
.workspace-empty h4 { color: var(--text); font-size: 14px; margin: 0 0 8px; }
.workspace-empty p { font-size: 13px; margin: 0; line-height: 1.6; }

/* Identidade azul, com verde reservado a confirmação e disponibilidade. */
.brand-accent { color: var(--brand); }
.nav-item.active { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.nav-item.active svg { color: var(--brand); }

.modal-close { min-width: 40px; min-height: 40px; }

/* Acesso › Grupos (#322): só a mensagem de carga; tabela e formulário vêm de css/ui.css. */
#rbac-status { margin:12px 0; }


[data-erp-audit] { min-width:0; overflow-wrap:anywhere; }
.erp-form { border-top:1px solid var(--border); margin-top:16px; padding-top:12px; }
/* #322: painéis da integração dentro das abas do formulário padrão. */
.ui-form .erp-form { border-top:0; margin-top:0; padding-top:0; min-width:0; overflow-wrap:anywhere; }
.ui-form .erp-form h4 { margin:0 0 4px; }
.ui-form .erp-form p { margin:6px 0; font-size:.9rem; }
.ui-form .erp-form .btn { margin:4px 8px 4px 0; }
.erp-form .field { display:flex; flex-direction:column; gap:6px; margin:14px 0; }
.erp-form input { width:100%; min-height:44px; }
.erp-form input[type="checkbox"] { width:auto; min-height:0; }
#integrations-content button { margin:6px 8px 6px 0; min-height:40px; }
.erp-results li, [data-erp-audit] li { padding:12px 0; border-bottom:1px solid var(--border); }
#integrations-status { margin:12px 0; }
.erp-tabs { display:flex; flex-wrap:wrap; margin:8px 0; }
.erp-tabs [aria-pressed="true"] { border-color:var(--brand); color:var(--brand); font-weight:600; }
.erp-schedule > label:first-child { display:flex; align-items:center; gap:8px; min-height:44px; }
.erp-results label { display:inline-flex; align-items:flex-start; gap:8px; }
.erp-results h5 { margin:12px 0 4px; }
/* #328: agendamento e cadastro automático, falhas e detalhe do cliente do ERP. */
.erp-form .erp-schedule, .erp-form .erp-results { margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }
.erp-check { display:flex; align-items:center; gap:8px; min-height:44px; }
.erp-plans-check { border:1px solid var(--border); border-radius:10px; padding:8px 14px; margin:8px 0 14px; min-width:0; }
.erp-plans-check legend { padding:0 6px; font-weight:600; font-size:.9rem; }
.erp-plans { display:block; max-width:100%; overflow-x:auto; border-collapse:collapse; margin:8px 0; }
.erp-plans th, .erp-plans td { padding:4px 6px; text-align:left; vertical-align:middle; }
.erp-plans input { width:6.5em; }

/* Ações de segurança da administração também precisam caber no celular. */
#platform-mfa-panel { max-width: 780px; }
#platform-mfa-panel input { width: 100%; box-sizing: border-box; }
:is(#platform-admin-screen, #app-shell) .main { min-width: 0; }
@media (max-width: 720px) {
  :is(#platform-admin-screen, #app-shell) .topbar-actions { width: 100%; min-width: 0; }
  :is(#platform-admin-screen, #app-shell) .user-menu { min-width: 0; flex: 1; flex-wrap: wrap; padding-left: 0; border-left: 0; }
}
