/* SUPPLY CONNECT — identidade visual corporativa: azul-marinho, branco, cinza neutro. */
:root {
  --navy: #0b2545;
  --navy-2: #13315c;
  --navy-3: #1c3f73;
  --accent: #1d63d8;
  --accent-soft: #e6efff;
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #e1e6ef;
  --text: #17233a;
  --muted: #5f6b80;
  --ok: #1a8f4c; --ok-bg: #e5f6ec;
  --warn: #a86b00; --warn-bg: #fff3d6;
  --danger: #c0392b; --danger-bg: #fde8e6;
  --info: #3b5b8c; --info-bg: #e9eff9;
  --radius: 10px;
  --sidebar-w: 284px;
  --sidebar-w-collapsed: 68px;
  --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 4px 14px rgba(11, 37, 69, .05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(29, 99, 216, .45); outline-offset: 1px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; height: 100%; }
.boot-msg { color: var(--muted); text-align: center; padding: 24px; }

/* ---------- Logotipo tipográfico ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; white-space: nowrap; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #5a9bff); display: grid; place-items: center; flex: none; }
.logo-mark svg { width: 20px; height: 20px; }
.logo-text { font-weight: 800; letter-spacing: .14em; font-size: 15px; line-height: 1; }
.logo-text small { display: block; font-weight: 500; letter-spacing: .32em; font-size: 10px; color: #9db8e6; margin-top: 4px; }
.logo.dark { color: var(--navy); }
.logo.dark .logo-text small { color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-hero { background: radial-gradient(1200px 600px at 10% 0%, var(--navy-3), var(--navy) 60%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h2 { font-size: 30px; max-width: 420px; font-weight: 700; letter-spacing: -.01em; }
.login-hero p { color: #b9cbe9; max-width: 440px; margin-top: 14px; }
.login-hero .foot { color: #8aa3cf; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--card); }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 22px; margin: 18px 0 4px; }
.login-card form { margin-top: 20px; display: grid; gap: 14px; }

/* ---------- Layout principal ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: 60px minmax(0, 1fr); grid-template-areas: "side top" "side main"; height: 100%; transition: grid-template-columns .18s ease; }
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.sidebar { grid-area: side; background: var(--navy); color: #cfdcf5; display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.sidebar-head { height: 60px; display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.nav { overflow-y: auto; padding: 10px 10px 24px; flex: 1; scrollbar-width: thin; scrollbar-color: #28477d transparent; }
.nav-section { margin-top: 14px; }
.nav-title { font-size: 10.5px; letter-spacing: .14em; color: #7f9ac9; padding: 6px 10px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; background: none; color: inherit; border-radius: 8px; cursor: pointer; text-align: left; text-decoration: none; position: relative; }
.nav-item:hover { background: rgba(255, 255, 255, .07); }
.nav-item.active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 #6aa2ff; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .tag { font-size: 10px; padding: 2px 6px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: #9db8e6; white-space: nowrap; }
.nav-item.planned { color: #8ea6d0; }
.collapsed .nav-title, .collapsed .nav-item .label, .collapsed .nav-item .tag, .collapsed .logo-text { display: none; }
.collapsed .nav-item { justify-content: center; }
.collapsed .sidebar-head { justify-content: center; padding: 0; }
.sidebar-foot { padding: 10px 14px; font-size: 11px; color: #7f9ac9; border-top: 1px solid rgba(255, 255, 255, .08); }
.collapsed .sidebar-foot { display: none; }

.topbar { grid-area: top; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 18px; min-width: 0; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text); position: relative; flex: none; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 20px; height: 20px; }
.badge-dot { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px 0 38px; background: var(--bg); }
.search input:focus { background: #fff; border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29, 99, 216, .15); }
.search > svg { position: absolute; left: 11px; top: 9px; width: 18px; height: 18px; color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 11px ui-monospace, monospace; border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; color: var(--muted); background: #fff; }
.dropdown { position: absolute; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(11, 37, 69, .18); overflow: hidden; }
.search .dropdown { left: 0; right: 0; top: 44px; max-height: 60vh; overflow: auto; }
.dropdown .group { padding: 8px 14px 4px; font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.dropdown .row { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 14px; border: 0; background: none; text-align: left; cursor: pointer; }
.dropdown .row:hover, .dropdown .row:focus-visible { background: var(--accent-soft); }
.dropdown .empty { padding: 14px; color: var(--muted); }
.spacer { flex: 1; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 9px; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta span { font-size: 11.5px; color: var(--muted); }
.menu-pop { right: 0; top: 46px; min-width: 240px; }
.notif-pop { right: 0; top: 46px; width: min(380px, 92vw); max-height: 70vh; overflow: auto; }

.main { grid-area: main; overflow: auto; padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 720px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card h2 { font-size: 15px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .k-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .k-value { font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.off { background: #f8f9fc; border-style: dashed; box-shadow: none; }
.kpi.off .k-value { color: #aab3c4; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: #f1c4bf; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.danger, .chip.fail { background: var(--danger-bg); color: var(--danger); }
.chip.info, .chip.pending { background: var(--info-bg); color: var(--info); }
.chip.neutral { background: #eceff5; color: #5a667c; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; min-height: 38px; border: 1px solid #cbd3e1; border-radius: 8px; padding: 8px 11px; background: #fff; font-weight: 400; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29, 99, 216, .15); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 500; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.alert { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; border: 1px solid transparent; }
.alert.danger { background: var(--danger-bg); color: #8f2a20; border-color: #f4c7c2; }
.alert.info { background: var(--info-bg); color: #2f4a76; border-color: #cfdcf3; }
.alert.warn { background: var(--warn-bg); color: #7a4d00; border-color: #f1dca4; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.toolbar .input { width: auto; min-width: 180px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; min-width: 640px; }
.t th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; background: #f8f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th.sortable { cursor: pointer; user-select: none; }
.t td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:hover td { background: #fafbfe; }
.t td.num, .t th.num { text-align: right; }
.t .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; gap: 12px; flex-wrap: wrap; color: var(--muted); }
.empty-state { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 10px 16px; padding: 18px 20px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }
.check { display: grid; gap: 6px; padding: 14px 16px; }
.check .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.check .name { font-weight: 700; }
.check .detail { color: var(--muted); font-size: 13px; }
.check .ms { font-size: 11.5px; color: #8b95a8; }
.summary-bar { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; padding: 18px 20px; }
.summary-bar .big { font-size: 20px; font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.list li:last-child { border-bottom: 0; }
.placeholder { text-align: center; padding: 56px 24px; max-width: 640px; margin: 24px auto; }
.placeholder .ph-icon { width: 54px; height: 54px; border-radius: 14px; background: var(--info-bg); color: var(--info); display: grid; place-items: center; margin: 0 auto 14px; }
.placeholder .ph-icon svg { width: 28px; height: 28px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: #c3cad8; }
pre.json { margin: 0; padding: 10px 12px; background: #f5f7fb; border-radius: 8px; overflow: auto; max-height: 220px; font-size: 12px; }
.swatch { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); flex: none; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 38px; padding: 2px; border-radius: 8px; border: 1px solid #cbd3e1; background: #fff; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, 94vw); box-shadow: 0 24px 60px rgba(11, 37, 69, .35); }
dialog::backdrop { background: rgba(11, 37, 69, .5); }
.dlg-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
.dlg-body { padding: 16px 22px; display: grid; gap: 14px; }
.dlg-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; max-width: min(380px, 92vw); }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); font-size: 13.5px; border-left: 4px solid #6aa2ff; }
.toast.ok { border-left-color: #3cc47c; }
.toast.err { border-left-color: #ff7a6b; }
.backdrop { position: fixed; inset: 0; background: rgba(11, 37, 69, .45); z-index: 25; }

/* ---------- Responsividade ---------- */
@media (max-width: 1100px) {
  .main { padding: 20px 18px 40px; }
  .user-meta { display: none; }
}
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 8px 0 30px rgba(0, 0, 0, .3); }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.collapsed .nav-title, .shell.collapsed .nav-item .label, .shell.collapsed .nav-item .tag, .shell.collapsed .logo-text { display: revert; }
  .shell.collapsed .nav-item { justify-content: flex-start; }
  .shell.collapsed .sidebar-head { justify-content: flex-start; padding: 0 16px; }
  .shell.collapsed .sidebar-foot { display: block; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .kv { grid-template-columns: 1fr; }
  .search kbd { display: none; }
}
@media (max-width: 560px) {
  .main { padding: 16px 12px 40px; }
  .topbar { padding: 0 10px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Utilitários adicionais ---------- */
.relwrap { position: relative; }
.section-gap { height: 16px; }
.grid.kpis + .grid { margin-top: 16px; }
.alert + .grid, .alert + .card, .alert + div { margin-top: 14px; }
.page-head + .alert { margin-bottom: 0; }
.card-pad.grid { padding: 16px; }
.placeholder .actions { justify-content: center; margin: 14px 0; }
.card .card-head h2 + .chip { margin-left: auto; }
.nav-item.planned .label { opacity: .85; }

a.btn, a.btn:visited { text-decoration: none; color: var(--text); }
a.btn.primary { color: #fff; }
a.row, a.row:visited { text-decoration: none; color: inherit; }
.nowrap, .t td.mono { white-space: nowrap; }
.list li .mono { white-space: nowrap; }
#app { height: 100%; }

/* ---------- Ordem 002: importação e compras ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--border, #c9d3e0); border-radius: 12px; background: #f7f9fc; text-align: center; cursor: pointer; }
.dropzone svg { width: 34px; height: 34px; color: var(--accent, #1f6feb); }
.dropzone.over, .dropzone:focus-visible { border-color: var(--accent, #1f6feb); background: #eaf2ff; outline: none; }
.tab-body { padding-top: 14px; }
progress { height: 10px; accent-color: var(--accent, #1f6feb); }
.matrix td.best { background: #e9f7ee; font-weight: 600; }
.matrix tr.sum td { background: #f4f6fa; }
.matrix tr.total td { background: #eaf0fa; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; }
.check-row { display: block; padding: 4px 6px; }
.list li .btn { margin-right: 6px; }
@media (max-width: 900px) { .matrix { font-size: 12px; } }
.mt10 { margin-top: 10px; } .mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; }
.w100 { width: 100%; } .minw150 { min-width: 150px; }
.w60px { width: 60px; } .w70px { width: 70px; } .w90px { width: 90px; } .w100px { width: 100px; }
.prewrap { white-space: pre-wrap; }
.dropzone + .actions, .card-pad > .actions { margin-top: 12px; }
.main h2.section-gap { margin: 24px 0 10px; }
.main .table-wrap + h2.section-gap, .main .card + h2.section-gap { margin-top: 26px; }

/* Ordem 003 — detalhes de itens, qualidade e catálogo */
.detail-row td { background: #f8f9fc; padding: 0; }
.kv.compact { padding: 12px 16px; gap: 6px 14px; font-size: 13px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; }
.bar { height: 10px; background: #e6eaf2; border-radius: 99px; overflow: hidden; min-width: 120px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.w-0 > span { width: 0; } .bar.w-10 > span { width: 10%; } .bar.w-20 > span { width: 20%; } .bar.w-30 > span { width: 30%; } .bar.w-40 > span { width: 40%; }
.bar.w-50 > span { width: 50%; } .bar.w-60 > span { width: 60%; } .bar.w-70 > span { width: 70%; } .bar.w-80 > span { width: 80%; } .bar.w-90 > span { width: 90%; } .bar.w-100 > span { width: 100%; }
.stage-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage-row .hint { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.delta-up { color: var(--ok); font-weight: 600; } .delta-down { color: var(--danger); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-copy { position: fixed; left: -9999px; top: 0; }

.sigpad { width: 100%; max-width: 600px; height: auto; aspect-ratio: 3/1; border: 1px dashed #9aa7b8; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }

/* Aprovação comercial (v1.6.2) */
dialog.wide { width: min(1040px, 96vw); max-height: 94vh; }
dialog.wide .dlg-body { max-height: calc(94vh - 130px); overflow: auto; }
.commercial-prep h3 { margin: 14px 0 6px; font-size: 1rem; color: var(--navy, #0b2545); }
.kv-grid { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 6px 14px; margin: 0; }
.kv-grid dt { color: #5b6573; font-size: .88rem; } .kv-grid dd { margin: 0; font-weight: 600; word-break: break-word; }
tr.row-hl td { background: #e9f7ef; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline li { display: flex; gap: 8px; align-items: baseline; color: #6b7686; } .timeline li.done { color: #146c2e; font-weight: 600; }
.timeline .tick { width: 18px; text-align: center; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; left: -9999px; }
.commercial-card h2 { margin-top: 0; }
@media (max-width: 640px) { .kv-grid { grid-template-columns: 1fr; } }
