/* ============================================================
   Sistema KR TECH — Design System
   Identidade: azul #0D44A1 · laranja #F7941D (energia)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* marca */
  --blue:        #0D44A1;
  --blue-600:    #0A3A8A;
  --blue-700:    #082E6E;
  --blue-500:    #1657C0;
  --blue-400:    #3B7BE0;
  --blue-wash:   #E7EEFA;
  --navy:        #071E45;   /* sidebar */
  --navy-2:      #0B2857;

  --orange:      #F7941D;
  --orange-bright:#FFA12D;
  --orange-600:  #E07C0A;
  --orange-wash: #FEF1DD;

  /* neutros (viés azul frio) */
  --bg:        #f3f6fb;
  --surface:   #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef3fa;
  --ink:       #14213d;
  --ink-2:     #45516b;
  --muted:     #7a869c;
  --line:      #e4eaf3;
  --line-2:    #eef2f9;

  /* semânticos (separados da marca) */
  --success: #17915b; --success-wash: #e2f4ec;
  --warning: #d79218; --warning-wash: #fbf0d8;
  --danger:  #d64550; --danger-wash:  #fbe3e5;
  --info:    #2472c8; --info-wash:    #e5f0fb;

  --grad-brand: linear-gradient(135deg, var(--orange-bright) 0%, var(--orange) 32%, var(--blue) 78%);
  --grad-blue:  linear-gradient(135deg, var(--blue-500), var(--blue-700));

  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16,30,60,.05), 0 1px 3px rgba(16,30,60,.04);
  --shadow:    0 2px 6px rgba(16,30,60,.06), 0 12px 28px rgba(16,30,60,.07);
  --shadow-lg: 0 18px 50px rgba(16,30,60,.14);

  --font-body: "Inter", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-head: "Nunito", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 256px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark;
  --bg: #0a1120; --surface: #111c31; --surface-2: #0e1728; --surface-3: #16233c;
  --ink: #e9eff8; --ink-2: #aeb9cc; --muted: #7688a1; --line: #22304a; --line-2: #1a2740;
  --blue: #3B7BE0; --blue-500: #4f8bec; --blue-wash: #142a4d; --blue-400:#6aa0f2;
  --orange: #FBA83C; --orange-wash: #33280f;
  --success-wash:#0f2a1e; --warning-wash:#2e2610; --danger-wash:#2f1518; --info-wash:#122844;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 8px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.4);
  --shadow-lg: 0 22px 60px rgba(0,0,0,.55);
} }
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0a1120; --surface: #111c31; --surface-2: #0e1728; --surface-3: #16233c;
  --ink: #e9eff8; --ink-2: #aeb9cc; --muted: #7688a1; --line: #22304a; --line-2: #1a2740;
  --blue: #3B7BE0; --blue-500: #4f8bec; --blue-wash: #142a4d; --blue-400:#6aa0f2;
  --orange: #FBA83C; --orange-wash: #33280f;
  --success-wash:#0f2a1e; --warning-wash:#2e2610; --danger-wash:#2f1518; --info-wash:#122844;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 8px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.4);
  --shadow-lg: 0 22px 60px rgba(0,0,0,.55);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1,h2,h3,h4,h5 { font-family: var(--font-head); margin: 0; letter-spacing: -.01em; color: var(--ink); }
button { font-family: inherit; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; border-radius: 4px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Logo mark ---------- */
.logo { display: inline-flex; align-items: center; gap: 11px; }
.logo .mark { width: 38px; height: 38px; flex: none; }
.logo .wm { display: flex; flex-direction: column; line-height: 1; }
.logo .wm b { font-family: var(--font-head); font-weight: 900; font-size: 19px; letter-spacing: -.02em; }
.logo .wm span { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); font-weight: 700; margin-top: 2px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, background .15s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px var(--blue); }
.btn-primary:hover { background: var(--blue-600); }
.btn-accent { background: var(--orange); color: #3a2000; box-shadow: 0 6px 16px -6px var(--orange); }
.btn-accent:hover { background: var(--orange-600); color:#fff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--blue-400); color: var(--blue); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-success { background: var(--success-wash); color: var(--success); }
.chip-warning { background: var(--warning-wash); color: var(--warning); }
.chip-danger  { background: var(--danger-wash);  color: var(--danger); }
.chip-info    { background: var(--info-wash);     color: var(--info); }
.chip-neutral { background: var(--surface-3);     color: var(--ink-2); }
.chip-brand   { background: var(--blue-wash);     color: var(--blue); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 15px; font-weight: 800; }
.card-head .sub { font-size: 12px; color: var(--muted); font-family: var(--font-body); }

/* ---------- Layout app ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
body.collapsed { --sidebar-w: 76px; }

/* Sidebar */
.sidebar {
  background: var(--navy); color: #cdd8ee; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden;
  background-image: radial-gradient(600px 300px at -10% -5%, rgba(247,148,29,.14), transparent 60%),
                    radial-gradient(600px 400px at 110% 105%, rgba(22,87,192,.34), transparent 55%);
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 16px; }
.sidebar .brand .chipmark { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.sidebar .brand .chipmark svg { width: 28px; height: 28px; }
.sidebar .brand .wm b { color: #fff; font-family: var(--font-head); font-weight: 900; font-size: 18px; letter-spacing: -.02em; display:block; line-height:1; }
.sidebar .brand .wm span { color: var(--orange-bright); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
body.collapsed .sidebar .brand .wm { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #6d7ea8; padding: 14px 12px 6px; font-weight: 700; }
body.collapsed .nav .sec { text-align: center; font-size: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #c2cee6; font-weight: 600; font-size: 13.5px; cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.10); color: #fff; }
.nav a.active::before { content:""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.nav a .lbl { flex: 1; }
.nav a .count { font-size: 11px; background: rgba(255,255,255,.14); color:#fff; border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
body.collapsed .nav a .lbl, body.collapsed .nav a .count { display: none; }
body.collapsed .nav a { justify-content: center; padding: 11px; }

.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.side-user:hover { background: rgba(255,255,255,.07); }
.side-user .avatar { width: 34px; height: 34px; flex:none; }
.side-user .u b { color:#fff; font-size: 13px; display:block; font-weight:700; }
.side-user .u span { color:#8ea0c2; font-size: 11px; }
body.collapsed .side-user .u { display:none; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .search {
  display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 13px; flex: 1; max-width: 440px;
  background: var(--surface-3); border: 1px solid transparent; border-radius: 11px; color: var(--muted);
}
.topbar .search:focus-within { border-color: var(--blue-400); background: var(--surface); }
.topbar .search input { border: none; background: transparent; outline: none; flex: 1; color: var(--ink); font-size: 13.5px; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { color: var(--blue); border-color: var(--blue-400); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .ping { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; background: var(--orange); border-radius: 50%; border: 2px solid var(--surface); }

.content { padding: 24px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head .crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.page-head .actions { display: flex; gap: 10px; }

/* avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: var(--grad-blue); font-family: var(--font-head); }
.avatar.o { background: linear-gradient(135deg, var(--orange-bright), var(--orange-600)); }

/* grids */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.col-2 { grid-column: span 2; }

/* KPI */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi .ic.blue { background: var(--blue-wash); color: var(--blue); }
.kpi .ic.orange { background: var(--orange-wash); color: var(--orange-600); }
.kpi .ic.green { background: var(--success-wash); color: var(--success); }
.kpi .ic.red { background: var(--danger-wash); color: var(--danger); }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 14px; }
.kpi .val { font-family: var(--font-head); font-weight: 900; font-size: 27px; letter-spacing: -.02em; margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }

/* chart (barras CSS) */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .b .bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: var(--grad-blue); position: relative; transition: filter .15s; }
.bars .b:hover .bar { filter: brightness(1.08); }
.bars .b:last-child .bar { background: linear-gradient(180deg, var(--orange-bright), var(--orange)); }
.bars .b .cap { font-size: 11px; color: var(--muted); font-weight: 600; }

/* donut */
.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content:""; position: absolute; inset: 22px; background: var(--surface); border-radius: 50%; }
.donut .mid { position: relative; z-index: 1; text-align: center; }
.donut .mid b { font-family: var(--font-head); font-size: 24px; font-weight: 900; display: block; }
.donut .mid span { font-size: 11px; color: var(--muted); }

.legend { display: flex; flex-direction: column; gap: 10px; }
.legend .li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend .li i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* lista de alertas / atividade */
.feed { display: flex; flex-direction: column; }
.feed .it { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.feed .it:last-child { border-bottom: none; }
.feed .it .fic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.feed .it .fic svg { width: 17px; height: 17px; }
.feed .it .tx { flex: 1; min-width: 0; }
.feed .it .tx b { font-size: 13.5px; font-weight: 700; }
.feed .it .tx p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.feed .it .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* tabela */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl thead th { text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .who { display: flex; align-items: center; gap: 11px; }
.tbl .who b { font-weight: 700; display: block; }
.tbl .who span { font-size: 12px; color: var(--muted); }
.cellmoney { font-variant-numeric: tabular-nums; font-weight: 700; }

/* filtros */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.field { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.field input, .field select { border: none; background: transparent; outline: none; color: var(--ink); font-size: 13.5px; font-family: inherit; }
.field svg { width: 16px; height: 16px; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: transparent; padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.segmented button.on { background: var(--surface); color: var(--blue); box-shadow: var(--shadow-sm); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 288px; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kcol .kh { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--line-2); }
.kcol .kh .kd { width: 9px; height: 9px; border-radius: 50%; }
.kcol .kh b { font-size: 13px; font-weight: 800; }
.kcol .kh .n { margin-left: auto; font-size: 11.5px; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.kcol .kbody { padding: 11px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; box-shadow: var(--shadow-sm); cursor: grab; }
.kcard:hover { border-color: var(--blue-400); box-shadow: var(--shadow); }
.kcard .kt { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kcard .kt b { font-size: 13.5px; font-weight: 700; }
.kcard .val { font-family: var(--font-head); font-weight: 900; color: var(--blue); font-size: 15px; margin-top: 8px; }
.kcard .meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.kcard .meta .avatar { width: 24px; height: 24px; font-size: 10px; }

/* Simulador */
.sim-wrap { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.field-lg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field-lg label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field-lg .inp { display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.field-lg .inp:focus-within { border-color: var(--blue-400); background: var(--surface); }
.field-lg .inp input, .field-lg .inp select { border: none; background: transparent; outline: none; flex: 1; font-size: 15px; color: var(--ink); font-family: inherit; }
.field-lg .inp .pre { color: var(--muted); font-weight: 700; font-size: 14px; }
.sim-hero { background: var(--grad-blue); color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.sim-hero::after { content:""; position:absolute; right:-40px; top:-40px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(247,148,29,.4), transparent 65%); }
.sim-hero .lb { font-size: 12.5px; opacity: .85; font-weight: 600; }
.sim-hero .big { font-family: var(--font-head); font-size: 40px; font-weight: 900; letter-spacing: -.02em; line-height: 1; margin: 6px 0; }
.sim-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 16px; }
.sim-metrics .m { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.sim-metrics .m .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.sim-metrics .m .v { font-family: var(--font-head); font-weight: 900; font-size: 22px; margin-top: 4px; }
.sim-metrics .m .v small { font-size: 13px; color: var(--muted); font-weight: 600; }

/* meter */
.meter { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--grad-blue); }

/* placeholder */
.placeholder { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.placeholder .box { max-width: 420px; }
.placeholder .em { width: 76px; height: 76px; border-radius: 22px; background: var(--blue-wash); color: var(--blue); display: grid; place-items: center; margin: 0 auto 18px; }
.placeholder .em svg { width: 38px; height: 38px; }
.placeholder h2 { font-size: 21px; font-weight: 800; }
.placeholder p { color: var(--muted); margin: 8px 0 18px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login .art {
  background: var(--navy); color: #fff; position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background-image: radial-gradient(700px 420px at 15% 10%, rgba(247,148,29,.24), transparent 55%),
                    radial-gradient(760px 520px at 100% 100%, rgba(22,87,192,.5), transparent 55%);
}
.login .art .brand-lg { display: flex; align-items: center; gap: 12px; }
.login .art .brand-lg .chipmark { width: 52px; height: 52px; border-radius: 14px; background:#fff; display:grid; place-items:center; box-shadow: 0 8px 22px rgba(0,0,0,.3); }
.login .art .brand-lg .chipmark svg { width: 38px; height: 38px; }
.login .art .brand-lg b { font-family: var(--font-head); font-weight: 900; font-size: 22px; }
.login .art .brand-lg span { display:block; font-size: 10px; letter-spacing:.14em; text-transform:uppercase; color: var(--orange-bright); font-weight:800; }
.login .art .pitch h2 { font-family: var(--font-head); font-size: 34px; font-weight: 900; line-height: 1.1; max-width: 14ch; }
.login .art .pitch p { color: #b9c6e0; font-size: 15px; max-width: 42ch; margin-top: 12px; }
.login .art .stats { display: flex; gap: 30px; }
.login .art .stats .s b { font-family: var(--font-head); font-size: 26px; font-weight: 900; display:block; }
.login .art .stats .s span { font-size: 12px; color: #9fb0d0; }
.login .form-side { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login .form { width: 100%; max-width: 360px; }
.login .form h1 { font-size: 26px; font-weight: 800; }
.login .form .lead { color: var(--muted); margin: 6px 0 26px; }
.login .form .field-lg .inp { height: 48px; }
.login .form .row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 20px; font-size: 13px; }
.login .form .row label { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.login .foot-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

.hidden { display: none !important; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2,1fr); } .sim-wrap { grid-template-columns: 1fr; } }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(7,20,45,.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .login { grid-template-columns: 1fr; } .login .art { display: none; }
}
@media (max-width: 720px) {
  .g-3, .g-2, .g-4 { grid-template-columns: 1fr; } .col-2 { grid-column: auto; }
  .content { padding: 16px; }
}
@media (min-width: 921px) { .menu-btn { display: none; } .scrim { display: none; } }

/* ============================================================
   Telas adicionais (Propostas · Financeiro · Processos)
   ============================================================ */

/* Propostas — lista + preview */
.split-2 { display: grid; grid-template-columns: 336px 1fr; gap: 16px; align-items: start; }
.prop-list { display: flex; flex-direction: column; gap: 10px; }
.prop-it { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.prop-it:hover { border-color: var(--blue-400); }
.prop-it.sel { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-wash); }
.prop-it .pt { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prop-it .pt b { font-weight: 700; font-size: 13.5px; }
.prop-it .pv { font-family: var(--font-head); font-weight: 900; color: var(--blue); font-size: 16px; margin-top: 6px; }
.prop-it .pm { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.doc-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.doc-top { background: var(--grad-blue); color: #fff; padding: 22px 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; position: relative; overflow: hidden; }
.doc-top::after { content: ""; position: absolute; right: -30px; top: -40px; width: 180px; height: 180px; background: radial-gradient(circle, rgba(247,148,29,.42), transparent 65%); }
.doc-top .dl { font-size: 12px; opacity: .85; font-weight: 600; }
.doc-top h2 { font-size: 20px; font-weight: 800; margin: 2px 0; color: #fff; }
.doc-top .dnum { font-size: 12px; opacity: .82; }
.doc-top .chipmark { position: relative; z-index: 1; }
.doc-body { padding: 20px 24px; }
.doc-parties { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-parties .lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.doc-parties b { font-size: 14px; }
.doc-parties .sub { font-size: 12.5px; color: var(--muted); }
.doc-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.doc-row b { font-variant-numeric: tabular-nums; }
.doc-total { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 15px 18px; background: var(--blue-wash); border-radius: 12px; }
.doc-total .tl { color: var(--ink-2); font-weight: 600; font-size: 12.5px; max-width: 60%; }
.doc-total .tv { font-family: var(--font-head); font-weight: 900; font-size: 24px; color: var(--blue); }
.doc-actions { display: flex; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }

/* Cashflow (barras agrupadas) */
.cf { display: flex; align-items: flex-end; gap: 16px; height: 180px; padding-top: 10px; }
.cf .cg { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.cf .cbars { display: flex; align-items: flex-end; gap: 5px; height: 100%; }
.cf .cbars i { width: 15px; border-radius: 5px 5px 2px 2px; display: block; }
.cf .cbars .in { background: linear-gradient(180deg, #35c489, var(--success)); }
.cf .cbars .out { background: linear-gradient(180deg, #f08b93, var(--danger)); }
.cf .cap { font-size: 11px; color: var(--muted); font-weight: 600; }

/* Régua WhatsApp */
.wa { display: flex; flex-direction: column; gap: 13px; }
.wa .msg { display: flex; gap: 10px; align-items: flex-start; }
.wa .wi { width: 30px; height: 30px; border-radius: 9px; background: var(--success-wash); color: var(--success); display: grid; place-items: center; flex: none; }
.wa .wi svg { width: 16px; height: 16px; }
.wa .bub { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px 13px 13px 13px; padding: 9px 12px; font-size: 12.5px; flex: 1; }
.wa .bub .t { color: var(--muted); font-size: 11px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* Processos — barra de status */
.statrow { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.statrow .st { flex: 1; min-width: 130px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.statrow .st .n { font-family: var(--font-head); font-weight: 900; font-size: 22px; }
.statrow .st .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.kcard .krow { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.kcard .krow svg { width: 14px; height: 14px; color: var(--muted); }

/* Vendedores / Relatórios / Portal / Config */
.mini-meter { width: 130px; }
.switch { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); position: relative; cursor: pointer; flex: none; transition: .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: .15s; }
.switch.on { background: var(--success); border-color: var(--success); }
.switch.on::after { left: 20px; }

.intg { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.intg:last-child { border-bottom: none; }
.intg .il { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.intg .il svg { width: 22px; height: 22px; }
.intg .ib { flex: 1; }
.intg .ib b { font-size: 14px; font-weight: 700; display: block; }
.intg .ib span { font-size: 12.5px; color: var(--muted); }

.rank { display: flex; align-items: center; gap: 10px; }
.rank .pos { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-weight: 900; font-size: 12px; font-family: var(--font-head); background: var(--surface-3); color: var(--ink-2); }
.rank .pos.g { background: var(--orange-wash); color: var(--orange-600); }

.timeline { display: flex; flex-direction: column; }
.timeline .tp { display: flex; gap: 14px; }
.timeline .tp .dotcol { display: flex; flex-direction: column; align-items: center; }
.timeline .tp .d { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); border: 2px solid var(--line); }
.timeline .tp .d svg { width: 15px; height: 15px; }
.timeline .tp.done .d { background: var(--success); border-color: var(--success); color: #fff; }
.timeline .tp.now .d { background: var(--blue); border-color: var(--blue); color: #fff; }
.timeline .tp .line { flex: 1; width: 2px; background: var(--line); margin: 3px 0; }
.timeline .tp.done .line { background: var(--success); }
.timeline .tp .tc { padding-bottom: 22px; }
.timeline .tp .tc b { font-size: 14px; font-weight: 700; }
.timeline .tp .tc p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.timeline .tp:last-child .line { display: none; }

.portal-hero { background: var(--grad-blue); color: #fff; border-radius: var(--radius); padding: 22px 26px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; overflow: hidden; margin-bottom: 16px; }
.portal-hero::after { content: ""; position: absolute; right: -20px; bottom: -60px; width: 220px; height: 220px; background: radial-gradient(circle, rgba(247,148,29,.42), transparent 65%); }
.portal-hero .ph-b { font-family: var(--font-head); font-weight: 900; font-size: 30px; }
.portal-hero .rel { position: relative; z-index: 1; }

/* Ficha do cliente */
.kv .r { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.kv .r:last-child { border-bottom: none; }
.kv .r span { color: var(--muted); }
.kv .r b { font-weight: 600; text-align: right; }
.crumb a { color: var(--blue); font-weight: 600; cursor: pointer; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-strip { display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 16px; }
.profile-strip .avatar { width: 54px; height: 54px; font-size: 19px; }
.profile-strip .pi b { font-family: var(--font-head); font-weight: 800; font-size: 18px; display: block; }
.profile-strip .pi span { font-size: 13px; color: var(--muted); }
[data-screen="clientes"] .tbl tbody tr { cursor: pointer; }

/* ============================================================
   Refino responsivo (mobile / campo)
   ============================================================ */
@media (max-width: 860px) {
  /* grids de 2 colunas definidos inline passam a 1 coluna */
  .content [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .split-2 { grid-template-columns: 1fr !important; }
  .doc-total { flex-direction: column; align-items: flex-start; gap: 8px; }
  .doc-total .tl { max-width: 100%; }
  .page-head { align-items: flex-start; }
  .page-head .actions { flex-wrap: wrap; }
  .portal-hero { flex-direction: column; align-items: flex-start; }
  .portal-hero .rel:last-child { text-align: left; }
}
@media (max-width: 560px) {
  .topbar .search { display: none; }
  .topbar { gap: 8px; padding: 0 14px; }
  .content { padding: 14px; }
  .page-head h1 { font-size: 21px; }
  .kpi .val { font-size: 23px; }
  .btn-sm .lbl-hide { display: none; }
}

/* trava de overflow horizontal no mobile */
@media (max-width: 920px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .app, .main, .content { min-width: 0; max-width: 100%; }
  .content { overflow-x: hidden; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .topbar .btn .txt-hide { display: none; }
}

/* fix universal: itens de grid/flex podem encolher (tabelas roláveis não empurram a página) */
.grid > *, .split-2 > *, .sim-wrap > *, .card, .kpi, .doc-preview, .tablewrap, .main, .content { min-width: 0; }

/* ============================================================
   Microinterações — toasts & loading
   ============================================================ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 11px; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 12px;
  padding: 12px 15px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; color: var(--ink);
  min-width: 240px; max-width: 340px; transform: translateY(10px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { border-left-color: var(--success); }
.toast.info { border-left-color: var(--blue); }
.toast.warning { border-left-color: var(--warning); }
.toast .ti { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast.success .ti { background: var(--success-wash); color: var(--success); }
.toast.info .ti { background: var(--blue-wash); color: var(--blue); }
.toast.warning .ti { background: var(--warning-wash); color: var(--warning); }
.toast .ti svg { width: 15px; height: 15px; }

.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } .toast { transition: opacity .1s; } }
@media (max-width: 560px) { .toasts { left: 14px; right: 14px; align-items: stretch; } .toast { max-width: none; } }

/* ============================================================
   UX: busca global · notificações · recolher · estado vazio
   ============================================================ */
.topbar .search { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 380px; overflow-y: auto;
}
.search-results[hidden] { display: none; }
.sr-item { display: flex; flex-direction: column; gap: 1px; padding: 9px 11px; border-radius: 9px; cursor: pointer; }
.sr-item b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sr-item span { font-size: 11.5px; color: var(--muted); }
.sr-item.on, .sr-item:hover { background: var(--surface-3); }
.sr-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.notif-panel {
  position: fixed; top: 60px; right: 18px; width: 322px; max-width: calc(100vw - 28px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.np-head b { font-family: var(--font-head); font-weight: 800; font-size: 14px; }
.np-head span { font-size: 11px; color: var(--orange-600); background: var(--orange-wash); padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.notif-panel .feed { padding: 4px 16px 10px; max-height: 60vh; overflow-y: auto; }
.notif-panel .np-foot { padding: 10px 16px; border-top: 1px solid var(--line-2); text-align: center; }
.notif-panel .np-foot a { font-size: 12.5px; font-weight: 600; cursor: pointer; }

.collapse-btn { display: grid; }
@media (max-width: 920px) { .collapse-btn { display: none; } }

.empty { text-align: center !important; color: var(--muted); padding: 34px 16px !important; font-size: 13.5px; }

/* ============================================================
   Modais & logout
   ============================================================ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(7,20,45,.55); backdrop-filter: blur(2px); z-index: 200; display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(.99); transition: transform .18s; overflow: hidden; }
.modal-backdrop.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-x { width: 34px; height: 34px; border: none; background: transparent; color: var(--muted); }
.modal-x:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.mfield { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.mfield label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.mfield input, .mfield select { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 14px; font-family: inherit; outline: none; }
.mfield input:focus, .mfield select:focus { border-color: var(--blue-400); background: var(--surface); }
.mrow { display: flex; gap: 12px; }
@media (max-width: 560px) { .mrow { flex-direction: column; } }

.logout-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: #8ea0c2; display: grid; place-items: center; cursor: pointer; flex: none; }
.logout-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.logout-btn svg { width: 17px; height: 17px; }
body.collapsed .logout-btn { display: none; }
