/* Meta3D visual identity. Loaded after module styles. */
:root {
  color-scheme: dark;
  --soft: #160e21;
  --paper: #21162f;
  --raised: #2c1e3c;
  --raised-soft: #39264c;
  --heading: #ffffff;
  --ink: #f5f0fa;
  --muted: #d9cfe4;
  --faint: #cbbfd8;
  --line: #3b2b4e;
  --line-strong: #645076;
  --brand: #a100ff;
  --brand-dark: #8f00e2;
  --brand-soft: #342044;
  --brand-readable: #e0bdff;
  --button-text: #fff;
  --focus: 0 0 0 3px #aa56ff55;
  --shadow: 0 4px 18px #10071926;
}
:root[data-theme="light"] {
  color-scheme: light;
  --soft: #f7f5fa;
  --paper: #fff;
  --raised: #f5f1f9;
  --raised-soft: #ece5f3;
  --heading: #1c0531;
  --ink: #352442;
  --muted: #6d5e7b;
  --faint: #6d5e7b;
  --line: #e8e1ee;
  --line-strong: #c5b5d3;
  --brand: #a100ff;
  --brand-dark: #8f00e2;
  --brand-soft: #f2e5ff;
  --brand-readable: #8500ce;
  --button-text: #fff;
  --focus: 0 0 0 3px #a100ff26;
  --shadow: 0 4px 18px #1c053108;
}
.nav-button.active,
:root[data-theme="light"] .nav-button.active,
.dashboard-billing span:last-child,
:root[data-theme="light"] .dashboard-billing span:last-child {
  color: var(--brand-readable);
}
.nav-button, .primary-button, .ghost-button { border-radius: 9px; }
:root:not([data-theme="light"]) .nav-button:not(.active),
:root:not([data-theme="light"]) label,
:root:not([data-theme="light"]) th { color: var(--ink); font-weight: 600; }
:root:not([data-theme="light"]) input::placeholder,
:root:not([data-theme="light"]) textarea::placeholder { color: var(--faint); opacity: 1; }
:root:not([data-theme="light"]) .registry-tabs button[aria-selected="true"] { color: var(--brand-readable); }
.primary-button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.ghost-button:hover, .metric-grid .metric:hover { border-color: var(--brand-readable); }
.metric-grid .metric { border-radius: 12px; box-shadow: var(--shadow); }
.table-wrap, .registry-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.dashboard-billing { padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.sidebar { border-right: 1px solid var(--line); }
.topbar { border-bottom-color: var(--line); }
.brand { position: relative; }
.brand::after { content: ""; position: absolute; bottom: -1px; left: 8px; width: 48px; height: 2px; background: linear-gradient(90deg,#f8446e,#a100ff); }
input, select, textarea { border-color: var(--line-strong); border-radius: 8px; accent-color: var(--brand); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand-readable); outline-offset: 2px; box-shadow: var(--focus);
}
/* Native popup options must not inherit the colored status control text.
   The closed control and all status badges retain their existing semantic palette. */
select option, select optgroup { background: var(--paper); color: var(--ink); }
select option:checked { background: var(--brand-dark); color: #fff; }
select option:disabled { color: var(--muted); }
.obs-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; min-height: 34px; padding: 6px; border-radius: 8px; }
.obs-button.empty { color: #a9a4b0; background: transparent; border: 1px solid var(--line); opacity: 1; }
:root[data-theme="light"] .obs-button.empty { color: #716b79; }
.obs-button:hover { border-color: var(--brand-readable); }
.obs-button.has-obs, :root[data-theme="light"] .obs-button.has-obs {
  color: #fff; background: #a100ff; border-color: #cf85ff;
  box-shadow: 0 0 0 2px #a100ff26;
}
.obs-button.has-obs:hover { background: #8f00e2; border-color: #e0bdff; }
table .urgency.active { color: #ffb4ae; background: #4b202b; border-color: #ed7770; }
:root[data-theme="light"] table .urgency.active { color: #b42318; background: #ffebe9; border-color: #e58b83; }
.row-status-suspenso td:first-child { box-shadow: inset 4px 0 0 #d9a65d; }
.metric-status-em-aberto { --card-rgb: 110, 168, 255; }
.metric-status-em-andamento { --card-rgb: 69, 199, 184; }
.metric-status-em-aprovacao { --card-rgb: 245, 220, 70; }
.metric-status-suspenso { --card-rgb: 255, 133, 42; }
.metric-status-concluido { --card-rgb: 152, 201, 119; }
.metric-grid .metric {
  position: relative;
  background: linear-gradient(135deg, rgba(var(--card-rgb), .26), rgba(var(--card-rgb), .09));
  border-color: rgba(var(--card-rgb), .48);
  box-shadow: inset 0 1px 0 #ffffff20, 0 6px 20px #00000018;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
:root[data-theme="light"] .metric-grid .metric {
  background: linear-gradient(135deg, rgba(var(--card-rgb), .38), rgba(var(--card-rgb), .18));
  border-color: rgba(var(--card-rgb), .85);
  box-shadow: inset 0 1px 0 #ffffffcc, 0 4px 16px #1c05310d;
}
:root[data-theme="light"] .metric-grid .metric span,
:root[data-theme="light"] .metric-grid .metric small { color: var(--ink); font-weight: 600; }
.metric-grid .metric.active { outline: 2px solid var(--brand-readable); outline-offset: 2px; }
:root:not([data-theme="light"]) .metric-grid .metric-status-em-aprovacao {
  background: linear-gradient(135deg, #494020, #302b22);
  border-color: #c2ac39;
}
:root:not([data-theme="light"]) .metric-grid .metric-status-suspenso {
  background: linear-gradient(135deg, #62351d, #352020);
  border-color: #d88139;
}
:root:not([data-theme="light"]) .metric-status-em-aprovacao span { color: #fff09a; }
:root:not([data-theme="light"]) .metric-status-suspenso span { color: #ffc18e; }
@media (hover: hover) and (pointer: fine) {
  .metric-grid .metric:hover {
    transform: translateY(-2px) scale(1.025);
    z-index: 1;
    border-color: rgba(var(--card-rgb), .85);
    box-shadow: inset 0 1px 0 #ffffff40, 0 10px 26px rgba(var(--card-rgb), .16);
  }
  :root[data-theme="light"] .metric-grid .metric:hover {
    background: linear-gradient(135deg, rgba(var(--card-rgb), .52), rgba(var(--card-rgb), .29));
    border-color: rgba(var(--card-rgb), 1);
    box-shadow: inset 0 1px 0 #fff, 0 8px 20px #1c053126, 0 0 0 1px rgba(var(--card-rgb), .5);
  }
  :root[data-theme="light"] tbody tr:hover { background: #eee5f7; }
}
:root[data-theme="light"] .status-control,
:root[data-theme="light"] .status-pill { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .metric-grid .metric { transition: none; }
  .metric-grid .metric:hover { transform: none; }
}
/* Keep selection stronger than per-status backgrounds and hover styles. */
:root:not([data-theme="light"]) .metric-grid .metric.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: inset 0 1px 0 #ffffff20;
}
:root[data-theme="light"] .metric-grid .metric.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: inset 0 1px 0 #ffffffcc;
}
:root .metric-grid .metric.active span,
:root .metric-grid .metric.active small { color: var(--ink); }
.case-badges { align-items: center; gap: 8px; }
.case-badges > span { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border: 1px solid currentColor; border-radius: 6px; font-size: 12px; line-height: 18px; font-weight: 600; }
.case-badges .case-urgent-badge { color: #ffb4ae; background: #4b202b; border-color: #ed7770; }
.case-badges .case-overdue-badge { color: #ffb4ae; background: transparent; border-style: dashed; }
:root[data-theme="light"] .case-urgent-badge { color: #b42318; background: #ffebe9; border-color: #e58b83; }
:root[data-theme="light"] .case-overdue-badge { color: #b42318; background: #fff5f4; border-color: #ca6a62; }
/* Shared status palette for closed selectors and case detail badges. */
.status-em-aberto { --status-rgb: 110,168,255; --status-text: #b4d2ff; --status-light-text: #174d87; }
.status-em-andamento { --status-rgb: 69,199,184; --status-text: #92e5d9; --status-light-text: #08665c; }
.status-em-aprovacao { --status-rgb: 245,220,70; --status-text: #fff09a; --status-light-text: #725b00; }
.status-suspenso { --status-rgb: 255,133,42; --status-text: #ffc18e; --status-light-text: #874000; }
.status-concluido { --status-rgb: 152,201,119; --status-text: #c3e7a9; --status-light-text: #3d6227; }
.status-cancelado { --status-rgb: 160,169,184; --status-text: #d5dce6; --status-light-text: #46505f; }
:root .status-control,
:root .status-pill,
:root .case-badges .status-pill {
  color: var(--status-text);
  background: linear-gradient(135deg, rgba(var(--status-rgb), .24), rgba(var(--status-rgb), .12));
  border: 1px solid rgba(var(--status-rgb), .55);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 #ffffff12;
  font-weight: 600;
}
:root[data-theme="light"] .status-control,
:root[data-theme="light"] .status-pill,
:root[data-theme="light"] .case-badges .status-pill {
  color: var(--status-light-text);
  background: linear-gradient(135deg, rgba(var(--status-rgb), .34), rgba(var(--status-rgb), .18));
  border-color: rgba(var(--status-rgb), .85);
  box-shadow: inset 0 1px 0 #ffffffaa;
}
.status-control:hover { border-color: rgb(var(--status-rgb)); }
.dashboard-charts {
  --chart-received: #aa56ff;
  --chart-completed: #7dcc96;
  --chart-load-end: #8700f1;
  --chart-track: #32233f;
}
:root[data-theme="light"] .dashboard-charts {
  --chart-received: #8f32d9;
  --chart-completed: #318653;
  --chart-load-end: #7800ca;
  --chart-track: #eae1f2;
}
.dashboard-charts .received-key { background: var(--chart-received); }
.dashboard-charts .completed-key { background: var(--chart-completed); }
.dashboard-charts .workload-track { background: var(--chart-track); }
.dashboard-charts .workload-track > div {
  background: linear-gradient(90deg, var(--chart-received), var(--chart-load-end));
}
@media (forced-colors: active) {
  select option, select optgroup { background: Canvas; color: CanvasText; }
  select option:checked { background: Highlight; color: HighlightText; }
}

.sidebar .brand-horizontal { display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:0 8px 26px; }
.brand-horizontal .brand-logo { width:200px; max-width:100%; height:auto; object-fit:contain; }
.brand-horizontal > span { width:200px; max-width:100%; text-align:center; }
.brand-horizontal .brand-logo-light { display:none; }
:root[data-theme="light"] .brand-horizontal .brand-logo-dark { display:none; }
:root[data-theme="light"] .brand-horizontal .brand-logo-light { display:block; }
.row-status-em-andamento td:first-child { box-shadow: inset 4px 0 0 #45c7b8; }
.row-status-em-aprovacao td:first-child { box-shadow: inset 4px 0 0 #f5dc46; }
.row-status-suspenso td:first-child { box-shadow: inset 4px 0 0 #ff852a; }
.row-status-concluido td:first-child { box-shadow: inset 4px 0 0 #98c977; }
@media(max-width:900px) { .brand-horizontal .brand-logo, .brand-horizontal > span { width:180px; } }
