/* =====================================================================
   OB Gerenciamento — Design System
   Terminal financeiro escuro · grafite · acento ciano · numerais tabulares
   ===================================================================== */

@font-face { font-family: "Inter"; src: url("../fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jbmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jbmono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #07090c;
  --bg-2: #0b0e13;
  --surface: #10141a;
  --surface-2: #151a22;
  --surface-3: #1b212b;
  --line: rgba(148, 163, 184, .10);
  --line-2: rgba(148, 163, 184, .16);
  --text: #e7ebf0;
  --text-2: #b4bdca;
  --muted: #7d8899;
  --faint: #556070;

  --accent: #22d3ee;
  --accent-2: #38bdf8;
  --accent-soft: rgba(34, 211, 238, .12);
  --pos: #22c55e;
  --pos-2: #4ade80;
  --pos-soft: rgba(34, 197, 94, .12);
  --neg: #f43f5e;
  --neg-2: #fb7185;
  --neg-soft: rgba(244, 63, 94, .12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .13);
  --info: #60a5fa;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-pop: 0 24px 60px -20px rgba(0,0,0,.8), 0 0 0 1px var(--line-2);
  --sidebar: 252px;
  --topbar: 64px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5; font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.has-grid {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(34, 211, 238, .06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, .04), transparent 60%),
    var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(34, 211, 238, .3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 22px; height: 22px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.is-pos { color: var(--pos); } .is-neg { color: var(--neg); } .is-neutral { color: var(--text-2); } .is-warn { color: var(--warn); } .is-accent { color: var(--accent); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

/* ---------------------------------------------------------------- Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: linear-gradient(180deg, #0b0e13 0%, #090b0f 100%); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, rgba(34,211,238,.22), rgba(56,189,248,.06)); border: 1px solid rgba(34,211,238,.35);
  color: var(--accent); box-shadow: 0 0 24px -6px rgba(34,211,238,.6);
}
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav-section { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; position: relative;
}
.nav a .icon { color: var(--muted); transition: color .15s; }
.nav a:hover { background: rgba(148,163,184,.06); color: var(--text); }
.nav a:hover .icon { color: var(--text-2); }
.nav a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active .icon { color: var(--accent); }
.nav a.active::before { content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav .badge-dot { margin-left: auto; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
  background: linear-gradient(135deg, #1e293b, #0f172a); border: 1px solid var(--line-2); color: var(--accent);
}
.user-chip .name { font-weight: 600; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-chip .role { font-size: 11px; color: var(--muted); }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 16px;
  padding: 0 28px; background: rgba(7, 9, 12, .78); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; font-weight: 650; }
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 26px 28px 60px; width: 100%; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }

/* ---------------------------------------------------------------- Grid */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.grow { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Cards */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, #0e1218 100%); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon, .card-head h3 .icon { color: var(--accent); }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
.card.flat { box-shadow: none; background: var(--surface); }
.card.glow { border-color: rgba(34,211,238,.25); box-shadow: var(--shadow), 0 0 0 1px rgba(34,211,238,.06), 0 0 40px -20px rgba(34,211,238,.5); }

/* KPI */
.kpi { padding: 16px 18px 15px; position: relative; overflow: hidden; }
.kpi .label { display: flex; align-items: center; gap: 7px; }
.kpi .label .icon { width: 14px; height: 14px; color: var(--faint); }
.kpi-value { font-family: var(--mono); font-weight: 600; font-size: 22px; letter-spacing: -.03em; margin-top: 8px; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-value.lg { font-size: 30px; }
.kpi-meta { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi.hero { padding: 22px 22px 20px; }
.kpi.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.16), transparent 70%); pointer-events: none;
}
.delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.delta.is-pos { background: var(--pos-soft); } .delta.is-neg { background: var(--neg-soft); } .delta.is-neutral { background: rgba(148,163,184,.08); }
.delta .icon { width: 13px; height: 13px; }
.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-strip > * + * { border-left: 1px solid var(--line); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  --b: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--b); color: var(--text); font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: transform .12s var(--ease), background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #222a35; color: var(--text); border-color: rgba(148,163,184,.26); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #2dd9f1, #13b6d3); border-color: transparent; color: #031318; box-shadow: 0 8px 24px -10px rgba(34,211,238,.7); }
.btn-primary:hover { background: linear-gradient(180deg, #4ae0f5, #1cc3df); color: #031318; border-color: transparent; }
.btn-success { background: linear-gradient(180deg, #2fd16b, #16a34a); border-color: transparent; color: #03140a; }
.btn-success:hover { background: linear-gradient(180deg, #4ade80, #1fb456); color: #03140a; border-color: transparent; }
.btn-danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.35); color: var(--neg-2); }
.btn-danger:hover { background: rgba(244,63,94,.2); color: #fecdd3; border-color: rgba(244,63,94,.5); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(148,163,184,.08); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; } .btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14px; border-radius: 12px; }
.icon-btn { position: relative; }
.badge-count {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; border-radius: 999px; padding: 0 4px;
  background: var(--neg); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
.inline-form { display: inline; }

/* ---------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label-text { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #0a0d12;
  color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8899' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(148,163,184,.28); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: rgba(34,211,238,.6); box-shadow: 0 0 0 3px rgba(34,211,238,.15); background: #0b0f15; }
.input.num { font-family: var(--mono); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .addon { position: absolute; left: 12px; color: var(--muted); font-size: 13px; pointer-events: none; font-family: var(--mono); }
.input-group .addon-r { position: absolute; right: 12px; color: var(--muted); font-size: 13px; pointer-events: none; font-family: var(--mono); }
.input-group .input { padding-left: 38px; }
.input-group.r .input { padding-left: 12px; padding-right: 34px; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: rgba(244,63,94,.7); }
.field-error { font-size: 12px; color: var(--neg-2); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2); user-select: none; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.switch input { appearance: none; width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .2s; cursor: pointer; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #94a3b8; transition: transform .2s var(--ease), background .2s; }
.switch input:checked { background: rgba(34,211,238,.25); border-color: rgba(34,211,238,.5); }
.switch input:checked::after { transform: translateX(17px); background: var(--accent); }

/* Segmented (WIN/LOSS, CALL/PUT, período) */
.segmented { display: inline-flex; padding: 3px; background: #0a0d12; border: 1px solid var(--line-2); border-radius: 11px; gap: 3px; flex-wrap: wrap; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label, .segmented a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 13px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 12.5px; color: var(--muted); transition: background .15s, color .15s; white-space: nowrap;
}
.segmented label:hover, .segmented a:hover { color: var(--text); }
.segmented input:checked + label, .segmented a.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 4px 10px -4px rgba(0,0,0,.6); }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); }
.segmented.big { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.segmented.big label { min-height: 46px; font-size: 14px; }
.segmented input.win:checked + label { background: var(--pos-soft); color: var(--pos-2); box-shadow: 0 0 0 1px rgba(34,197,94,.45) inset; }
.segmented input.loss:checked + label { background: var(--neg-soft); color: var(--neg-2); box-shadow: 0 0 0 1px rgba(244,63,94,.45) inset; }
.segmented input.call:checked + label { background: var(--pos-soft); color: var(--pos-2); box-shadow: 0 0 0 1px rgba(34,197,94,.45) inset; }
.segmented input.put:checked + label { background: var(--neg-soft); color: var(--neg-2); box-shadow: 0 0 0 1px rgba(244,63,94,.45) inset; }

/* ---------------------------------------------------------------- Badges / pills */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .03em; background: rgba(148,163,184,.1); color: var(--text-2); white-space: nowrap; font-family: var(--mono);
}
.badge.win, .badge.pos, .badge.active { background: var(--pos-soft); color: var(--pos-2); }
.badge.loss, .badge.neg, .badge.blocked { background: var(--neg-soft); color: var(--neg-2); }
.badge.draw, .badge.inactive { background: rgba(148,163,184,.1); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: #fbbf24; }
.badge.accent, .badge.call { background: var(--accent-soft); color: var(--accent); }
.badge.put { background: rgba(167,139,250,.12); color: #c4b5fd; }
.badge .icon { width: 12px; height: 12px; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); background: rgba(148,163,184,.04); }

/* ---------------------------------------------------------------- Progress */
.progress { height: 8px; background: rgba(148,163,184,.1); border-radius: 999px; overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0ea5b7, var(--accent)); transition: width .6s var(--ease); width: var(--w, 0%); }
.progress.pos > span { background: linear-gradient(90deg, #15803d, var(--pos)); }
.progress.neg > span { background: linear-gradient(90deg, #be123c, var(--neg)); }
.progress.warn > span { background: linear-gradient(90deg, #b45309, var(--warn)); }
.progress.lg { height: 12px; }
.progress .tick { position: absolute; top: -2px; bottom: -2px; width: 2px; background: rgba(255,255,255,.35); }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Alerts / toasts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert.info { border-color: rgba(96,165,250,.3); background: rgba(96,165,250,.07); } .alert.info .icon { color: var(--info); }
.alert.success { border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.07); } .alert.success .icon { color: var(--pos); }
.alert.warning { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.08); } .alert.warning .icon { color: var(--warn); }
.alert.danger, .alert.error { border-color: rgba(244,63,94,.35); background: rgba(244,63,94,.08); } .alert.danger .icon, .alert.error .icon { color: var(--neg); }
.alert strong { color: var(--text); }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--muted); padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--line-2); background: rgba(148,163,184,.03); }
.disclaimer .icon { color: var(--warn); width: 16px; height: 16px; margin-top: 1px; }

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: 12px; background: #121821; border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); animation: toast-in .35s var(--ease); font-size: 13.5px; }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--pos); } .toast.error .icon { color: var(--neg); } .toast.warning .icon { color: var(--warn); } .toast.info .icon { color: var(--info); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.toast.out { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: rgba(148,163,184,.025);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(148,163,184,.035); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions form + .btn, .table .actions .btn + form, .table .actions form + form { margin-left: 4px; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; background: rgba(148,163,184,.03); }
.table.compact td, .table.compact th { padding: 8px 12px; }
.table-title { font-weight: 600; }
.table-sub { font-size: 11.5px; color: var(--muted); }
.row-link { cursor: pointer; }

/* ---------------------------------------------------------------- Filters bar */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 130px; }
.filters .field.wide { min-width: 200px; flex: 1; }
.filters .input, .filters .select { height: 36px; font-size: 13px; }
.period-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.period-custom { display: none; gap: 8px; align-items: center; }
.period-custom.show { display: flex; }
.period-custom .input { height: 34px; width: 150px; }

/* ---------------------------------------------------------------- Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 4px; }
.pagination a, .pagination span.cur { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; }
.pagination a:hover { background: rgba(148,163,184,.08); color: var(--text); }
.pagination span.cur { background: var(--accent-soft); color: var(--accent); border-color: rgba(34,211,238,.3); }

/* ---------------------------------------------------------------- Empty / skeleton */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty .empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { color: var(--text); font-size: 15px; }
.skeleton { position: relative; overflow: hidden; background: rgba(148,163,184,.06); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------------------------------------------------------------- Charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 210px; } .chart-box.lg { height: 340px; } .chart-box.xs { height: 160px; }
.chart-box canvas { position: absolute; inset: 0; }
.chart-box .chart-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }

/* ---------------------------------------------------------------- Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .meta { font-size: 12px; color: var(--muted); }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line span:first-child { color: var(--muted); }
.stat-line span:last-child { font-family: var(--mono); font-weight: 600; text-align: right; }
.op-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.op-icon.win { background: var(--pos-soft); color: var(--pos); } .op-icon.loss { background: var(--neg-soft); color: var(--neg); } .op-icon.draw { background: rgba(148,163,184,.1); color: var(--muted); }
.insight { padding: 15px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.insight .label { margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.insight .value { font-weight: 650; font-size: 15px; }
.insight .sub { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }

/* ---------------------------------------------------------------- Risk gauge */
.risk-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 5px 10px; border-radius: 8px; }
.risk-state.neutral { background: rgba(148,163,184,.08); color: var(--text-2); }
.risk-state.stop_gain { background: var(--pos-soft); color: var(--pos-2); }
.risk-state.near_stop_loss { background: var(--warn-soft); color: #fbbf24; }
.risk-state.stop_loss { background: var(--neg-soft); color: var(--neg-2); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(244,63,94,0); } 0% { box-shadow: 0 0 0 0 rgba(244,63,94,.35); } }
.risk-low { color: var(--pos); } .risk-medium { color: #fbbf24; } .risk-high { color: #fb923c; } .risk-critical { color: var(--neg); }
.level-bar { display: grid; gap: 4px; }
tr.lvl-high td, tr.lvl-critical td { background: rgba(244,63,94,.04); }

/* MG ladder */
.ladder { display: grid; gap: 10px; }
.ladder-step { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.ladder-step .lvl { font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--muted); }
.ladder-step .amt { font-family: var(--mono); font-weight: 600; font-size: 17px; }

/* ---------------------------------------------------------------- Dropdown / popover */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #111720; border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; display: none; animation: pop .16s var(--ease);
}
.dropdown.open .dropdown-menu { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: rgba(148,163,184,.08); color: var(--text); }
.dropdown-menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.notif-panel { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-panel .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.notif .ico.success { background: var(--pos-soft); color: var(--pos); } .notif .ico.warning { background: var(--warn-soft); color: var(--warn); }
.notif .ico.danger { background: var(--neg-soft); color: var(--neg); } .notif .ico.info { background: rgba(96,165,250,.12); color: var(--info); }
.notif .t { font-weight: 600; font-size: 13px; } .notif .m { font-size: 12.5px; color: var(--muted); } .notif .w { font-size: 11px; color: var(--faint); margin-top: 2px; }
.notif.unread { background: rgba(34,211,238,.035); }
.notif.unread .t::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }

/* ---------------------------------------------------------------- Modal (dialog) */
dialog.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog.modal::backdrop { background: rgba(2, 4, 8, .72); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: modal-in .22s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-card { background: #10151d; border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-pop); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.confirm-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--neg-soft); color: var(--neg); margin-bottom: 14px; }

/* ---------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 12px 12px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--accent); }

/* ---------------------------------------------------------------- Auth / focus layouts */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(800px 500px at 20% 10%, rgba(34,211,238,.14), transparent 60%), linear-gradient(160deg, #0b1117, #06080b);
  border-right: 1px solid var(--line);
}
.auth-side .chart-art { position: absolute; inset: auto -10% -6% -10%; height: 55%; opacity: .9; }
.auth-side h2 { font-size: 34px; line-height: 1.1; letter-spacing: -.03em; max-width: 520px; font-weight: 700; }
.auth-side h2 em { font-style: normal; color: var(--accent); }
.auth-side p { color: var(--text-2); max-width: 460px; margin-top: 14px; font-size: 15px; }
.auth-stats { display: flex; gap: 28px; position: relative; z-index: 1; }
.auth-stats div span { display: block; font-family: var(--mono); font-size: 20px; font-weight: 600; }
.auth-stats div small { color: var(--muted); font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; }
.focus-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.steps { display: flex; gap: 8px; margin: 22px 0 26px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: rgba(148,163,184,.12); transition: background .3s; }
.steps span.done { background: var(--accent); box-shadow: 0 0 10px rgba(34,211,238,.5); }
.step { display: none; } .step.active { display: block; animation: modal-in .3s var(--ease); }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.choice label { padding: 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; display: flex; gap: 12px; align-items: center; font-weight: 600; }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; }
.choice label:has(input:checked) { border-color: rgba(34,211,238,.55); background: var(--accent-soft); }

/* ---------------------------------------------------------------- Mobile nav */
.bottom-nav, .mobile-sheet, .sheet-backdrop, .fab { display: none; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-strip > :nth-child(4) { border-left: 0; }
  .kpi-strip > :nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; } .auth-side { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar: 58px; }
  .sidebar { transform: translateX(-100%); transition: transform .28s var(--ease); width: 280px; box-shadow: var(--shadow-pop); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sheet-backdrop { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar .crumb, .topbar .hide-sm { display: none; }
  .content { padding: 18px 14px 110px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(9, 12, 16, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line-2);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted);
    padding: 6px 0; background: none; border: 0; font-family: inherit; cursor: pointer; border-radius: 10px;
  }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav .icon { width: 21px; height: 21px; }
  .bottom-nav .plus { width: 48px; height: 48px; margin-top: -22px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(180deg, #2dd9f1, #13b6d3); color: #031318; box-shadow: 0 10px 24px -6px rgba(34,211,238,.7), 0 0 0 5px var(--bg); }
  .bottom-nav .plus .icon { width: 24px; height: 24px; }
  .sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 39; }

  .g-2, .g-3, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .g-4, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip > * { border-left: 0 !important; border-top: 1px solid var(--line); }
  .kpi-strip > :nth-child(-n+2) { border-top: 0; }
  .kpi-strip > :nth-child(even) { border-left: 1px solid var(--line) !important; }
  .span-2, .span-3 { grid-column: auto; }
  .kpi-value { font-size: 19px; } .kpi-value.lg { font-size: 26px; }
  .kpi { padding: 14px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .chart-box { height: 230px; } .chart-box.lg { height: 260px; }
  .filters { padding: 12px; } .filters .field { min-width: calc(50% - 5px); flex: 1; }
  .toasts { left: 12px; right: 12px; bottom: 84px; max-width: none; }
  .choice { grid-template-columns: 1fr; }

  /* Tabelas viram cartões no mobile */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .table.responsive td { padding: 0; border: 0; text-align: left !important; }
  .table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; margin-bottom: 1px; }
  .table.responsive td.primary { grid-column: 1 / -1; }
  .table.responsive td.actions { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; }
  .table.responsive td.hide-sm { display: none; }
  .table.responsive tfoot tr { display: grid; }
  .ladder-step { grid-template-columns: 54px 1fr; }
  .ladder-step > :last-child { grid-column: 1 / -1; }
  .hide-sm { display: none !important; }
}
@media (min-width: 901px) { .show-sm { display: none !important; } }
@media (max-width: 420px) {
  .g-4, .g-6 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi-value { font-size: 17px; }
  .segmented label, .segmented a { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Impressão */
@media print {
  .sidebar, .topbar, .bottom-nav, .toasts, .page-actions, .filters, .no-print { display: none !important; }
  .main { margin: 0; } body { background: #fff; color: #000; } .card { box-shadow: none; border-color: #ddd; background: #fff; }
}

/* Estados auxiliares */
.table tr.is-selected td { background: rgba(34,211,238,.06); }
[data-sim-root].is-busy [data-out-rows] { opacity: .55; transition: opacity .2s; }
.table td a { color: var(--text); font-weight: 600; }
.table td a:hover { color: var(--accent); }
.list-item:is(a):hover { background: rgba(148,163,184,.04); }
.crumb-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumb-line strong { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumb-line .sep { color: var(--faint); }

[hidden] { display: none !important; }
@media (max-width: 900px) { .g-4 > .kpi.hero { grid-column: 1 / -1; } }
.filters-toggle { margin: 12px 12px 0; width: calc(100% - 24px); }
@media (max-width: 900px) { .filters[data-collapsible]:not(.open) { display: none; } .filters-toggle + .filters { border-top: 0; } }
