/* =========================================================================
   GPlanSiS|Station — design system macOS (claro e escuro)
   Tokens no :root; o escuro vale pelo sistema (prefers-color-scheme) ou
   escolhido à mão (data-theme). Cores de sistema da Apple; séries dos
   gráficos validadas para daltonismo nos dois temas.
   ========================================================================= */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  --window: #ececec;
  --content: #ffffff;
  --grouped: #f5f5f7;
  --card: #ffffff;
  --card-2: #fbfbfd;
  --sidebar: rgba(234, 234, 239, 0.78);
  --toolbar: rgba(250, 250, 252, 0.82);
  --label: rgba(0, 0, 0, 0.86);
  --label-2: rgba(0, 0, 0, 0.56);
  --label-3: rgba(0, 0, 0, 0.32);
  --sep: rgba(0, 0, 0, 0.1);
  --sep-strong: rgba(0, 0, 0, 0.16);
  --fill: rgba(0, 0, 0, 0.05);
  --fill-2: rgba(0, 0, 0, 0.08);
  --fill-3: rgba(0, 0, 0, 0.12);
  --control: #ffffff;
  --control-border: rgba(0, 0, 0, 0.14);
  --control-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --shadow-window: 0 22px 70px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 10px 38px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  --accent: #007aff;
  --accent-text: #0066d6;
  --accent-fill: rgba(0, 122, 255, 0.12);
  --on-accent: #ffffff;
  --sel-sidebar: rgba(0, 0, 0, 0.09);
  --red: #ff3b30; --orange: #ff9500; --yellow: #ffcc00; --green: #34c759; --mint: #00c7be;
  --teal: #30b0c7; --cyan: #32ade6; --blue: #007aff; --indigo: #5856d6; --purple: #af52de; --pink: #ff2d55; --gray: #8e8e93;
  /* status (reservado: bom/atenção/sério/crítico) — sempre com ícone e texto */
  --good: #248a3d; --warn: #b25000; --bad: #d70015;
  --good-fill: rgba(52, 199, 89, 0.14); --warn-fill: rgba(255, 149, 0, 0.16); --bad-fill: rgba(255, 59, 48, 0.13);
  /* séries dos gráficos (ordem fixa) */
  --c1: #007aff; --c2: #ff9500; --c3: #af52de; --c4: #30b0c7; --c5: #ff2d55; --c6: #5856d6; --c7: #c9a100; --c-other: #a1a1a6;
  --grid: rgba(0, 0, 0, 0.07);
  --term-bg: #ffffff;
  --term-fg: #1d1d1f;
  --radius: 10px;
  --radius-sm: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --window: #2a2a2c; --content: #1e1e20; --grouped: #19191b; --card: #262628; --card-2: #2c2c2e;
    --sidebar: rgba(38, 38, 42, 0.74); --toolbar: rgba(34, 34, 36, 0.84);
    --label: rgba(255, 255, 255, 0.88); --label-2: rgba(255, 255, 255, 0.56); --label-3: rgba(255, 255, 255, 0.3);
    --sep: rgba(255, 255, 255, 0.1); --sep-strong: rgba(255, 255, 255, 0.16);
    --fill: rgba(255, 255, 255, 0.06); --fill-2: rgba(255, 255, 255, 0.1); --fill-3: rgba(255, 255, 255, 0.15);
    --control: rgba(255, 255, 255, 0.1); --control-border: rgba(255, 255, 255, 0.08);
    --control-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3), inset 0 0.5px 0 rgba(255, 255, 255, 0.08);
    --shadow-window: 0 22px 70px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
    --shadow-pop: 0 10px 38px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.14);
    --accent: #0a84ff; --accent-text: #4aa3ff; --accent-fill: rgba(10, 132, 255, 0.2); --sel-sidebar: rgba(255, 255, 255, 0.1);
    --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --green: #30d158; --mint: #63e6e2;
    --teal: #40c8e0; --cyan: #64d2ff; --blue: #0a84ff; --indigo: #5e5ce6; --purple: #bf5af2; --pink: #ff375f; --gray: #98989d;
    --good: #30d158; --warn: #ff9f0a; --bad: #ff6961;
    --good-fill: rgba(48, 209, 88, 0.16); --warn-fill: rgba(255, 159, 10, 0.18); --bad-fill: rgba(255, 69, 58, 0.18);
    --c1: #0a84ff; --c2: #d2740a; --c3: #bf5af2; --c4: #259db2; --c5: #ff375f; --c6: #7d7aff; --c7: #a88508; --c-other: #6e6e73;
    --grid: rgba(255, 255, 255, 0.08);
    --term-bg: #1b1b1d; --term-fg: #e6e6e8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --window: #2a2a2c; --content: #1e1e20; --grouped: #19191b; --card: #262628; --card-2: #2c2c2e;
  --sidebar: rgba(38, 38, 42, 0.74); --toolbar: rgba(34, 34, 36, 0.84);
  --label: rgba(255, 255, 255, 0.88); --label-2: rgba(255, 255, 255, 0.56); --label-3: rgba(255, 255, 255, 0.3);
  --sep: rgba(255, 255, 255, 0.1); --sep-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(255, 255, 255, 0.06); --fill-2: rgba(255, 255, 255, 0.1); --fill-3: rgba(255, 255, 255, 0.15);
  --control: rgba(255, 255, 255, 0.1); --control-border: rgba(255, 255, 255, 0.08);
  --control-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.3), inset 0 0.5px 0 rgba(255, 255, 255, 0.08);
  --shadow-window: 0 22px 70px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  --shadow-pop: 0 10px 38px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  --accent: #0a84ff; --accent-text: #4aa3ff; --accent-fill: rgba(10, 132, 255, 0.2); --sel-sidebar: rgba(255, 255, 255, 0.1);
  --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --green: #30d158; --mint: #63e6e2;
  --teal: #40c8e0; --cyan: #64d2ff; --blue: #0a84ff; --indigo: #5e5ce6; --purple: #bf5af2; --pink: #ff375f; --gray: #98989d;
  --good: #30d158; --warn: #ff9f0a; --bad: #ff6961;
  --good-fill: rgba(48, 209, 88, 0.16); --warn-fill: rgba(255, 159, 10, 0.18); --bad-fill: rgba(255, 69, 58, 0.18);
  --c1: #0a84ff; --c2: #d2740a; --c3: #bf5af2; --c4: #259db2; --c5: #ff375f; --c6: #7d7aff; --c7: #a88508; --c-other: #6e6e73;
  --grid: rgba(255, 255, 255, 0.08);
  --term-bg: #1b1b1d; --term-fg: #e6e6e8;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13px/1.38 var(--font); color: var(--label); background: var(--window);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: -0.003em;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-fill); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-radius: 6px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--label-2); }
.faint { color: var(--label-3); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
svg { flex: none; }
/* todo ícone tem tamanho; regras mais específicas (botões, listas, cartões) ajustam */
:where(svg[aria-hidden="true"]) { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.menu button svg { width: 15px; height: 15px; }
.gr > svg { width: 18px; height: 18px; color: var(--label-2); }
table.t td svg { width: 15px; height: 15px; color: var(--label-2); }
.empty svg, .sheet-icon { display: block; margin-left: auto; margin-right: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- janela ---------- */
.window { position: fixed; inset: 0; display: grid; grid-template-columns: var(--sbw, 236px) 1fr; background: var(--content); overflow: hidden; }
.sidebar {
  background: var(--sidebar); backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-right: 0.5px solid var(--sep-strong); display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 3;
}
.sb-top { display: flex; align-items: center; gap: 8px; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; flex: none; }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18); }
.lights i:nth-child(1) { background: #ff5f57; } .lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.sb-scroll { overflow-y: auto; flex: 1; padding: 0 10px 12px; min-height: 0; }
.sb-section { font-size: 11px; font-weight: 600; color: var(--label-3); margin: 14px 8px 4px; letter-spacing: 0.01em; }
.sb-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; background: none; border-radius: 6px;
  text-align: left; cursor: default; color: var(--label); min-height: 28px;
}
.sb-item svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.sb-item:hover { background: var(--fill); }
.sb-item[aria-current="page"] { background: var(--sel-sidebar); font-weight: 500; }
.sb-item .badge { margin-left: auto; }
.sb-foot { border-top: 0.5px solid var(--sep); padding: 8px 10px; display: flex; gap: 6px; align-items: center; flex: none; }
.macpick {
  margin: 0 10px 6px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 0;
  background: var(--fill); width: calc(100% - 20px); text-align: left; cursor: default;
}
.macpick:hover { background: var(--fill-2); }
.macpick .mk-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.macpick .mk-sub { font-size: 11px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.macpick svg { width: 26px; height: 26px; color: var(--label-2); flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); display: inline-block; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--good-fill); }
.search {
  display: flex; align-items: center; gap: 6px; margin: 0 10px 4px; padding: 4px 8px; border-radius: 7px; background: var(--fill);
  border: 0.5px solid transparent;
}
.search:focus-within { background: var(--control); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.search svg { width: 14px; height: 14px; color: var(--label-2); flex: none; }
.search input { border: 0; background: none; outline: none; width: 100%; padding: 1px 0; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.toolbar {
  height: calc(52px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  flex: none; display: flex; align-items: center; gap: 10px; padding-left: 20px; padding-right: max(14px, env(safe-area-inset-right));
  background: var(--toolbar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep); position: relative; z-index: 2;
}
.toolbar h1 { font-size: 15px; font-weight: 700; margin: 0; white-space: nowrap; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-mac { display: none; align-items: center; gap: 6px; border: 0; background: var(--fill); border-radius: 14px; padding: 4px 10px; max-width: 42vw; font-size: 12px; font-weight: 500; cursor: default; flex: none; }
.tb-mac span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-mac:hover { background: var(--fill-2); }
.sb-scrim { display: none; }
.toolbar .sub { color: var(--label-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar .spacer { flex: 1; }
.tb-btn {
  border: 0; background: none; width: 32px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--label-2); cursor: default;
}
.tb-btn:hover { background: var(--fill); color: var(--label); }
.tb-btn[aria-pressed="true"] { background: var(--fill-2); color: var(--accent); }
.tb-btn svg { width: 18px; height: 18px; }
.sb-toggle { display: none; }
.content { flex: 1; overflow: auto; background: var(--grouped); min-height: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 22px 26px 40px; }
.page-narrow { max-width: 780px; }

/* ---------- blocos ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 0.5px var(--sep), 0 1px 2px rgba(0, 0, 0, 0.04); padding: 14px 16px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card h3 svg { width: 15px; height: 15px; color: var(--accent); }
.card .big { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.card .big small { font-size: 13px; font-weight: 500; color: var(--label-2); letter-spacing: 0; }
.card-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 12px; }
.kv dt { color: var(--label-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-title { font-size: 13px; font-weight: 600; margin: 22px 2px 8px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }
.section-title .muted { font-weight: 400; }
.lead { color: var(--label-2); margin: -4px 2px 14px; max-width: 760px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* lista agrupada (Ajustes do Sistema) */
.group { background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 0.5px var(--sep); overflow: hidden; }
.group + .group { margin-top: 14px; }
.gr { display: flex; align-items: center; gap: 12px; padding: 9px 14px; min-height: 42px; position: relative; }
.gr + .gr::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 0.5px solid var(--sep); }
.gr .gr-main { flex: 1; min-width: 0; }
.gr .gr-title { font-weight: 500; }
.gr .gr-desc { color: var(--label-2); font-size: 12px; margin-top: 1px; }
.gr .gr-icon { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex: none; color: #fff; }
.gr .gr-icon svg { width: 16px; height: 16px; }
.gr.clickable:hover { background: var(--fill); }
.gr-sub { padding-left: 52px; background: var(--card-2); }
.gr-sub .gr-title { font-weight: 400; }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 12px; min-height: 26px; border-radius: 6px;
  background: var(--control); border: 0; box-shadow: var(--control-shadow); cursor: default; white-space: nowrap; font-weight: 500;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { filter: brightness(0.92); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.2); }
.btn.danger { color: var(--bad); }
.btn.primary.danger { background: var(--red); color: #fff; }
.btn.lg { min-height: 32px; padding: 6px 18px; font-size: 14px; border-radius: 8px; }
.btn.plain { background: none; box-shadow: none; color: var(--accent-text); padding: 4px 6px; }
.btn.plain:hover { background: var(--fill); filter: none; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.input, .select {
  background: var(--control); border: 0; box-shadow: var(--control-shadow); border-radius: 6px; padding: 4px 8px; min-height: 26px; outline: none; min-width: 0;
}
.input:focus, .select:focus { box-shadow: 0 0 0 3px var(--accent-fill), 0 0 0 1px var(--accent); }
.input.wide { flex: 1; min-width: 180px; }
.select { padding-right: 24px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; }
.seg { display: inline-flex; background: var(--fill-2); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 3px 11px; border-radius: 5px; cursor: default; white-space: nowrap; min-height: 22px; }
.seg button[aria-pressed="true"] { background: var(--control); box-shadow: var(--control-shadow); font-weight: 500; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.18); } }
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: default; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--fill-3); transition: background 0.18s; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.06); transition: transform 0.18s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-fill); }
.switch input:disabled + span { opacity: 0.5; }
.check { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--fill-2); color: var(--label-2); white-space: nowrap; }
.badge svg { width: 11px; height: 11px; }
.badge.good { background: var(--good-fill); color: var(--good); }
.badge.warn { background: var(--warn-fill); color: var(--warn); }
.badge.bad { background: var(--bad-fill); color: var(--bad); }
.badge.accent { background: var(--accent-fill); color: var(--accent-text); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--fill); font-size: 12px; }
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note.warn { background: var(--warn-fill); } .note.warn svg { color: var(--warn); }
.note.bad { background: var(--bad-fill); } .note.bad svg { color: var(--bad); }
.note.good { background: var(--good-fill); } .note.good svg { color: var(--good); }
.note.info svg { color: var(--accent); }
.note .grow { flex: 1; }
.empty { text-align: center; padding: 44px 20px; color: var(--label-2); }
.empty svg { width: 42px; height: 42px; color: var(--label-3); margin-bottom: 8px; }
.empty h2 { font-size: 17px; color: var(--label); margin: 4px 0 6px; }
.hero-action { text-align: center; padding: 34px 20px 28px; }
.hero-action .ico { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 12px; color: #fff; }
.hero-action .ico svg { width: 34px; height: 34px; }
.hero-action h2 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.01em; }
.hero-action p { color: var(--label-2); margin: 0 auto 16px; max-width: 520px; }

/* barra de progresso / medidor */
.meter { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; position: relative; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); transition: width 0.4s; }
.meter.lg { height: 10px; border-radius: 5px; }
.meter.indet > i { width: 30% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { left: -30%; } 100% { left: 100%; } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--fill-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.stackbar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--fill-2); gap: 2px; }
.stackbar > i { display: block; height: 100%; min-width: 2px; }
.stackbar > i:hover { filter: brightness(1.12); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--label-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }

/* tabela */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 0.5px var(--sep); overflow: auto; }
table.t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 500; font-size: 11px; color: var(--label-2); padding: 7px 10px; border-bottom: 0.5px solid var(--sep); position: sticky; top: 0; background: var(--card); white-space: nowrap; z-index: 1; }
table.t th.sortable { cursor: default; }
table.t th.sortable:hover { color: var(--label); }
table.t th[aria-sort] { color: var(--label); }
table.t td { padding: 5px 10px; white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.t tbody tr:nth-child(even) td { background: var(--card-2); }
table.t tbody tr:hover td { background: var(--fill); }
table.t tbody tr[aria-selected="true"] td { background: var(--accent); color: var(--on-accent); }
table.t tbody tr[aria-selected="true"] td .muted { color: rgba(255, 255, 255, 0.8); }
table.t .r { text-align: right; }
table.t .w { width: 100%; }
table.t td.w { max-width: 0; }  /* a coluna principal ocupa o resto e corta com reticências */
.cellbar { display: flex; align-items: center; gap: 8px; }
.cellbar .meter { flex: 1; min-width: 60px; height: 5px; }

/* ---------- folha (sheet) e avisos ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.22); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 60px 16px 16px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow-window); width: min(520px, 100%); max-height: calc(100vh - 90px);
  display: flex; flex-direction: column; animation: drop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.sheet.wide { width: min(780px, 100%); }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }
.sheet-body { padding: 20px 22px 6px; overflow: auto; }
.sheet-body h2 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.sheet-body p { margin: 0 0 10px; color: var(--label-2); }
.sheet-icon { width: 54px; height: 54px; margin-bottom: 8px; color: var(--accent); }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; }
.sheet-foot .grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--label-2); }
.field .input, .field .select { width: 100%; }
.codebox { display: flex; gap: 8px; align-items: center; background: var(--fill); border-radius: 8px; padding: 8px 10px; }
.codebox code { flex: 1; font-family: var(--mono); font-size: 12px; word-break: break-all; user-select: all; }
.pair-code { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: 0.12em; text-align: center; padding: 8px; }
.toasts { position: fixed; right: 16px; top: 64px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--card); box-shadow: var(--shadow-pop); border-radius: 12px; padding: 10px 12px; width: 330px;
  display: flex; gap: 10px; align-items: flex-start; animation: slidein 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.toast .ti { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; background: var(--accent); flex: none; }
.toast .ti svg { width: 14px; height: 14px; }
.toast.good .ti { background: var(--green); } .toast.bad .ti { background: var(--red); } .toast.warn .ti { background: var(--orange); }
.toast b { display: block; font-weight: 600; }
.toast .tm { flex: 1; min-width: 0; font-size: 12px; color: var(--label-2); }
.toast .tm b { color: var(--label); font-size: 13px; }
.toast .btn { margin-top: 6px; }
.menu { position: fixed; background: var(--card); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 5px; z-index: 70; min-width: 220px; backdrop-filter: blur(30px); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 10px; border: 0; background: none; border-radius: 4px; text-align: left; cursor: default; min-height: 24px; }
.menu button:hover, .menu button:focus { background: var(--accent); color: #fff; outline: none; }
.menu button:hover .muted, .menu button:focus .muted { color: rgba(255, 255, 255, 0.8); }
.menu hr { border: 0; border-top: 0.5px solid var(--sep); margin: 4px 6px; }
.tooltip {
  position: fixed; pointer-events: none; z-index: 80; background: var(--card); box-shadow: var(--shadow-pop); border-radius: 8px;
  padding: 7px 9px; font-size: 12px; min-width: 120px; font-variant-numeric: tabular-nums;
}
.tooltip .tt-h { color: var(--label-2); font-size: 11px; margin-bottom: 3px; }
.tooltip .tt-r { display: flex; align-items: center; gap: 7px; }
.tooltip .tt-r i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-r b { font-weight: 600; }
.tooltip .tt-r span { color: var(--label-2); }

/* ---------- gráficos ---------- */
.chart { position: relative; width: 100%; height: 120px; }
.chart.sm { height: 64px; }
.chart.lg { height: 190px; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 600; font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .ring-v small { display: block; font-size: 10px; font-weight: 500; color: var(--label-2); margin-top: 2px; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 3px; height: 34px; align-items: end; }
.cores i { display: block; background: var(--c1); border-radius: 2px 2px 0 0; min-height: 2px; transition: height 0.4s; }
.cores i.e { background: var(--c4); }

/* ---------- terminal ---------- */
.drawer { flex: none; height: var(--drawer-h, 300px); display: flex; flex-direction: column; background: var(--term-bg); border-top: 0.5px solid var(--sep-strong); position: relative; min-height: 120px; }
.drawer.max { height: auto; position: absolute; inset: 52px 0 0 0; z-index: 4; }
.drawer-grip { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 2; }
.drawer-head { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 12px; border-bottom: 0.5px solid var(--sep); font-size: 12px; flex: none; }
.drawer-head b { font-weight: 600; }
.drawer-head > svg { width: 15px; height: 15px; color: var(--label-2); flex: none; }
.drawer-head .spacer { flex: 1; }
.drawer-head .tb-btn { width: 26px; height: 22px; }
.drawer-head .tb-btn svg { width: 15px; height: 15px; }
.term { flex: 1; overflow: auto; padding: 8px 12px 10px; font: 12.5px/1.5 var(--mono); color: var(--term-fg); white-space: pre-wrap; word-break: break-word; cursor: text; }
.term .ln { min-height: 1.5em; }
.term .prompt { color: var(--green); font-weight: 600; }
.term .path { color: var(--accent-text); }
.term .inputline { display: flex; gap: 0; align-items: baseline; }
.term .inputline input { flex: 1; border: 0; outline: none; background: none; font: inherit; color: inherit; padding: 0; margin-left: 0.6em; caret-color: var(--accent); }
.term .k-b { font-weight: 700; } .term .k-d { color: var(--label-2); } .term .k-g { color: var(--good); } .term .k-y { color: var(--warn); }
.term .k-r { color: var(--bad); } .term .k-a { color: var(--accent-text); } .term .k-p { color: var(--purple); }
.term .k-bar { letter-spacing: -0.06em; }
.term a { color: var(--accent-text); cursor: pointer; }
.term .sugg { color: var(--label-3); }

/* ---------- login / landing ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--window); }
.auth-card { width: min(380px, 100%); background: var(--card); border-radius: 14px; box-shadow: var(--shadow-window); padding: 30px 28px 24px; text-align: center; }
.auth-card .logo { width: 72px; height: 72px; margin: 0 auto 10px; }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card p { color: var(--label-2); margin: 0 0 18px; }
.auth-card .field { text-align: left; }
.auth-card .btn { width: 100%; }
.err { color: var(--bad); font-size: 12px; min-height: 16px; margin: 4px 0 10px; text-align: left; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .window { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-105%); transition: transform 0.22s, box-shadow 0.22s; box-shadow: none; background: var(--window); z-index: 30; padding-left: env(safe-area-inset-left); }
  .window.sb-open .sidebar { transform: none; box-shadow: var(--shadow-window); }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, 0.28); opacity: 0; pointer-events: none; transition: opacity 0.22s; }
  .window.sb-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .sb-toggle { display: grid; }
  .toolbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); gap: 6px; }
  .toolbar h1 { flex: 1; font-size: 16px; }
  .toolbar .spacer { display: none; }
  .tb-mac { display: inline-flex; }
  .drawer.max { inset: calc(52px + env(safe-area-inset-top)) 0 0 0; }
  .page { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  .page { padding: 16px 16px 30px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .toolbar .sub { display: none; }
  .toasts { left: 16px; right: 16px; } .toast { width: auto; }
  table.t td { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .stackbar > i, .legend i { forced-color-adjust: none; } }
