/* MP DO BRASIL ERP — Desenvolvido por Weber de Queiroz */
:root {
  --brand: #0B2545; --accent: #C9A227;
  --ink: #101828; --ink-2: #344054; --muted: #667085; --line: #E4E7EC; --line-2: #F2F4F7;
  --bg: #F4F6F9; --card: #FFFFFF; --side: #0A1628; --side-2: #12223A; --side-ink: #C3CCDA;
  --ok: #15803D; --ok-bg: #E8F6EC; --warn: #B45309; --warn-bg: #FEF3E2; --bad: #B91C1C; --bad-bg: #FDECEC;
  --info: #1D5FB8; --info-bg: #E8F0FB; --demo: #9A3412; --demo-bg: #FFEDD5;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px -8px rgba(16,24,40,.18), 0 4px 8px -4px rgba(16,24,40,.08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Archivo", "Inter", system-ui, sans-serif;
  --side-w: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 .6em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.ic { flex: none; }
[hidden] { display: none !important; }

/* ---------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); background: linear-gradient(180deg, var(--side) 0%, #0D1B30 100%); color: var(--side-ink); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; border-right: 1px solid rgba(255,255,255,.04); }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: #fff; text-decoration: none !important; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-logo { max-height: 40px; max-width: 200px; }
.brand-mark { display: inline-flex; filter: drop-shadow(0 4px 10px rgba(201,162,39,.35)); }
.brand-mark.big svg { width: 56px; height: 56px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--display); font-size: 16px; letter-spacing: .08em; }
.brand-text small { color: var(--accent); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; scrollbar-color: #2a3b55 transparent; }
.nav-section { margin-top: 6px; }
.nav-title { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: #7D8BA3; font: 600 10.5px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; padding: 12px 10px 8px; cursor: pointer; }
.nav-title svg { transition: transform .2s; opacity: .6; }
.nav-section:not(.open) .nav-title svg { transform: rotate(-90deg); }
.nav-section:not(.open) .nav-items { display: none; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; font-size: 13.5px; position: relative; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(201,162,39,.18), rgba(201,162,39,.04)); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-link.active .ic { color: var(--accent); }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: #5d6b82; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.demo-pill { background: rgba(234,88,12,.15); color: #FDBA74; border: 1px solid rgba(234,88,12,.35); padding: 3px 7px; border-radius: 20px; font-weight: 700; font-size: 9.5px; letter-spacing: .06em; }
.sidebar-backdrop { display: none; }
.main { flex: 1; margin-left: var(--side-w); display: flex; flex-direction: column; min-width: 0; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 28px; background: rgba(255,255,255,.88); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); min-height: 64px; }
.gsearch { position: relative; flex: 1; min-width: 0; max-width: 640px; display: flex; align-items: center; gap: 8px; background: var(--line-2); border: 1px solid transparent; border-radius: 10px; padding: 0 8px 0 12px; height: 42px; color: var(--muted); transition: all .15s; }
.gsearch:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(11,37,69,.08); }
.gsearch input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--ink); outline: none; min-width: 0; height: 100%; }
.gsearch kbd { font: 600 11px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: #fff; color: var(--muted); }
.scan-btn { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; padding: 6px; border-radius: 7px; display: inline-flex; }
.scan-btn:hover { background: #fff; color: var(--brand); }
.gsearch-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 70vh; overflow-y: auto; display: none; padding: 6px; }
.gsearch-results.show { display: block; }
.gs-group { font: 600 10.5px var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 10px 10px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.gs-item:hover, .gs-item.sel { background: var(--line-2); text-decoration: none; }
.gs-item .ic { color: var(--muted); }
.gs-item span { display: flex; flex-direction: column; min-width: 0; }
.gs-item strong { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-all { display: block; text-align: center; padding: 9px; font-weight: 600; border-top: 1px solid var(--line); margin-top: 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 10px; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn .dot { position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font: 700 10px/17px var(--font); border: 2px solid #fff; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 5px 8px 5px 5px; border-radius: 12px; cursor: pointer; text-align: left; font: inherit; }
.user-btn:hover { background: var(--line-2); }
.user-btn span { display: flex; flex-direction: column; line-height: 1.2; }
.user-btn small { font-size: 11.5px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #1E4C8A); color: #fff; display: inline-flex !important; align-items: center; justify-content: center; font: 700 15px var(--display); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50; }
.dropdown-menu.wide { width: 360px; }
.dropdown-menu.show { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-head span { display: flex; flex-direction: column; }
.dd-head small { color: var(--muted); }
.dd-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dd-item:hover { background: var(--line-2); text-decoration: none; }
.dd-item span { display: flex; flex-direction: column; }
.dd-item small { color: var(--muted); font-size: 12px; }
.dd-item.unread strong::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--info); margin-left: 6px; vertical-align: middle; }
.dd-empty { padding: 18px; text-align: center; color: var(--muted); }
.lvl { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--info); }
.lvl-warn { background: var(--warn); } .lvl-bad { background: var(--bad); } .lvl-ok { background: var(--ok); }
.link-btn { background: none; border: 0; color: var(--info); font: 500 12.5px var(--font); cursor: pointer; padding: 0; }

.content { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1600px; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; background: #fff; }
.dev { letter-spacing: .14em; font-size: 10.5px; font-weight: 600; color: #8A94A6; }

/* ---------- page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; max-width: 820px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs span { opacity: .5; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid transparent; font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(11,37,69,.25), inset 0 1px 0 rgba(255,255,255,.08); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #fff); }
.btn-accent { background: var(--accent); color: #1a1405; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-secondary { background: #fff; color: var(--ink-2); border-color: #D0D5DD; box-shadow: var(--shadow); }
.btn-secondary:hover { background: #F9FAFB; border-color: #98A2B3; }
.btn-danger { background: #fff; color: var(--bad); border-color: #F3B4B4; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled], .btn.loading { opacity: .65; pointer-events: none; }
.btn.loading::after { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-form { display: inline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions.center { justify-content: center; }

/* ---------- cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span2 { grid-column: span 2; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; position: relative; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.kpi:hover { text-decoration: none; border-color: #C5CCD8; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 8%, #fff); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font: 700 24px/1.2 var(--display); color: var(--ink); margin-top: 2px; letter-spacing: -.02em; }
.kpi-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn .kpi-icon { background: var(--warn-bg); color: var(--warn); }
.kpi.bad .kpi-icon { background: var(--bad-bg); color: var(--bad); }
.kpi.ok .kpi-icon { background: var(--ok-bg); color: var(--ok); }
.kpi.gold .kpi-icon { background: color-mix(in srgb, var(--accent) 18%, #fff); color: color-mix(in srgb, var(--accent) 70%, #000); }
.kpi.hero { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #1E4C8A)); border: 0; color: #fff; }
.kpi.hero .kpi-label, .kpi.hero .kpi-hint { color: rgba(255,255,255,.7); }
.kpi.hero .kpi-value { color: #fff; }
.kpi.hero .kpi-icon { background: rgba(255,255,255,.12); color: var(--accent); }
.kpi.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%); }

/* ---------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: left; font: 600 11.5px var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #F9FAFB; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl th a { color: inherit; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #FAFBFC; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl .strong { font-weight: 600; }
.tbl tfoot td { font-weight: 700; background: #F9FAFB; border-top: 1px solid var(--line); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl input.inp { height: 32px; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #FCFCFD; }
.filters .fld { margin: 0; }
.filters .fld label { font-size: 11.5px; }
.filters .grow { flex: 1; min-width: 200px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); font-size: 12.5px; }
.pg-links { display: flex; gap: 4px; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-2); background: #fff; }
.pg:hover { text-decoration: none; background: var(--line-2); }
.pg.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg.disabled { opacity: .4; }
.pg.dots { border: 0; background: none; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font: 600 11.5px/1.6 var(--font); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--line-2); color: var(--ink-2); }
.demo-tag { display: inline-block; font: 700 9.5px/1 var(--font); letter-spacing: .08em; color: var(--demo); background: var(--demo-bg); border: 1px solid #FDBA74; border-radius: 4px; padding: 3px 5px; margin-left: 6px; vertical-align: middle; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; background: var(--line-2); font-size: 12px; color: var(--ink-2); }

/* ---------- forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld label { font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.fld label .req { color: var(--bad); }
.fld .hint { font-size: 12px; color: var(--muted); }
.inp, select.inp, textarea.inp { width: 100%; height: 40px; border: 1px solid #D0D5DD; border-radius: 8px; padding: 0 12px; font: inherit; color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: border-color .15s, box-shadow .15s; }
textarea.inp { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.inp:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(11,37,69,.08); }
.inp.err, .fld.has-err .inp { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 12px; }
.inp-sm { height: 32px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
fieldset.group { border: 0; padding: 0; margin: 0 0 22px; }
fieldset.group legend { font: 700 12px var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--brand); padding: 0 0 10px; display: flex; align-items: center; gap: 10px; width: 100%; }
fieldset.group legend::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #FCFCFD; border-radius: 0 0 var(--radius) var(--radius); position: sticky; bottom: 0; }

/* ---------- alerts / toasts */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--ok-bg); border-color: #B7E1C3; color: #14532D; }
.alert-error { background: var(--bad-bg); border-color: #F5C2C2; color: #7F1D1D; }
.alert-info { background: var(--info-bg); border-color: #C3D6F3; color: #1E3A8A; }
.alert-warn { background: var(--warn-bg); border-color: #F6D7A7; color: #7C2D12; }
.alert-demo { background: var(--demo-bg); border-color: #FDBA74; color: var(--demo); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-weight: 500; animation: slide .25s ease-out; box-shadow: var(--shadow); }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
.toast-success { background: #F0FAF3; border-color: #B7E1C3; color: #14532D; }
.toast-error { background: #FEF3F2; border-color: #F5C2C2; color: #7F1D1D; }
.toast-info { background: #EFF5FD; border-color: #C3D6F3; color: #1E3A8A; }
.toast-warn { background: var(--warn-bg); border-color: #F6D7A7; color: #7C2D12; }
.toast span { flex: 1; }
.toast-x { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty .ic { opacity: .5; margin-bottom: 8px; }

/* definition lists */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 22px; }
.dl div { min-width: 0; }
.dl dt { font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 500; color: var(--ink); word-break: break-word; }
.big-num { font: 700 28px var(--display); letter-spacing: -.02em; }

/* stats strip */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.stat-strip > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip small { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-strip strong { font: 700 20px var(--display); }
.stat-strip .ok strong { color: var(--ok); } .stat-strip .warn strong { color: var(--warn); } .stat-strip .bad strong { color: var(--bad); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tab { padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--accent); }

/* steps (expedition flow) */
.steps { display: flex; gap: 0; overflow-x: auto; padding: 18px 20px; }
.step { flex: 1; min-width: 110px; position: relative; text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step .n { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; position: relative; z-index: 1; font-weight: 700; color: var(--muted); }
.step.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done::before, .step.cur::before { background: var(--ok); }
.step.cur .n { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.step.cur { color: var(--ink); font-weight: 700; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }
.timeline li.ok::after { border-color: var(--ok); } .timeline li.warn::after { border-color: var(--warn); } .timeline li.bad::after { border-color: var(--bad); } .timeline li.gold::after { border-color: var(--accent); }
.timeline .t-title { font-weight: 600; }
.timeline .t-sub { font-size: 12.5px; color: var(--muted); }

/* trace flow */
.trace { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.trace-node { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; position: relative; }
.trace-node .k { font: 600 10.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.trace-node .v { font: 700 16px var(--display); margin-top: 3px; }
.trace-node.accent { border-color: color-mix(in srgb, var(--accent) 60%, #fff); background: color-mix(in srgb, var(--accent) 7%, #fff); }

/* charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.bar-row .bar { grid-column: 1 / -1; height: 7px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--accent))); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(10,22,40,.55); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; padding: 22px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-box h3 { margin-bottom: 8px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.scanner-box { max-width: 520px; }
#scanner-view { border-radius: 10px; overflow: hidden; background: #000; min-height: 260px; }
#scanner-view video { width: 100%; display: block; }

/* auth */
body.auth { background: #0A1628; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 10% 10%, #163A66 0%, transparent 60%), linear-gradient(160deg, #0B2545 0%, #081A31 55%, #050E1B 100%); }
.foil { position: absolute; inset: -20% -30% auto auto; width: 720px; height: 720px; border-radius: 50%; background: conic-gradient(from 200deg, transparent 0 40%, color-mix(in srgb, var(--accent) 55%, transparent) 50%, #FFF2B3 53%, color-mix(in srgb, var(--accent) 45%, transparent) 57%, transparent 66%); filter: blur(30px); opacity: .45; animation: foil 14s ease-in-out infinite alternate; }
@keyframes foil { to { transform: rotate(40deg) translateY(30px); } }
.hero-inner { position: relative; margin: auto 0; max-width: 520px; }
.hero-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 56px; }
.hero-brand span { display: flex; flex-direction: column; }
.hero-brand strong { font: 800 26px var(--display); letter-spacing: .1em; }
.hero-brand small { color: var(--accent); letter-spacing: .2em; text-transform: uppercase; font-size: 11px; font-weight: 600; }
.hero-logo { max-height: 64px; }
.auth-hero h2 { color: #fff; font: 700 40px/1.15 var(--display); letter-spacing: -.02em; margin-bottom: 28px; }
.auth-hero h2 em { font-style: normal; background: linear-gradient(90deg, #F4DE8A, var(--accent), #F7E7A6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; color: #C3CCDA; }
.hero-points li { display: flex; gap: 12px; align-items: center; }
.hero-points .ic { color: var(--accent); }
.hero-foot { position: relative; font-size: 11px; letter-spacing: .2em; color: #6A7A93; font-weight: 600; }
.auth-panel { background: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 28px 24px; }
.auth-card { width: 100%; max-width: 400px; margin: auto 0; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-card form .fld { margin-bottom: 14px; }
.auth-card .btn { width: 100%; height: 44px; }
.auth-links { display: flex; justify-content: space-between; margin: 16px 0 0; font-size: 13px; gap: 10px; flex-wrap: wrap; }
.auth-foot { font-size: 11.5px; color: var(--muted); margin-top: 24px; }
.auth-mobile-brand { display: none; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }

/* welcome */
.welcome { position: relative; overflow: hidden; border-radius: 14px; padding: 26px 30px; color: #fff; margin-bottom: 20px; background: linear-gradient(120deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 75%, #1E4C8A) 60%, color-mix(in srgb, var(--brand) 60%, var(--accent)) 140%); display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; }
.welcome::after { content: ""; position: absolute; right: -60px; top: -80px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%); }
.welcome h1 { color: #fff; font-size: 24px; }
.welcome p { color: rgba(255,255,255,.75); margin: 4px 0 0; }
.welcome .seg { position: relative; z-index: 1; display: flex; gap: 6px; background: rgba(255,255,255,.1); padding: 4px; border-radius: 10px; }
.welcome .seg a { color: #fff; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; }
.welcome .seg a.active { background: #fff; color: var(--brand); text-decoration: none; }
.welcome .seg a:hover { text-decoration: none; }

/* error */
.error-page { text-align: center; padding: 70px 16px; max-width: 520px; margin: 0 auto; }
.error-code { font: 800 84px/1 var(--display); background: linear-gradient(90deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { margin: 10px 0; }
.error-page p { color: var(--muted); margin-bottom: 22px; }

/* misc */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.perm-mod { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.perm-mod h4 { font-size: 13px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.perm-mod label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.perm-mod select { height: 26px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; }
.kv-mini { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.kv-mini b { color: var(--ink); font-weight: 600; }
.doc-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
.doc-link:hover { border-color: var(--brand); text-decoration: none; background: #FAFBFD; }
.doc-link .ic { color: var(--bad); }
.doc-list { display: grid; gap: 8px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }
.right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }
.only-mobile { display: none !important; }
.qr-box { display: inline-block; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1.1fr) 26px minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.map-row .arrow { color: var(--muted); text-align: center; }
.map-sample { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wizard { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.wizard span { padding: 7px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.wizard span.done { background: var(--ok-bg); color: var(--ok); border-color: #B7E1C3; }
.wizard span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
details.more summary { cursor: pointer; color: var(--info); font-weight: 600; font-size: 12.5px; }
.row-err td { background: #FFF8F8 !important; }
.row-warn td { background: #FFFCF5 !important; }

/* label preview */
.label-sheet { display: flex; flex-wrap: wrap; gap: 16px; }

/* ---------- responsive */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .g3, .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; font: 800 18px var(--display); letter-spacing: .1em; color: var(--brand); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,22,40,.5); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-flex !important; }
  .topbar { padding: 8px 12px; gap: 6px; padding-top: max(8px, env(safe-area-inset-top)); }
  .top-actions { gap: 0; }
  .icon-btn { width: 36px; }
  .user-btn { padding: 3px; }
  .gsearch { padding: 0 4px 0 10px; }
  .content { padding: 18px 16px 32px; }
  .footer { padding: 14px 16px; flex-direction: column; align-items: center; text-align: center; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .hide-mobile { display: none !important; }
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 21px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn, .page-actions form { flex: 1 1 auto; }
  .page-actions form .btn { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; flex-direction: column; }
  .kpi-value { font-size: 20px; }
  .card-head, .card-body, .filters, .pager { padding-left: 14px; padding-right: 14px; }
  .filters .fld, .filters .grow { flex: 1 1 100%; min-width: 0; }
  .dropdown-menu.wide { width: min(360px, calc(100vw - 24px)); right: -48px; }
  .map-row { grid-template-columns: 1fr; gap: 6px; }
  .map-row .arrow { display: none; }
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl.responsive td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.responsive td::before { content: attr(data-label); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; }
  .tbl.responsive td.act { justify-content: flex-end; }
  .tbl.responsive td.act::before { display: none; }
  .welcome { padding: 20px; }
  .form-foot { flex-direction: column-reverse; }
  .form-foot .btn { width: 100%; }
}
@media print {
  .sidebar, .topbar, .footer, .page-actions, .filters, .pager, .no-print { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}
