/* Tema do painel: azul-marinho (ação) + limão (acento), superfícies claras. */
:root {
  --bg: #fdfdfd; --surface: #ffffff; --surface-muted: #f3f6f8;
  --fg: #15293a; --muted: #5f6f7c; --muted-2: #8a98a3;
  --border: #dfe6ec; --border-strong: #c4d0d9;
  --primary: #0d4468; --primary-hover: #0b3a59; --primary-soft: #e9f1f7; --primary-fg: #fff;
  --brand: #b6db41; --brand-ink: #4d6317; --brand-soft: #f0f7d9;
  --success: #3e8a2a; --success-soft: #e6f4e1;
  --warning: #c77a12; --warning-soft: #fdf0dc;
  --danger: #c63a3a; --danger-soft: #fbe6e6;
  --info: #1f6fb2; --info-soft: #e4effa;
  --radius-sm: 5px; --radius: 8px; --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(9,40,63,.05), 0 1px 3px rgba(9,40,63,.04);
  --shadow-sm: 0 2px 4px rgba(9,40,63,.05), 0 6px 16px -6px rgba(9,40,63,.08);
  --shadow-md: 0 6px 20px -8px rgba(9,40,63,.14), 0 2px 6px -2px rgba(9,40,63,.06);
  --shadow-lg: 0 16px 40px -14px rgba(9,40,63,.20), 0 4px 12px -6px rgba(9,40,63,.08);
  --sidebar-w: 248px;
  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; line-height: 1.25; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0; }
.boot { padding: 40px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ── login ──────────────────────────────────────────────────────────────── */
.login-bg { min-height: 100vh; display: grid; place-items: center; padding: 24px; background-color: #041a2b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Ccircle cx='2' cy='2' r='1.2' fill='rgba(255,255,255,0.07)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 620px 460px at 50% 52%, rgba(255,255,255,.055), transparent 65%),
    radial-gradient(ellipse 900px 620px at 16% 6%, rgba(182,219,65,.13), transparent 60%),
    linear-gradient(148deg, #0d3f63 0%, #072a43 48%, #041a2b 100%); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(22px, 5vw, 32px); box-shadow: 0 24px 64px rgba(2,12,20,.45), 0 4px 16px rgba(2,12,20,.30); }
.login-brand { display: flex; flex-direction: column; align-items: center; margin: 6px 0 4px; }
.login-card .produto { text-align: center; font-weight: 700; font-size: 19px; color: var(--primary); letter-spacing: -.01em; }
.login-card .tenant { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ── casca ──────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); box-shadow: 1px 0 0 #e3eaf0, 2px 0 16px rgba(9,40,63,.05); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 18px 16px 10px; border-bottom: 1px solid var(--border); }
.sidebar .brand .produto { line-height: 1.2; min-width: 0; }
.sidebar .brand .produto b { display: block; font-size: 14px; color: var(--primary); letter-spacing: -.01em; }
.sidebar .brand .produto span { font-size: 11.5px; color: var(--muted); }
.sidebar nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.sidebar .sec { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); padding: 14px 10px 6px; }
.sidebar a.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--fg); font-weight: 500; position: relative; }
.sidebar a.item:hover { background: var(--surface-muted); text-decoration: none; }
.sidebar a.item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar a.item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.sidebar a.item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.sidebar a.item.active svg { color: var(--primary); }
.sidebar a.item .pill { margin-left: auto; }
.sidebar .user { border-top: 1px solid var(--border); padding: 12px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.sidebar .user .who { min-width: 0; flex: 1; }
.sidebar .user .who b { display: block; font-size: 13px; }
.sidebar .user .who span { display: block; font-size: 11.5px; color: var(--muted); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.crumbs { font-size: 12.5px; color: var(--muted); } .crumbs b { color: var(--fg); font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 500; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.chip.ok .dot { background: var(--success); } .chip.err .dot { background: var(--danger); } .chip.warn .dot { background: var(--warning); }
.page { padding: 24px 28px 48px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── componentes ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .card-b { padding: 18px; }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .k svg { width: 14px; height: 14px; color: var(--muted-2); }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-muted); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--success-soft); color: var(--success); } .badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warning-soft); color: var(--warning); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); } .badge.navy { background: var(--primary-soft); color: var(--primary); }
.btn { font: inherit; font-weight: 500; font-size: 13.5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); padding: 8px 14px; border-radius: var(--radius); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; line-height: 1.2; transition: background .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-muted); } .btn:disabled { opacity: .55; cursor: progress; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); } .btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: #efc5c5; } .btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-muted); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; } .btn.sm svg { width: 13px; height: 13px; }
.btn.icon { padding: 6px; }
label.f { display: block; font-size: 12.5px; font-weight: 600; margin: 0 0 5px; color: var(--fg); }
.campo { margin-top: 12px; } .campo:first-child, .grid > .campo { margin-top: 0; }
.card.scroll { overflow-x: auto; }
.input, select, textarea { font: inherit; font-size: 13.5px; width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--fg); outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,68,104,.15); }
textarea { min-height: 84px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field-err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.with-icon { position: relative; } .with-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.with-icon .input { padding-left: 32px; }
.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13px; margin-bottom: 14px; align-items: flex-start; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.alert.info { background: var(--info-soft); border-color: #b9d3ee; color: #163f66; } .alert.warn { background: var(--warning-soft); border-color: #f1d4a4; color: #6f4409; }
.alert.err { background: var(--danger-soft); border-color: #efc5c5; color: #7a2121; } .alert.ok { background: var(--success-soft); border-color: #bfe0b3; color: #22501a; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-muted); white-space: nowrap; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.t td .badge { white-space: normal; }
.t tr:last-child td { border-bottom: 0; } .t tr.click { cursor: pointer; } .t tr.click:hover td { background: #f7fafc; }
.t td.msg { max-width: 340px; color: #3b4a56; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--muted-2); margin-bottom: 8px; }
.empty b { display: block; color: var(--fg); margin-bottom: 4px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }
.steps .chk { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-muted); color: var(--muted-2); flex: none; font-size: 12px; }
.steps .chk.ok { background: var(--brand-soft); color: var(--brand-ink); }
.steps .chk svg { width: 12px; height: 12px; }
.bars .bar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.bars .track { height: 8px; background: var(--surface-muted); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--primary); border-radius: 4px; }
.bars .fill.err { background: var(--danger); }
.bars .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button { font: inherit; font-size: 12.5px; font-weight: 500; padding: 6px 12px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: 0; } .segmented button.on { background: var(--primary-soft); color: var(--primary); }
.rule { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; }
.rule + .rule { border-top: 1px solid var(--border); }
.rule .order { display: flex; flex-direction: column; gap: 2px; }
.rule .body { flex: 1; min-width: 0; }
.rule .title { font-weight: 650; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.rule .meta { color: var(--muted); font-size: 13px; margin-top: 3px; } .rule .meta b { color: var(--fg); font-weight: 600; }
.rule.off { opacity: .6; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-top: 6px; }
.checks label, .inline { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; margin: 0; }
.inline.plain { border: 0; padding: 6px 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 15px; height: 15px; }
.qr { text-align: center; padding: 16px; }
.qr img { width: 250px; height: 250px; image-rendering: pixelated; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.pair { font-size: 32px; letter-spacing: 6px; font-weight: 700; text-align: center; padding: 14px; font-family: var(--mono); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--muted-2); }
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); } .status-dot.err { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); } .status-dot.warn { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .ic { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; margin-top: 2px; }
.timeline .ic.ok { background: var(--success-soft); color: var(--success); } .timeline .ic.err { background: var(--danger-soft); color: var(--danger); }
.timeline .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 600; font-size: 13px; }
.timeline details { margin-top: 6px; } .timeline summary { cursor: pointer; font-size: 12px; color: var(--info); }
pre.json { margin: 6px 0 0; padding: 10px 12px; background: #0f2233; color: #dbe7f0; border-radius: var(--radius-sm); font: 12px/1.45 var(--mono); overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters select { width: auto; min-width: 150px; }

/* ── modal / drawer / toast ───────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(4,26,43,.45); z-index: 40; display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal .m-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal .m-b { padding: 18px 20px; overflow: auto; } .modal .m-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(4,26,43,.35); animation: fade .15s ease; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease; }
.drawer .d-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.drawer .d-b { padding: 18px 20px; overflow: auto; flex: 1; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f2233; color: #fff; padding: 11px 14px; border-radius: var(--radius); box-shadow: var(--shadow-md); max-width: 400px; font-size: 13px; animation: fade .15s ease; display: flex; gap: 8px; align-items: center; }
.toast.ok { background: #1f5a1f; } .toast.err { background: #7a2121; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide { from { transform: translateX(16px); opacity: 0 } to { transform: none; opacity: 1 } }
.skeleton { background: linear-gradient(90deg, #eef2f5 25%, #f6f8fa 50%, #eef2f5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

@media (max-width: 960px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; box-shadow: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 10px 14px 6px; }
  .sidebar nav { display: flex; gap: 4px; overflow-x: auto; padding: 4px 10px 8px; flex: none; scrollbar-width: none; }
  .sidebar nav a.item { white-space: nowrap; padding: 6px 10px; font-size: 13px; } .sidebar .sec { display: none; }
  .sidebar a.item.active::before { display: none; }
  .sidebar .user { padding: 8px 14px; }
  .topbar { padding: 8px 16px; } .crumbs { display: none; } .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; } .chip { flex: none; }
  .page { padding: 16px; } .page-head { flex-direction: column; }
  .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  .bars .bar { grid-template-columns: 100px 1fr 36px; }
  .filters .input, .filters select { min-width: 0; width: 100%; } .filters .with-icon { width: 100%; }
  .drawer { width: 100%; }
}
