* { box-sizing: border-box; }
html { color-scheme: light; background: var(--si3-color-surface-light); }
body { margin: 0; min-width: 320px; overflow-x: hidden; color: var(--si3-color-navy); font-family: var(--si3-font-family); line-height: 1.5; background-color: var(--si3-color-surface-light); background-image: linear-gradient(rgba(15,39,71,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(15,39,71,.035) 1px, transparent 1px); background-size: 48px 48px; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--si3-color-red); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 18px; top: -60px; z-index: 100; padding: 12px 18px; color: #fff; background: var(--si3-color-red); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 14px; }
.brand-lockup, .brand { display: flex; align-items: center; gap: 13px; }
.brand-symbol { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; transform: rotate(45deg); border: 1px solid rgba(248,250,252,.7); }
.brand-symbol b { transform: rotate(-45deg); color: var(--si3-color-white); font-size: 20px; }
.brand-wordmark { display: grid; line-height: 1; }
.brand-wordmark strong { color: var(--si3-color-white); font-size: 26px; letter-spacing: -.06em; }
.brand-wordmark strong span { color: var(--si3-color-red); }
.brand-wordmark small { margin-top: 6px; color: var(--si3-color-gray); font-size: 8px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }

.auth-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: var(--si3-color-navy-deep); background-image: linear-gradient(rgba(248,250,252,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(248,250,252,.035) 1px, transparent 1px); background-size: 48px 48px; }
.auth-screen[hidden] { display: none; }
.auth-card { width: min(650px, 100%); padding: clamp(28px, 5vw, 54px); color: var(--si3-color-white); background: var(--si3-color-navy); border: 1px solid rgba(248,250,252,.16); box-shadow: 0 25px 70px rgba(0,0,0,.26); }
.auth-card .brand-lockup { margin-bottom: 58px; }
.auth-card h1 { margin: 0 0 18px; font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; }
.auth-card h1 em { color: transparent; font-style: normal; -webkit-text-stroke: 1px var(--si3-color-gray); }
.auth-card > p:not(.eyebrow) { max-width: 520px; color: #c5cfda; line-height: 1.8; }
.auth-card .primary { width: 100%; margin: 22px 0 16px; }
.auth-card > small { display: block; color: var(--si3-color-gray); font-size: 11px; line-height: 1.6; text-align: center; }

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 18px 22px; color: var(--si3-color-white); background: var(--si3-color-navy-deep); border-right: 1px solid rgba(248,250,252,.12); }
.brand { padding: 2px 9px 38px; color: var(--si3-color-white); text-decoration: none; }
.sidebar nav { display: grid; gap: 2px; border-top: 1px solid rgba(248,250,252,.12); }
.nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 15px 12px; color: var(--si3-color-gray); border-bottom: 1px solid rgba(248,250,252,.08); text-decoration: none; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transition: color var(--si3-duration-fast), background var(--si3-duration-fast); }
.nav-link span { width: 20px; color: var(--si3-color-red); text-align: center; font-size: 15px; }
.nav-link:hover { color: #fff; background: var(--si3-color-surface-blue); }
.nav-link.active { color: #fff; background: var(--si3-color-navy); }
.nav-link.active::after { position: absolute; right: 0; width: 3px; height: 24px; background: var(--si3-color-red); content: ""; }
.nav-report-group { border-bottom: 1px solid rgba(248,250,252,.08); }
.nav-report-toggle { width: 100%; background: transparent; border: 0; cursor: pointer; text-align: left; }
.nav-report-toggle i { margin-left: auto; font-style: normal; font-size: 14px; }
.nav-report-options { background: rgba(7,24,43,.55); padding: 3px 0 5px 44px; }
.nav-report-option { display: block; padding: 9px 12px; color: var(--si3-color-gray); text-decoration: none; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nav-report-option:hover, .nav-report-option.active { color: #fff; }
.account-card { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 12px; border-top: 1px solid rgba(248,250,252,.15); }
.account-card strong, .account-card small { display: block; }
.account-card small { color: var(--si3-color-gray); font-size: 11px; }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; background: #38a878; box-shadow: 0 0 0 4px rgba(56,168,120,.12); }

main { width: 100%; max-width: 1800px; min-width: 0; margin: 0 auto; padding: 30px var(--si3-page-gutter) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 26px; padding-bottom: 24px; border-bottom: 1px solid var(--si3-color-line); }
.eyebrow { margin: 0 0 7px; color: var(--si3-color-text-muted); font-size: 9px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.eyebrow > span { margin-right: 9px; color: var(--si3-color-red); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 3vw, 48px); line-height: 1; letter-spacing: -.055em; }
h2 { margin-bottom: 8px; font-size: 19px; line-height: 1.25; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.sync-label { display: flex; align-items: center; gap: 8px; color: var(--si3-color-text-muted); font-size: 11px; }
.primary, .secondary, .priority-list button, .filter { min-height: 42px; padding: 12px 17px; border: 1px solid var(--si3-color-red); border-radius: 0; cursor: pointer; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transition: background var(--si3-duration-fast), transform var(--si3-duration-fast); }
.primary { color: #fff; background: var(--si3-color-red); }
.primary::after { content: "  ↗"; }
.primary:hover { background: var(--si3-color-red-hover); transform: translateY(-2px); }
.secondary, .priority-list button { color: var(--si3-color-navy); background: #fff; border-color: var(--si3-color-line); }
.secondary:hover, .priority-list button:hover { color: #fff; background: var(--si3-color-navy); border-color: var(--si3-color-navy); }
button:disabled { cursor: wait; opacity: .65; }

.view { display: none; }
.view.active { display: block; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px; background: var(--si3-color-line); border: 1px solid var(--si3-color-line); }
.metric, .panel { background: #fff; border: 1px solid var(--si3-color-line); box-shadow: 0 12px 34px rgba(7,24,43,.045); }
.metric { position: relative; min-height: 170px; padding: 24px; border: 0; }
.metric::before { position: absolute; top: 0; left: 24px; width: 34px; height: 2px; background: var(--si3-color-navy); content: ""; }
.metric.warning::before { background: var(--si3-color-red); }
.metric span, .metric small { display: block; color: var(--si3-color-text-muted); font-size: 10px; line-height: 1.6; }
.metric span { margin-top: 5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.metric strong { display: block; margin: 17px 0 5px; color: var(--si3-color-navy); font-size: clamp(28px, 3vw, 42px); letter-spacing: -.045em; }
.panel { padding: 24px; margin-bottom: 18px; }
.content-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--si3-color-line); }
.compact-panel-heading { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--si3-color-line); }
.compact-panel-heading h2 { font-size: 18px; }
.panel-heading a { color: var(--si3-color-navy); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-decoration: none; text-transform: uppercase; }
.panel-heading a::after { color: var(--si3-color-red); content: "  ↗"; }

.stock-chart { display: flex; align-items: center; justify-content: center; gap: 38px; padding: 18px 10px; }
.donut { position: relative; display: grid; place-items: center; width: 142px; height: 142px; background: conic-gradient(#2f9d78 0 70%, #e6ad4b 70% 91%, #e63946 91%); border-radius: 50%; }
.donut::before { position: absolute; width: 96px; height: 96px; background: white; border-radius: 50%; content: ""; }
.donut span { position: relative; text-align: center; }
.donut strong, .donut small { display: block; }
.donut strong { font-size: 28px; }
.donut small { color: var(--si3-color-text-muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.legend { display: grid; gap: 13px; min-width: 160px; }
.legend div { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.legend i { width: 8px; height: 8px; }
.healthy { background: #2f9d78; }
.low { background: #e6ad4b; }
.critical { background: var(--si3-color-red); }

.priority-list { display: grid; }
.priority-list > div { display: grid; grid-template-columns: 34px 1fr auto; gap: 13px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--si3-color-line); }
.priority-list > div:last-child { border: 0; }
.priority-list p { margin: 0; }
.priority-list strong, .priority-list small { display: block; }
.priority-list small { margin-top: 3px; color: var(--si3-color-text-muted); font-size: 11px; }
.priority-icon { display: grid; place-items: center; width: 32px; height: 32px; font-weight: 800; border: 1px solid currentColor; }
.priority-icon.red { color: var(--si3-color-red); background: #fff4f5; }
.priority-icon.amber { color: #9c650d; background: #fff8eb; }
.priority-icon.green { color: #237957; background: #f0faf6; }
.priority-list button { min-height: 34px; padding: 7px 10px; }

.table-wrap { overflow: auto; border: 1px solid var(--si3-color-line); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
th { padding: 11px 12px; color: #fff; background: var(--si3-color-navy); border-bottom: 1px solid var(--si3-color-line); text-align: left; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 13px 12px; border-bottom: 1px solid var(--si3-color-line); }
tbody tr:hover { background: var(--si3-color-surface-light); }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-thumb { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; color: #fff; background: var(--si3-color-navy); border-left: 2px solid var(--si3-color-red); font-weight: 700; }
.product-cell strong, .product-cell small { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.product-cell small { color: var(--si3-color-text-muted); }
.pill { display: inline-block; padding: 4px 7px; border: 1px solid currentColor; font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pill.healthy { color: #237957; background: #f0faf6; }
.pill.low { color: #97610e; background: #fff8eb; }
.pill.critical { color: #a92b35; background: #fff4f5; }

.data-toolbar { display: grid; grid-template-columns: max-content minmax(220px, 1fr) max-content max-content; align-items: center; gap: 14px; margin-bottom: 16px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 1px; }
.data-search { width: 100%; min-width: 0; padding: 9px 2px; color: var(--si3-color-navy); background: transparent; border: 0; border-bottom: 1px solid var(--si3-color-gray); border-radius: 0; }
.data-count { margin: 0; color: var(--si3-color-text-muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.inventory-view-actions { display: flex; align-items: center; gap: 6px; }
.view-toggle { min-height: 30px; padding: 6px 9px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); cursor: pointer; font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.view-toggle:hover { color: #fff; background: var(--si3-color-navy); }
.parts-toolbar { grid-template-columns: minmax(220px, 1fr) max-content max-content; }
.parts-table { min-width: 1700px; }
.parts-table th:nth-child(n+9), .parts-table td:nth-child(n+9) { width: 100px; text-align: center; }
.parts-description { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.parts-comment { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.parts-number { text-align: right; font-variant-numeric: tabular-nums; }
.parts-barcode { font-variant-numeric: tabular-nums; }
.status-select { min-width: 220px; padding: 7px 28px 7px 9px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); font-size: 10px; }
.status-select:disabled { cursor: wait; opacity: .55; }
.parts-help { margin: -4px 0 14px; color: var(--si3-color-text-muted); font-size: 10px; }
.package-quantity { width: 72px; padding: 7px 6px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); text-align: center; font: inherit; font-weight: 700; }
.package-quantity:focus { border-color: var(--si3-color-navy); outline: 2px solid rgba(7, 24, 43, .12); }
.package-quantity:disabled { cursor: wait; opacity: .55; }
.part-actions { display: flex; gap: 5px; }
.part-action { min-height: 28px; padding: 5px 8px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); cursor: pointer; font-size: 8px; font-weight: 700; text-transform: uppercase; }
.part-action:hover { color: #fff; background: var(--si3-color-navy); }
.part-action.delete:hover { background: var(--si3-color-red); border-color: var(--si3-color-red); }
.part-cell { width: 100%; min-width: 100px; padding: 7px 8px; color: var(--si3-color-navy); background: transparent; border: 1px solid transparent; font: inherit; }
.part-cell:hover { border-color: var(--si3-color-line); }
.part-cell:focus { background: #fff; border-color: var(--si3-color-navy); outline: 2px solid rgba(7,24,43,.1); }
.part-cell:disabled { cursor: wait; opacity: .55; }
.part-cell.description { min-width: 260px; }
.part-cell.comment { min-width: 180px; }
.part-cell.number { min-width: 105px; text-align: right; }
.draft-row { background: #f0faf6; }
.draft-row td { border-top: 2px solid #38a878; }
.catalog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.catalog-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 18px 0; }
.sat-config-form { display: grid; gap: 14px; margin: 18px 0; }
.sat-config-form label { display: grid; gap: 6px; color: var(--si3-color-text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sat-config-form input { width: 100%; padding: 10px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); font: inherit; box-sizing: border-box; }
.sat-config-form button { justify-self: start; }
.catalog-add input, .catalog-option input { width: 100%; padding: 10px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); font: inherit; }
.catalog-list { border-top: 1px solid var(--si3-color-line); }
.catalog-option { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--si3-color-line); }
.catalog-usage { color: var(--si3-color-text-muted); font-size: 9px; white-space: nowrap; }
.part-action:disabled { cursor: not-allowed; opacity: .38; }
.catalog-note { padding: 14px 18px; color: var(--si3-color-text-muted); background: #fff; border-left: 3px solid var(--si3-color-red); font-size: 10px; }
.save-state { color: var(--si3-color-text-muted); font-size: 9px; }
.filter { min-height: 34px; padding: 8px 13px; color: var(--si3-color-navy); background: #fff; border-color: var(--si3-color-line); }
.filter.active { color: #fff; background: var(--si3-color-navy); border-color: var(--si3-color-navy); }
.sort-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: inherit; background: transparent; border: 0; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.sort-button span { color: var(--si3-color-red); font-size: 12px; }
.sort-button:not(.active) { color: #c5cfda; }
.row-action { padding: 7px 10px; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); cursor: pointer; font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.row-action:hover { color: #fff; background: var(--si3-color-navy); }
.table-empty { padding: 32px; color: var(--si3-color-text-muted); text-align: center; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(7,24,43,.45); backdrop-filter: blur(2px); }
.drawer-backdrop[hidden], .product-drawer[hidden] { display: none; }
.product-drawer { position: fixed; top: 0; right: 0; z-index: 61; width: min(460px, 100%); height: 100vh; padding: 28px; overflow: auto; background: #fff; border-left: 1px solid var(--si3-color-line); box-shadow: -22px 0 60px rgba(7,24,43,.22); }
.drawer-open { overflow: hidden; }
.drawer-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--si3-color-line); }
.drawer-heading h2 { max-width: 340px; font-size: 24px; }
.drawer-close { width: 40px; height: 40px; flex: 0 0 auto; color: var(--si3-color-navy); background: #fff; border: 1px solid var(--si3-color-line); cursor: pointer; font-size: 24px; line-height: 1; }
.drawer-status { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 22px 0; }
.drawer-status > strong { font-size: 12px; }
.product-details div { display: grid; grid-template-columns: 1fr minmax(0, 1.4fr); align-items: start; }
.product-details dd { overflow-wrap: anywhere; }
.report-grid, .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.report-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-actions label { color: var(--si3-color-text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.report-actions .status-select { min-width: 190px; }
.report-caption { color: var(--si3-color-text-muted); }
.report-alert { margin: 0 0 14px; padding: 11px 14px; color: #8a5700; background: #fff8e8; border-left: 3px solid #b97800; font-size: 11px; font-weight: 700; }
.purchase-table { min-width: 980px; }
.purchase-table tfoot td { padding: 13px 12px; color: var(--si3-color-navy); background: #eef2f5; border-top: 2px solid var(--si3-color-navy); }
.purchase-table tfoot td:last-child { text-align: right; }
.purchase-table .row-action { margin-left: 8px; }
.relation-modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(7,24,43,.45); backdrop-filter: blur(2px); }
.relation-modal-backdrop[hidden], .relation-modal[hidden] { display: none; }
.relation-modal { position: fixed; top: 50%; left: 50%; z-index: 71; width: min(520px, calc(100% - 32px)); padding: 26px; transform: translate(-50%, -50%); background: #fff; box-shadow: 0 22px 60px rgba(7,24,43,.25); }
.relation-modal > p { margin: 18px 0 10px; color: var(--si3-color-text-muted); font-size: 12px; }
.relation-modal > label { display: block; margin-bottom: 6px; color: var(--si3-color-text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.relation-modal > .status-select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.report-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; }
.report-card button { grid-column: 2; justify-self: start; }
.report-card p, .report-card small { color: var(--si3-color-text-muted); }
.report-symbol { display: grid; place-items: center; width: 46px; height: 46px; color: #fff; background: var(--si3-color-navy); border-bottom: 2px solid var(--si3-color-red); font-size: 18px; font-weight: 700; }
.empty-state { padding: 45px; color: var(--si3-color-text-muted); text-align: center; }
.empty-state strong { color: var(--si3-color-navy); }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--si3-color-line); }
dt { color: var(--si3-color-text-muted); }
dd { margin: 0; font-weight: 700; text-align: right; }
.security-badge { display: inline-block; padding: 5px 8px; color: var(--si3-color-navy); background: #f0faf6; border-left: 2px solid #237957; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.icon-button { border: 0; background: transparent; font-size: 22px; }
.mobile-only { display: none; }

@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } .content-grid, .report-grid, .catalog-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .app-shell { display: block; } .sidebar { position: fixed; left: -285px; z-index: 10; width: 264px; box-shadow: 18px 0 50px rgba(7,24,43,.3); transition: left var(--si3-duration-fast); } .sidebar.open { left: 0; } main { padding: 22px; } .mobile-only { display: block; } .topbar { gap: 12px; } .topbar > div:nth-child(2) { margin-right: auto; } .sync-label { display: none; } .settings-grid { grid-template-columns: 1fr 1fr; } .data-toolbar { grid-template-columns: max-content minmax(180px, 1fr) max-content; } .parts-toolbar { grid-template-columns: minmax(180px, 1fr) max-content max-content; } .data-count { grid-column: 3; justify-self: end; } .parts-toolbar .data-count { grid-column: 3; } }
@media (max-width: 620px) { main { padding: 18px; } .topbar { align-items: flex-start; flex-wrap: wrap; } .top-actions { width: 100%; justify-content: flex-end; } .metric-grid, .settings-grid { grid-template-columns: 1fr; } .stock-chart { gap: 18px; } .donut { width: 112px; height: 112px; } .donut::before { width: 74px; height: 74px; } .legend { min-width: 130px; } .panel { padding: 18px; } .auth-card .brand-lockup { margin-bottom: 40px; } .data-toolbar, .parts-toolbar { grid-template-columns: 1fr; gap: 12px; } .data-search, .inventory-view-actions, .data-count, .parts-toolbar .data-count { grid-column: 1; } .data-count { justify-self: start; } .product-drawer { padding: 22px; } }
@media (max-width: 420px) { .top-actions .primary, .top-actions .secondary { padding: 10px; } .stock-chart { align-items: flex-start; flex-direction: column; } .report-card { grid-template-columns: 1fr; } .report-card button { grid-column: 1; } }
