/* Aldrop Bilhetagem — linguagem visual do mundo da impressão:
   papel frio + tinta azul-marinho na estrutura; ciano de processo para ações;
   C, M, Y, K reservados para dados (páginas cor × P&B, toners, alertas). */
:root {
  --paper: #f4f6f9;
  --sheet: #ffffff;
  --sheet-2: #f8fafc;
  --rule: #e3e8ef;
  --rule-strong: #cfd7e2;
  --ink: #13203a;
  --ink-2: #1c2c4c;
  --text: #17202f;
  --muted: #5d6b80;
  --faint: #8a96a8;
  --cyan: #0091c7;
  --cyan-strong: #007aa8;
  --cyan-soft: #e3f3fa;
  --on-cyan: #ffffff;
  --magenta: #c8246f;
  --magenta-soft: #fbe8f1;
  --yellow: #e5b300;
  --yellow-soft: #fff6d6;
  --key: #232833;
  --ok: #1b7f45;
  --ok-soft: #e4f4ea;
  --danger: #c22f23;
  --danger-soft: #fdeceb;
  --warn: #8a6500;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-num: "IBM Plex Sans Condensed", "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-code: "IBM Plex Mono", Consolas, monospace;
  --r-card: 10px;
  --r-ctl: 6px;
  --shadow: 0 1px 2px rgba(19, 32, 58, .06), 0 1px 0 rgba(19, 32, 58, .02);
  --shadow-pop: 0 10px 30px rgba(19, 32, 58, .18);
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1522; --sheet: #161e2e; --sheet-2: #1b2436; --rule: #263248; --rule-strong: #33415b;
    --ink: #0b1120; --ink-2: #131c30; --text: #e6eaf1; --muted: #9aa6b8; --faint: #6f7c91;
    --cyan: #33b4e3; --cyan-strong: #5cc6ec; --cyan-soft: #12304a; --on-cyan: #071220; --magenta: #e9589a; --magenta-soft: #3a1a2b;
    --yellow: #f2c84b; --yellow-soft: #352b10; --key: #c9d1dd; --ok: #4cc27a; --ok-soft: #133022;
    --danger: #f07167; --danger-soft: #3a1817; --warn: #f2c84b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--cyan-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15.5px; margin: 0 0 14px; font-weight: 600; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-code); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.help { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
/* Textos longos sem espaço (JSON, tokens, URLs) quebram dentro do card em vez de vazar. */
.card { overflow-wrap: break-word; }
.card code, .card .mono { overflow-wrap: anywhere; }
.help code, td code, p code { font-family: var(--font-code); font-size: 12px; background: var(--sheet-2); border: 1px solid var(--rule); padding: 0 4px; border-radius: 4px; }

/* ---------- Estrutura: barra lateral cor de tinta ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #c6d0e0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 16px; padding: 4px 8px 22px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #8b99b3; margin-top: -2px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-ctl); color: #c6d0e0; font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-2); color: #fff; }
.nav a.active svg { opacity: 1; color: #33b4e3; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: #33b4e3; }
.nav-sep { height: 1px; background: #23324f; margin: 12px 4px; }
.side-foot { margin-top: auto; border-top: 1px solid #23324f; padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #23324f; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-foot .who b { display: block; color: #fff; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: #8b99b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.side-foot form { margin: 0; }
.icon-btn { background: none; border: 0; color: #8b99b3; padding: 6px; border-radius: var(--r-ctl); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: #fff; background: var(--ink-2); }
.icon-btn svg { width: 18px; height: 18px; }
.mobilebar, .scrim { display: none; }

.main { min-width: 0; }
main { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Superfícies ---------- */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-card); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }

/* Contadores: o elemento-assinatura. Números condensados, alinhados como um contador de páginas. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; margin-bottom: 20px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.kpi { padding: 16px 20px 18px; border-left: 1px solid var(--rule); position: relative; }
.kpi:first-child { border-left: 0; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-family: var(--font-num); font-size: 32px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 4px; }
.kpi.alert .value { color: var(--danger); }
.kpi[data-tone]::after { content: ""; position: absolute; left: 20px; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; }
.kpi[data-tone=key]::after { background: var(--key); }
.kpi[data-tone=cyan]::after { background: var(--cyan); }
.kpi[data-tone=magenta]::after { background: var(--magenta); }
.kpi[data-tone=yellow]::after { background: var(--yellow); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 12.5px; white-space: nowrap; border-bottom-color: var(--rule-strong); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: 2px; border: 4px solid transparent; border-top-color: var(--rule-strong); }
th.sort-asc::after { border-top-color: transparent; border-bottom-color: var(--cyan); vertical-align: 5px; }
th.sort-desc::after { border-top-color: var(--cyan); }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: var(--sheet-2); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--rule-strong); border-bottom: 0; }
td.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.sub { display: block; color: var(--muted); font-size: 12.5px; }
td strong, td .num strong { font-weight: 600; }
.num-strong { font-family: var(--font-num); font-weight: 600; font-size: 15px; }
th.group { background: var(--sheet-2); color: var(--text); font-weight: 600; font-size: 12.5px; }

/* ---------- Formulários ---------- */
form.stack { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { display: flex; align-items: flex-start; gap: 9px; color: var(--text); font-size: 14px; font-weight: 400; cursor: pointer; }
label.check input { margin-top: 3px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--r-ctl); padding: 8px 11px; width: 100%; transition: border-color .12s, box-shadow .12s; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--cyan); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
textarea { font-family: var(--font-code); font-size: 12.5px; min-height: 120px; resize: vertical; }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline label { min-width: 160px; }
.filters { padding: 14px 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 500; padding: 8px 15px; border-radius: var(--r-ctl); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--sheet-2); border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--on-cyan); }
.btn.primary:hover { background: var(--cyan-strong); border-color: var(--cyan-strong); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ---------- Selos e mensagens ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--sheet-2); color: var(--muted); border: 1px solid var(--rule); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--yellow-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.cyan { background: var(--cyan-soft); color: var(--cyan-strong); border-color: transparent; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--ok); border-radius: 8px; padding: 12px 14px; box-shadow: var(--shadow-pop); animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2); }
.toast.error { border-left-color: var(--danger); }
.toast p { margin: 0; flex: 1; }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.token-box { background: var(--yellow-soft); border: 1px solid color-mix(in srgb, var(--yellow) 60%, transparent); border-radius: var(--r-card); padding: 18px 20px; margin-bottom: 20px; }
.token-box code { display: block; font-family: var(--font-code); font-size: 13px; background: var(--sheet); border: 1px solid var(--rule); padding: 12px; border-radius: var(--r-ctl); margin: 10px 0; word-break: break-all; user-select: all; }
.token-box details { margin-top: 10px; }

/* Suprimentos em CMYK */
.supply { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(90px, 1.3fr) 48px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.supply:last-child { border-bottom: 0; }
.bar { height: 8px; background: var(--sheet-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--rule); min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--cyan); border-radius: 3px; transform-origin: left; animation: fill .7s cubic-bezier(.2, .8, .2, 1); }
.bar.k > i { background: var(--key); }
.bar.c > i { background: var(--cyan); }
.bar.m > i { background: var(--magenta); }
.bar.y > i { background: var(--yellow); }
.bar.low { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
@keyframes fill { from { transform: scaleX(0); } }
.supply .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.supply .pct.low { color: var(--danger); }

dl.props { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; word-break: break-word; }
details summary { cursor: pointer; color: var(--muted); font-weight: 500; }
details summary:hover { color: var(--text); }
.chart-box { position: relative; height: 280px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* Lista de métricas do equipamento */
.metric-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.metric-list div { background: var(--sheet-2); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; }
.metric-list span { display: block; color: var(--muted); font-size: 12.5px; }
.metric-list b { font-family: var(--font-num); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-group { font-size: 12.5px; color: var(--muted); margin: 16px 0 8px; font-weight: 500; }
.metric-group:first-of-type { margin-top: 4px; }

/* ---------- Relatório como extrato (imprime como documento) ---------- */
.statement { padding: 26px 28px; }
.statement-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 2px solid var(--text); margin-bottom: 20px; }
.statement-title { font-size: 22px; margin: 2px 0 4px; }
.statement-total { text-align: right; }
.statement-total .value { font-family: var(--font-num); font-size: 44px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.statement-kpis { box-shadow: none; border-radius: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.statement-kpis .kpi { padding: 12px 16px 14px; }
.statement-kpis .kpi .value { font-size: 24px; }
.statement h3 { margin-top: 26px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.login-art { background: var(--ink); color: #c6d0e0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { padding: 0; }
.login-art h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 600; max-width: 15ch; margin: 0 0 14px; letter-spacing: -.015em; }
.login-art p { max-width: 42ch; margin: 0; color: #9fb0ca; }
.odometer { display: flex; gap: 6px; margin: 34px 0 8px; }
.odometer span { font-family: var(--font-num); font-size: 44px; font-weight: 600; color: #fff; background: var(--ink-2); border: 1px solid #23324f; border-radius: 8px; width: 46px; text-align: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.odometer-label { font-size: 13px; color: #8b99b3; }
.cmyk { display: flex; height: 6px; border-radius: 3px; overflow: hidden; max-width: 240px; }
.cmyk i { flex: 1; } .cmyk i:nth-child(1) { background: #33b4e3; } .cmyk i:nth-child(2) { background: #e9589a; } .cmyk i:nth-child(3) { background: #f2c84b; } .cmyk i:nth-child(4) { background: #e6eaf1; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form .card { width: 100%; max-width: 380px; padding: 28px; }
.login-form h1 { margin-bottom: 4px; }

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 84vw); z-index: 40; transform: translateX(-100%); transition: transform .22s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .scrim { display: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 16, 30, .45); z-index: 30; }
  .mobilebar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--ink); position: sticky; top: 0; z-index: 20; }
  .mobilebar .brand { padding: 0; font-size: 15px; }
  .mobilebar .icon-btn { color: #fff; }
  main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--rule); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--rule); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px 20px; }
  .login-art .odometer, .login-art .odometer-label { display: none; }
}
@media (max-width: 560px) { dl.props { grid-template-columns: 1fr; } h1 { font-size: 21px; } .kpi .value { font-size: 26px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media print {
  .sidebar, .mobilebar, .no-print, form.filters, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card, .kpis { border: 0; box-shadow: none; padding: 0; }
}
.col-dev { min-width: 200px; }

/* Seletor de período (segmentos) */
.seg { display: inline-flex; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.seg a:hover { color: var(--text); background: var(--sheet-2); text-decoration: none; }
.seg a.on { background: var(--cyan); color: var(--on-cyan); }
.production { margin-bottom: 4px; }
.share { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.share .bar { width: 70px; min-width: 70px; height: 6px; }
