:root {
  --navy-950: #071720;
  --navy-900: #0d2430;
  --navy-800: #153541;
  --navy-700: #26505c;
  --aqua-700: #2e9f93;
  --aqua-600: #41b8aa;
  --aqua-500: #56cabb;
  --aqua-100: #dff6f2;
  --orange-600: #e65f00;
  --orange-500: #f37000;
  --orange-100: #fff0e5;
  --green-600: #25845d;
  --green-100: #e6f6ed;
  --red-600: #c23a45;
  --red-100: #feecef;
  --amber-600: #aa7113;
  --amber-100: #fff5d9;
  --ink: #14252c;
  --muted: #687c84;
  --line: #dce6e8;
  --line-strong: #c8d7da;
  --surface: #fff;
  --surface-soft: #f4f8f8;
  --background: #edf3f4;
  --shadow: 0 12px 38px rgba(13, 36, 48, .08);
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --sidebar-width: 286px;
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; color-scheme: light; scroll-behavior: smooth; }
body { max-width: 100%; margin: 0; overflow-x: hidden; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
img, svg { display: block; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .45rem; color: var(--navy-900); font-size: clamp(1.85rem, 3vw, 2.65rem); letter-spacing: -.045em; line-height: 1.08; }
h2 { margin-bottom: .35rem; color: var(--navy-900); font-size: 1.18rem; letter-spacing: -.02em; }
code { padding: .18rem .42rem; border-radius: 5px; background: #eaf0f1; color: var(--navy-800); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: .45rem; color: var(--aqua-700); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar-width); flex-direction: column; overflow-y: auto; color: #fff; background: radial-gradient(circle at 12% 5%, rgba(86, 202, 187, .19), transparent 28%), linear-gradient(165deg, var(--navy-800), var(--navy-950) 72%); box-shadow: 14px 0 40px rgba(7, 23, 32, .14); }
.sidebar::before { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.024) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.024) 1px, transparent 1px); background-size: 28px 28px; content: ""; mask-image: linear-gradient(to bottom, #000, transparent 76%); }
.sidebar__brand { position: relative; padding: 27px 22px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; min-width: 0; align-items: center; gap: 12px; color: inherit; }
.brand__marks { display: flex; flex: 0 0 auto; gap: 5px; }
.brand__mark { position: relative; display: block; width: 35px; height: 35px; overflow: hidden; border: 2px solid rgba(255,255,255,.16); border-radius: 9px; background: #f5f5f5; box-shadow: 0 7px 18px rgba(0,0,0,.16); }
.brand__mark img { position: absolute; top: 0; left: 0; width: auto; max-width: none; height: 100%; }
.brand__mark--construqual img { height: 102%; }
.brand__copy { display: flex; min-width: 0; flex-direction: column; }
.brand__copy strong { overflow: hidden; color: #fff; font-size: .9rem; letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.brand__copy small { margin-top: 2px; overflow: hidden; color: rgba(255,255,255,.58); font-size: .58rem; letter-spacing: .015em; text-overflow: ellipsis; white-space: nowrap; }
.public-brand .brand { color: var(--navy-900); }
.public-brand .brand__copy strong { color: var(--navy-900); font-size: 1rem; }
.public-brand .brand__copy small { color: var(--muted); font-size: .65rem; }

.sidebar__nav { position: relative; display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 20px 15px; }
.nav-label { margin: 19px 13px 5px; color: rgba(255,255,255,.35); font-size: .65rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border: 1px solid transparent; border-radius: 11px; color: rgba(255,255,255,.72); font-size: .9rem; font-weight: 650; transition: .18s ease; }
.nav-item > span:first-child { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: rgba(255,255,255,.055); }
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover, .nav-item:focus-visible { color: #fff; background: rgba(255,255,255,.07); outline: none; }
.nav-item.is-active { border-color: rgba(86, 202, 187, .18); color: #fff; background: linear-gradient(90deg, rgba(86, 202, 187, .2), rgba(86, 202, 187, .07)); box-shadow: inset 3px 0 0 var(--aqua-500); }
.nav-item.is-active > span:first-child { color: var(--aqua-500); background: rgba(86,202,187,.13); }
.sidebar__footer { position: relative; padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-card__avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--navy-900); background: linear-gradient(135deg, var(--aqua-500), #95e2d8); font-size: .75rem; font-weight: 850; }
.user-card > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.user-card strong { overflow: hidden; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { color: rgba(255,255,255,.48); font-size: .7rem; }
.logout-link { display: inline-block; margin: 14px 0 0 48px; color: rgba(255,255,255,.47); font-size: .72rem; }
.logout-link:hover { color: #fff; }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 70px; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3.3vw, 48px); border-bottom: 1px solid rgba(200, 215, 218, .8); background: rgba(247, 250, 250, .9); backdrop-filter: blur(14px); }
.topbar > div { display: flex; flex-direction: column; }
.topbar__context { color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.topbar strong { color: var(--navy-900); font-size: .88rem; }
.topbar__site { color: var(--navy-700); font-size: .78rem; font-weight: 700; }
.menu-toggle { display: none; width: 42px; height: 42px; padding: 10px; border: 0; border-radius: 9px; background: var(--surface); }
.menu-toggle > span:not(.sr-only) { display: block; width: 100%; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--navy-800); }
.content { width: min(1480px, 100%); min-height: calc(100vh - 114px); margin: 0 auto; padding: clamp(26px, 4vw, 52px) clamp(18px, 3.3vw, 48px); }
.app-footer { display: flex; justify-content: space-between; padding: 0 clamp(20px, 3.3vw, 48px) 26px; color: #87999f; font-size: .7rem; }

.page-heading { display: flex; min-width: 0; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading__description { max-width: 720px; margin-bottom: 0; color: var(--muted); }
.page-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; }
.card { min-width: 0; margin-bottom: 20px; padding: clamp(19px, 2.5vw, 29px); border: 1px solid rgba(200, 215, 218, .72); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.card__head h2, .card__head p { margin-bottom: 0; }
.count-pill { display: inline-flex; min-width: 29px; height: 29px; align-items: center; justify-content: center; padding: 0 10px; border-radius: 99px; color: var(--navy-700); background: var(--surface-soft); font-size: .76rem; font-weight: 800; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: .63rem 1.05rem; border: 1px solid var(--aqua-700); border-radius: var(--radius-sm); color: #fff; background: linear-gradient(135deg, var(--aqua-600), var(--aqua-700)); box-shadow: 0 7px 17px rgba(46, 159, 147, .18); font-weight: 760; transition: transform .17s ease, box-shadow .17s ease, background .17s ease; }
.button:hover:not(:disabled), .button:focus-visible { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(46, 159, 147, .23); outline: none; }
.button--secondary { border-color: var(--line-strong); color: var(--navy-800); background: #fff; box-shadow: none; }
.button--secondary:hover:not(:disabled) { border-color: var(--aqua-600); background: var(--aqua-100); box-shadow: none; }
.button--small { min-height: 34px; padding: .38rem .7rem; font-size: .76rem; }
.button--wide { width: 100%; }
.button--orange { border-color: var(--orange-600); background: linear-gradient(135deg, var(--orange-500), var(--orange-600)); box-shadow: 0 7px 17px rgba(243,112,0,.18); }
.button--outline-orange { border-color: #f4b98d; color: var(--orange-600); background: var(--orange-100); box-shadow: none; }
.button--danger-soft { border-color: #f1c5ca; color: var(--red-600); background: var(--red-100); box-shadow: none; }
.text-link { border-bottom: 1px solid transparent; color: var(--aqua-700); font-size: .82rem; font-weight: 750; }
.text-link:hover { border-color: currentColor; }
.text-button { padding: 0; border: 0; color: var(--aqua-700); background: transparent; font-size: .82rem; font-weight: 750; }
.text-button--danger { color: var(--red-600); }

label { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: var(--navy-700); font-size: .75rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 43px; padding: .63rem .76rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); background: #fff; outline: none; transition: border-color .16s, box-shadow .16s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--aqua-600); box-shadow: 0 0 0 3px rgba(86, 202, 187, .15); }
input[readonly] { color: #607278; background: #f4f7f7; }
.form-grid { display: grid; gap: 15px; }
.form-grid--document { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid--supplier { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
.form-grid--product { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
.form-grid--settings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--user { grid-template-columns: 1.5fr 1.5fr 1fr 1.5fr auto; align-items: end; }
.form-action { align-self: end; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 23px; padding-top: 21px; border-top: 1px solid var(--line); }
.form-footer p, .form-hint { margin: 0; color: var(--muted); font-size: .78rem; }

.alert { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; padding: 13px 16px; border: 1px solid #bce8df; border-radius: 11px; color: #176c5e; background: var(--green-100); font-weight: 650; }
.alert--error { border-color: #f2c9cd; color: var(--red-600); background: var(--red-100); }
.alert--warning { border-color: #ead69c; color: var(--amber-600); background: var(--amber-100); }
.alert button { padding: 0; border: 0; color: inherit; background: transparent; font-size: 1.25rem; }
.notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 14px 17px; border: 1px solid #bfe2de; border-radius: 12px; color: var(--navy-800); background: #effaf8; }
.notice strong { flex: 0 0 auto; }
.notice span { color: var(--muted); }
.notice pre { margin: 0; overflow: auto; color: inherit; white-space: pre-wrap; }
.notice--error { border-color: #efc5c9; color: var(--red-600); background: var(--red-100); }
.notice--success { border-color: #b9e3cc; color: var(--green-600); background: var(--green-100); }
.notice--info { border-color: #badfdc; background: var(--aqua-100); }
.api-state { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; color: var(--green-600); background: var(--green-100); font-size: .68rem; font-weight: 800; }
.api-state::before, .api-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.api-state i + * { display: none; }
.api-state.is-error, .api-state.is-warning { color: var(--amber-600); background: var(--amber-100); }
.error-box { overflow: auto; padding: 14px; border-radius: 9px; color: var(--red-600); background: var(--red-100); white-space: pre-wrap; }

.status { display: inline-flex; width: max-content; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 99px; color: #64767c; background: #edf2f3; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--errors { color: var(--red-600); background: var(--red-100); }
.status--validated, .status--sent { color: var(--green-600); background: var(--green-100); }
.status--sent-draft, .status--ordered { color: #43708d; background: #e8f1f7; }
.status--to-order { color: var(--orange-600); background: var(--orange-100); }
.status--received { color: var(--green-600); background: var(--green-100); }

.upload-card { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin-bottom: 20px; padding: 25px 28px; border: 1px solid rgba(86,202,187,.25); border-radius: var(--radius-lg); background: linear-gradient(105deg, #f9ffff, #f0faf8); box-shadow: var(--shadow); }
.upload-card__copy { display: flex; align-items: center; gap: 17px; }
.upload-card__copy h2, .upload-card__copy p { margin-bottom: 0; }
.upload-card__copy p:last-child { color: var(--muted); font-size: .78rem; }
.upload-card__icon { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 13px; color: #fff; background: var(--aqua-600); font-size: 1.55rem; font-weight: 300; }
.upload-form { display: flex; align-items: center; gap: 12px; }
.file-drop { position: relative; display: flex; min-width: 230px; align-items: center; padding: 11px 16px; border: 1px dashed var(--aqua-600); border-radius: 10px; background: #fff; cursor: pointer; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop span { color: var(--aqua-700); font-size: .8rem; font-weight: 800; }
.file-drop small { color: var(--muted); font-size: .65rem; font-weight: 500; }
.file-drop.is-dragover { border-style: solid; background: var(--aqua-100); }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.filter-form { display: flex; flex: 1; align-items: center; gap: 9px; }
.filter-form select { width: auto; min-width: 170px; }
.search-box { position: relative; display: block; width: min(370px, 100%); }
.search-box span { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: var(--muted); font-size: 1.2rem; }
.search-box input { padding-left: 38px; }
.search-box--wide { width: min(620px, 100%); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: .66rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfb; }
.document-table td:nth-child(2) strong, .document-table td:nth-child(2) small { display: block; }
.document-table td:nth-child(2) small { margin-top: 2px; color: var(--muted); font-size: .69rem; }
.table-link { color: var(--aqua-700); font-size: .78rem; font-weight: 800; white-space: nowrap; }

.total-check { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin-top: 23px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.total-check > div { display: flex; flex-direction: column; padding: 13px 16px; background: #f8fbfb; }
.total-check span { color: var(--muted); font-size: .68rem; font-weight: 700; }
.total-check strong { color: var(--navy-900); font-size: 1rem; }
.total-check.is-warning > div:last-child { background: var(--amber-100); }
.total-check.is-warning > div:last-child strong { color: var(--amber-600); }
.line-editor { padding: 18px 0; border-top: 1px solid var(--line); }
.line-editor:first-of-type { border-top: 0; }
.line-editor__state { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.line-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; color: var(--navy-700); background: var(--surface-soft); font-size: .68rem; font-weight: 800; }
.line-validation { color: var(--muted); font-size: .7rem; }
.line-validation--ok { color: var(--green-600); }
.line-validation--error { color: var(--red-600); }
.line-editor__grid { display: grid; grid-template-columns: 1.2fr 2.5fr .7fr .9fr .65fr .9fr .8fr; gap: 10px; }
.line-editor__actions { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 11px; }
.add-line { margin: 13px -8px -8px; padding: 17px; border-radius: 13px; background: var(--surface-soft); }
.add-line__grid { display: grid; grid-template-columns: 1.2fr 2.4fr .7fr .8fr .65fr auto; align-items: end; gap: 10px; }
.document-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 24px 0; }
.document-actions > div { display: flex; flex-wrap: wrap; gap: 9px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 20px; border: 1px solid #f0d0d3; border-radius: 13px; background: #fffafa; }
.danger-zone p { margin: 2px 0 0; color: var(--muted); font-size: .75rem; }

.supplier-list, .user-list { display: flex; flex-direction: column; }
.supplier-row { display: grid; grid-template-columns: 1.6fr .8fr .8fr 1fr auto; align-items: end; gap: 11px; padding: 14px 0; border-top: 1px solid var(--line); }
.supplier-row:first-child { border-top: 0; }
.supplier-row label span, .user-row label span { color: var(--muted); font-size: .64rem; text-transform: uppercase; }
.row-buttons { display: flex; gap: 7px; }
.quick-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.quick-links a { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; transition: .16s ease; }
.quick-links a:hover { border-color: var(--aqua-600); transform: translateY(-1px); }
.quick-links a > span { grid-row: 1 / 3; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--aqua-700); background: var(--aqua-100); font-size: 1.15rem; }
.quick-links small { color: var(--muted); }
.user-row { display: grid; grid-template-columns: auto 1.2fr 1.3fr .8fr 1.1fr auto auto; align-items: end; gap: 11px; padding: 14px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row .user-card__avatar { align-self: center; }
.toggle-label { min-height: 43px; flex-direction: row; align-items: center; }
.toggle-label input { width: 17px; min-height: 17px; }

.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line-strong); border-radius: 11px; background: #fff; }
.segmented button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .74rem; font-weight: 750; }
.segmented button.is-active { color: #fff; background: var(--navy-800); }
.order-form { display: grid; grid-template-columns: 2.2fr 1.2fr 1fr .75fr auto; align-items: end; gap: 13px; }
.order-form--edit { grid-template-columns: 2fr 1.2fr 1fr .8fr .9fr auto; }
.order-form textarea { min-height: 78px; }
.order-board { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 17px; overflow-x: auto; }
.order-column { min-width: 0; padding: 0 4px 12px; }
.order-column__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 5px; }
.order-column__head > div { display: flex; align-items: center; gap: 9px; }
.order-column__head h2 { margin: 0; font-size: .94rem; }
.order-column__head span { width: 9px; height: 9px; border-radius: 50%; background: var(--orange-500); }
.order-column--ordered .order-column__head span { background: #5d91af; }
.order-column--received .order-column__head span { background: var(--green-600); }
.order-column__head b { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--muted); background: #dfe8e9; font-size: .68rem; }
.order-column__list { display: flex; min-height: 120px; flex-direction: column; gap: 11px; padding: 11px; border: 1px dashed var(--line-strong); border-radius: 14px; background: rgba(255,255,255,.35); }
.empty-column { padding: 26px 10px; color: #8a9b9f; font-size: .76rem; text-align: center; }
.order-card { padding: 15px; border: 1px solid var(--line); border-top: 3px solid var(--orange-500); border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(13,36,48,.05); }
.order-card--ordered { border-top-color: #5d91af; }
.order-card--received { border-top-color: var(--green-600); }
.order-card__head { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.order-card__head > strong { color: var(--navy-800); font-size: .78rem; }
.order-card__description { margin: 14px 0; color: var(--ink); font-size: .87rem; font-weight: 650; }
.order-card dl { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.order-card dl > div { display: flex; justify-content: space-between; gap: 10px; font-size: .7rem; }
.order-card dt { color: var(--muted); }
.order-card dd { margin: 0; color: var(--navy-700); text-align: right; }
.order-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.order-card__actions form { display: inline-flex; }
.move-buttons { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; }
.move-buttons button { width: 30px; height: 32px; border: 0; color: var(--navy-700); background: #fff; }
.move-buttons button + button { border-left: 1px solid var(--line-strong); }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.icon-button--danger { color: var(--red-600); }
.trash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { display: flex; min-width: 0; min-height: 144px; align-items: center; gap: 16px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); transition: .17s ease; }
.metric-card:hover { transform: translateY(-2px); border-color: #bcd0d3; }
.metric-card__icon { display: grid; width: 47px; height: 47px; flex: 0 0 auto; place-items: center; border-radius: 13px; color: var(--navy-700); background: #e9eff0; font-size: 1.3rem; }
.metric-card--aqua .metric-card__icon { color: var(--aqua-700); background: var(--aqua-100); }
.metric-card--orange .metric-card__icon { color: var(--orange-600); background: var(--orange-100); }
.metric-card > div { display: flex; min-width: 0; flex-direction: column; }
.metric-card small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.metric-card strong { margin: 1px 0; color: var(--navy-900); font-size: 1.8rem; line-height: 1.2; }
.metric-card div span { color: var(--aqua-700); font-size: .68rem; font-weight: 750; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); gap: 20px; }
.activity-list { display: flex; flex-direction: column; }
.activity-list > a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); }
.activity-list > a:first-child { border-top: 0; }
.activity-list__icon { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 10px; color: var(--aqua-700); background: var(--aqua-100); }
.activity-list__icon.is-orange { color: var(--orange-600); background: var(--orange-100); }
.activity-list > a > span:nth-child(2) { display: flex; flex-direction: column; }
.activity-list small { color: var(--muted); font-size: .7rem; }
.integration-card { position: relative; overflow: hidden; }
.integration-card::after { position: absolute; right: -55px; bottom: -65px; width: 170px; height: 170px; border: 26px solid rgba(86,202,187,.09); border-radius: 50%; content: ""; }
.integration-card__mark { display: grid; width: 48px; height: 48px; margin-bottom: 20px; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--aqua-600), var(--navy-700)); font-size: 1.25rem; font-weight: 850; }
.integration-card p:not(.eyebrow) { color: var(--muted); }
.integration-card .api-state { margin: 6px 0 20px; }
.integration-card .button { position: relative; z-index: 1; }

.empty-state { display: flex; min-height: 350px; flex-direction: column; align-items: center; justify-content: center; padding: 35px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: rgba(255,255,255,.65); text-align: center; }
.empty-state--compact { min-height: 230px; border: 0; background: transparent; }
.empty-state__icon { display: grid; width: 52px; height: 52px; margin-bottom: 14px; place-items: center; border-radius: 15px; color: var(--aqua-700); background: var(--aqua-100); font-size: 1.4rem; }
.empty-state p { max-width: 530px; color: var(--muted); }
.empty-inline { padding: 25px 13px; color: var(--muted); text-align: center; }

.public-page { min-height: 100vh; background: radial-gradient(circle at 8% 10%, rgba(86,202,187,.2), transparent 25%), radial-gradient(circle at 95% 90%, rgba(243,112,0,.12), transparent 24%), #eef4f4; }
.public-shell { width: min(1180px, calc(100% - 36px)); min-height: calc(100vh - 90px); margin: 0 auto; padding: 28px 0 45px; }
.public-brand { margin-bottom: 40px; }
.login-card { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 560px; overflow: hidden; border: 1px solid rgba(200,215,218,.8); border-radius: 28px; background: #fff; box-shadow: 0 28px 70px rgba(13,36,48,.15); }
.login-card__accent { position: relative; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: clamp(35px, 7vw, 78px); color: #fff; background: radial-gradient(circle at 20% 15%, rgba(86,202,187,.3), transparent 30%), linear-gradient(145deg, var(--navy-800), var(--navy-950)); }
.login-card__accent::before, .login-card__accent::after { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.login-card__accent::before { right: -100px; bottom: -120px; width: 400px; height: 400px; }
.login-card__accent::after { right: -15px; bottom: -30px; width: 230px; height: 230px; border-color: rgba(243,112,0,.3); }
.login-card__accent .eyebrow { color: var(--aqua-500); }
.login-card__accent h1 { max-width: 520px; color: #fff; font-size: clamp(2.1rem, 4vw, 3.3rem); }
.login-card__accent > p:not(.eyebrow) { max-width: 520px; color: rgba(255,255,255,.63); }
.login-card__features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 11px; margin-top: 38px; }
.login-card__features span { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.78); font-size: .8rem; }
.login-card__features i { width: 8px; height: 8px; border-radius: 50%; background: var(--aqua-500); box-shadow: 0 0 0 4px rgba(86,202,187,.12); }
.login-card__form { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 6vw, 70px); }
.login-card__form > p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }
.login-card__form h1, .login-card__form h2 { font-size: 2rem; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form .button { margin-top: 8px; }
.security-note { margin-top: 18px; color: #91a0a4; text-align: center; }
.check-line { flex-direction: row; align-items: center; font-weight: 600; }
.check-line input { width: 17px; min-height: 17px; }
.login-back { align-self: center; margin-top: 18px; }
.login-card--single { grid-template-columns: minmax(0, 650px); justify-content: center; min-height: 460px; }
.public-footer { display: flex; width: min(1180px, calc(100% - 36px)); flex-wrap: wrap; justify-content: space-between; gap: 5px 20px; margin: 0 auto; padding: 0 0 24px; color: #71858b; font-size: .72rem; }
.public-footer small { width: 100%; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.account-grid .card { margin: 0; }
.secret-box { display: flex; flex-direction: column; gap: 7px; margin: 18px 0; padding: 15px; border: 1px dashed var(--aqua-600); border-radius: 11px; background: var(--aqua-100); }
.secret-box span { color: var(--aqua-700); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.secret-box code { padding: 0; background: transparent; font-size: .92rem; font-weight: 800; word-break: break-all; }
.secret-box small { overflow-wrap: anywhere; color: var(--muted); font-size: .65rem; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--document { grid-template-columns: repeat(3, 1fr); }
  .line-editor__grid { grid-template-columns: repeat(4, 1fr); }
  .field-name { grid-column: span 2; }
  .form-grid--supplier, .form-grid--product { grid-template-columns: repeat(3, 1fr); }
  .form-grid--supplier .form-action, .form-grid--product .form-action { grid-column: 3; }
  .form-grid--settings { grid-template-columns: repeat(2, 1fr); }
  .form-grid--user { grid-template-columns: repeat(2, 1fr); }
  .order-form, .order-form--edit { grid-template-columns: repeat(2, 1fr); }
  .order-form .field-name { grid-column: span 2; }
  .order-board { grid-template-columns: repeat(3, 310px); }
  .supplier-row { grid-template-columns: repeat(2, 1fr); }
  .supplier-row .row-buttons { justify-content: flex-end; }
  .user-row { grid-template-columns: auto repeat(2, 1fr); }
  .user-row .button { justify-self: start; }
}

@media (max-width: 880px) {
  :root { --sidebar-width: 278px; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-toggle { display: block; }
  .topbar { justify-content: flex-start; gap: 14px; }
  .topbar__site { margin-left: auto; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .upload-card { align-items: stretch; flex-direction: column; }
  .upload-form { width: 100%; }
  .file-drop { flex: 1; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .document-actions { align-items: stretch; flex-direction: column; }
  .document-actions > div { width: 100%; }
  .login-card { grid-template-columns: 1fr; }
  .login-card__accent { min-height: 330px; }
  .login-card__features { margin-top: 20px; }
}

@media (max-width: 650px) {
  body { font-size: 14px; }
  .topbar { min-height: 63px; padding: 0 15px; }
  .topbar__site { display: none; }
  .content { min-height: calc(100vh - 100px); padding: 25px 14px 38px; }
  .app-footer { padding: 0 14px 18px; }
  .page-heading { margin-bottom: 21px; }
  .page-heading h1 { font-size: 2rem; }
  .page-actions { flex-wrap: wrap; }
  .card { padding: 18px 15px; border-radius: 15px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 125px; align-items: flex-start; flex-direction: column; gap: 9px; padding: 15px; }
  .metric-card__icon { width: 36px; height: 36px; border-radius: 10px; }
  .metric-card strong { font-size: 1.45rem; }
  .upload-card { padding: 19px 16px; }
  .upload-card__copy { align-items: flex-start; }
  .upload-form { align-items: stretch; flex-direction: column; }
  .file-drop { min-width: 0; }
  .list-toolbar, .filter-form { align-items: stretch; flex-direction: column; }
  .filter-form .search-box, .filter-form select, .filter-form .button { width: 100%; }
  .list-toolbar > .count-pill { align-self: flex-start; }
  .form-grid--document, .form-grid--supplier, .form-grid--product, .form-grid--settings, .form-grid--user { grid-template-columns: 1fr; }
  .form-grid--supplier .form-action, .form-grid--product .form-action, .field-name { grid-column: auto; }
  .line-editor__grid, .add-line__grid { grid-template-columns: repeat(2, 1fr); }
  .line-editor__grid .field-name, .add-line__grid .field-name { grid-column: span 2; }
  .total-check { grid-template-columns: 1fr; }
  .document-actions .button { flex: 1; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .supplier-row { grid-template-columns: 1fr; }
  .supplier-row .row-buttons { justify-content: flex-start; }
  .quick-links { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: auto 1fr; }
  .user-row label, .user-row .button, .user-row .toggle-label { grid-column: span 2; }
  .order-form, .order-form--edit { grid-template-columns: 1fr; }
  .order-form .field-name { grid-column: auto; }
  .trash-grid { grid-template-columns: 1fr; }
  .public-shell { width: min(100% - 22px, 1180px); padding-top: 16px; }
  .public-brand { margin: 0 7px 18px; }
  .public-brand .brand__mark { width: 29px; height: 29px; }
  .login-card { min-height: 0; border-radius: 18px; }
  .login-card__accent { min-height: 280px; padding: 30px 24px; }
  .login-card__accent h1 { font-size: 2rem; }
  .login-card__form { padding: 31px 23px; }
  .public-footer { width: calc(100% - 28px); flex-direction: column; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr; }
  .brand__copy small { display: none; }
  .line-editor__grid, .add-line__grid { grid-template-columns: 1fr; }
  .line-editor__grid .field-name, .add-line__grid .field-name { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
