:root {
  color-scheme: light;
  --nav: #201b43;
  --nav-deep: #171630;
  --nav-light: #b8b6d5;
  --ink: #24243b;
  --muted: #545b73;
  --soft: #676f8a;
  --canvas: #f5f6fc;
  --surface: #fff;
  --line: #e3e5f0;
  --accent: #5532b5;
  --accent-hover: #412391;
  --accent-bright: #6743cb;
  --accent-soft: #f0eaff;
  --accent-line: #ded1fb;
  --teal-dark: #085e51;
  --teal-soft: #dcf6ec;
  --blue-soft: #e8f0ff;
  --blue: #27539b;
  --amber: #79420e;
  --amber-soft: #fff0d1;
  --red: #a12746;
  --red-soft: #fdeaf0;
  --shadow: 0 2px 4px #22234b06, 0 7px 22px #30265d08;
  --sidebar-width: 230px;
  --radius: 16px;
  font-family: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
}

body:has(.nav-link[data-nav="docs"][aria-current="page"], .nav-link[data-nav="customers"][aria-current="page"]) {
  --accent: #2854a0;
  --accent-hover: #1d407e;
  --accent-bright: #3466b9;
  --accent-soft: #eaf1ff;
  --accent-line: #d3e0fb;
}

body:has(.nav-link[data-nav="purchases"][aria-current="page"]) {
  --accent: #a02c57;
  --accent-hover: #7d1f43;
  --accent-bright: #b43d6c;
  --accent-soft: #fceaf2;
  --accent-line: #f4d2e2;
}

body:has(.nav-link[data-nav="production"][aria-current="page"], .mobile-stopwatch) {
  --accent: #087066;
  --accent-hover: #07564e;
  --accent-bright: #107b70;
  --accent-soft: #e3f7f0;
  --accent-line: #c9eadf;
}

body:has(.nav-link[data-nav="products"][aria-current="page"]) {
  --accent: #9c4427;
  --accent-hover: #7c341c;
  --accent-bright: #ae4e2e;
  --accent-soft: #fff1e9;
  --accent-line: #f5dacb;
}

body:has(.nav-link[data-nav="warehouse"][aria-current="page"], .nav-link[data-nav="inventory"][aria-current="page"]) {
  --accent: #12647f;
  --accent-hover: #0c4e64;
  --accent-bright: #15758e;
  --accent-soft: #e5f5fb;
  --accent-line: #cbe7f1;
}

body:has(.nav-link[data-nav="settings"][aria-current="page"]) {
  --accent: #495378;
  --accent-hover: #364060;
  --accent-bright: #596689;
  --accent-soft: #eef1fa;
  --accent-line: #dce2f1;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-width: 300px; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--accent); }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
svg.icon { display: inline-block; width: 19px; height: 19px; flex: 0 0 auto; vertical-align: middle; }
.skip-link { position: fixed; z-index: 20; left: 1rem; top: -4rem; padding: 12px 20px; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .84rem; letter-spacing: -.02em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.text-danger { color: var(--red); }
.eyebrow { text-transform: uppercase; letter-spacing: .11em; font-size: .72rem; font-weight: 760; color: var(--accent); }
.stack { display: grid; gap: 18px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.grow { flex: 1; min-width: 0; }

.boot, .login-wrap { display: grid; min-height: 100svh; place-items: center; align-content: center; gap: 16px; padding: 24px; }
.boot-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(135deg, #724cdd, #37257d); color: #fff; font-size: 24px; font-weight: 750; box-shadow: 0 8px 18px #42299430; }
.login-wrap { background: radial-gradient(ellipse at 16% 12%, #e7dbff, transparent 49%), radial-gradient(ellipse at 90% 95%, #d9f7f0, transparent 45%), var(--canvas); }
.login-card { width: min(100%, 465px); padding: 36px; border: 1px solid var(--accent-line); background: var(--surface); border-radius: 23px; box-shadow: 0 18px 60px #3120601e; display: grid; gap: 19px; }
.login-card .brand-caption { color: var(--muted); }
.login-card h1 { font-size: 2rem; letter-spacing: -.05em; }
.login-card p { line-height: 1.55; }
.ms-mark { display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); gap: 2px; }
.ms-mark i:nth-child(1) { background: #f25022; } .ms-mark i:nth-child(2) { background: #7fba00; }
.ms-mark i:nth-child(3) { background: #00a4ef; } .ms-mark i:nth-child(4) { background: #ffb900; }

.app-shell { min-height: 100svh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: radial-gradient(ellipse at 0 0, #4d2e7a66, transparent 53%), linear-gradient(170deg, var(--nav), var(--nav-deep) 72%, #15243a);
  color: #fbfaff;
  display: flex;
  flex-direction: column;
  z-index: 8;
  box-shadow: 7px 0 28px #241a4316;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 21px 17px 20px; min-height: 84px; }
.sidebar .brand { border-bottom: 1px solid #f0e4ff18; }
.brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(148deg, #8055dc, #4e38a5 64%, #275a7a);
  color: #fff;
  border: 1px solid #b498fa90;
  box-shadow: inset 0 1px 0 #ffffff40, 0 4px 12px #0b0a2c4d;
  flex: 0 0 auto;
}
.brand-mark .icon { width: 25px; height: 25px; }
.brand-name { font-weight: 730; font-size: 1.25rem; letter-spacing: -.045em; line-height: 1.05; }
.brand-caption { font-size: .72rem; color: var(--nav-light); margin-top: 4px; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 15px 11px 14px; }
.nav-group + .nav-group { margin-top: 19px; }
.nav-label { color: var(--nav-light); font-size: .65rem; font-weight: 730; letter-spacing: .13em; margin: 0 10px 6px; text-transform: uppercase; }
.nav-link {
  --nav-hue: #cdb6ff;
  position: relative;
  border: 1px solid transparent;
  color: #e6e3f4;
  width: 100%;
  background: transparent;
  padding: 6px 9px;
  border-radius: 10px;
  min-height: 41px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 590;
}
.nav-link[data-nav="docs"], .nav-link[data-nav="customers"] { --nav-hue: #abc6ff; }
.nav-link[data-nav="purchases"] { --nav-hue: #ffb2d4; }
.nav-link[data-nav="production"] { --nav-hue: #8ef2d2; }
.nav-link[data-nav="products"] { --nav-hue: #ffcb9e; }
.nav-link[data-nav="warehouse"], .nav-link[data-nav="inventory"] { --nav-hue: #91e4fc; }
.nav-link[data-nav="settings"] { --nav-hue: #becbed; }
.nav-link + .nav-link { margin-top: 2px; }
.nav-link .icon {
  width: 27px;
  height: 27px;
  padding: 5px;
  border-radius: 8px;
  color: var(--nav-hue);
  background: color-mix(in srgb, var(--nav-hue) 13%, transparent);
}
.nav-link:hover { background: #ffffff12; color: #fff; }
.nav-link[aria-current="page"] {
  color: #fff;
  background: linear-gradient(95deg, color-mix(in srgb, var(--nav-hue) 27%, transparent), #ffffff0c);
  border-color: color-mix(in srgb, var(--nav-hue) 34%, transparent);
  font-weight: 700;
}
.nav-link[aria-current="page"]::before { content: ''; position: absolute; inset: 10px auto 10px -1px; width: 3px; border-radius: 4px; background: var(--nav-hue); }
.nav-link[aria-current="page"] .icon { color: #fff; background: color-mix(in srgb, var(--nav-hue) 25%, transparent); }
.nav-link:focus-visible, .sidebar-close:focus-visible { outline-color: #d5c4ff; outline-offset: 1px; }
.sidebar-foot { border-top: 1px solid #e3d4ff24; padding: 14px 16px 16px; display: grid; gap: 5px; color: var(--nav-light); background: #10152bcc; font-size: .75rem; }
.sidebar-foot .row { font-weight: 650; color: #e6eef9; }
.sidebar-foot .icon { width: 15px; height: 15px; color: #72d7bc; }
.sidebar-close, .nav-scrim, .mobile-toggle { display: none; }
.workspace {
  margin-left: var(--sidebar-width);
  min-height: 100svh;
  background: radial-gradient(ellipse at 92% 0, var(--accent-soft), transparent 50rem), var(--canvas);
}
.topbar { background: #ffffffed; min-height: 64px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px clamp(17px, 2.6vw, 40px); }
.breadcrumbs { color: var(--muted); display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.breadcrumbs strong { color: var(--ink); font-weight: 660; }
.breadcrumbs .icon { width: 15px; height: 15px; color: var(--soft); }
.top-controls { display: flex; align-items: center; gap: 12px; }
.tenant-picker { display: flex; align-items: center; gap: 7px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); padding: 0 8px 0 10px; color: var(--accent); min-height: 36px; }
.tenant-picker select { border: 0; color: var(--ink); background: transparent; min-width: 0; font-size: .84rem; font-weight: 630; padding: 5px 0; }
.tenant-picker .icon { width: 16px; height: 16px; }
.account { position: relative; }
.account > summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; }
.account > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: linear-gradient(145deg, var(--accent-bright), var(--accent)); border: 1px solid var(--accent); color: #fff; font-size: .74rem; font-weight: 750; }
.account-label { font-size: .78rem; font-weight: 650; }
.account-menu { z-index: 11; position: absolute; top: 45px; right: 0; width: 234px; padding: 14px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 32px #27224926; display: grid; gap: 10px; }
.account-menu .btn, .account-menu select { width: 100%; }
.training { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; background: linear-gradient(100deg, #ffedc6, #fff7e4); border-bottom: 1px solid #edcd8d; color: #633d12; padding: 7px clamp(17px, 2.6vw, 40px); font-size: .85rem; }
.training .row { gap: 10px; }
.training .icon { width: 16px; height: 16px; }
.training-tag { background: #81400c; border: 1px solid #6c340a; color: #fff9e9; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; font-weight: 780; letter-spacing: .085em; font-size: .68rem; padding: 4px 8px; white-space: nowrap; }
.training-side { white-space: nowrap; }
.main { max-width: 1590px; margin: 0 auto; padding: 27px clamp(17px, 2.6vw, 40px) 40px; display: grid; gap: 21px; }
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  padding: clamp(17px, 2vw, 26px);
  border: 1px solid var(--accent-line);
  border-radius: 19px;
  background: linear-gradient(116deg, #fff 10%, var(--accent-soft) 96%);
  box-shadow: var(--shadow);
}
.page-heading::before {
  content: '';
  position: absolute;
  z-index: -1;
  right: -22px;
  top: -136px;
  width: 292px;
  height: 292px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 0 0 24px color-mix(in srgb, var(--accent) 5%, transparent), 0 0 0 52px color-mix(in srgb, var(--accent) 3%, transparent);
  pointer-events: none;
}
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { font-size: clamp(1.9rem, 3vw, 2.65rem); letter-spacing: -.051em; line-height: 1.08; margin: 5px 0 7px; overflow-wrap: anywhere; }
.page-heading p { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading {
  color: #fff;
  background: radial-gradient(ellipse at 92% 110%, #9564ed66, transparent 51%), linear-gradient(115deg, #392365, #5635ab 64%, #643abf);
  border-color: #5639a9;
  box-shadow: 0 9px 25px #452d9330;
}
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading::before {
  border-color: #fff6;
  box-shadow: 0 0 0 24px #ffffff19, 0 0 0 52px #ffffff12;
}
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading :is(.eyebrow, p) { color: #f2eaff; }
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading .btn-primary {
  background: #fff;
  color: #4d289f;
  border-color: #fff;
  box-shadow: 0 4px 12px #23124735;
}
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading .btn-primary:hover { background: #f0e7ff; }
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .page-heading :focus-visible { outline-color: #eadbff; }
body:has(.nav-link[data-nav="overview"][aria-current="page"]) .date-chip { border-color: #ffffff59; background: #24153e59; color: #fff; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; max-width: 100%; }
.date-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; font-size: .83rem; min-height: 38px; }
.date-chip .icon { width: 15px; height: 15px; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 38px; border: 1px solid transparent; padding: 8px 13px; border-radius: 9px; color: var(--ink); background: transparent; font-size: .88rem; font-weight: 670; line-height: 1.25; text-decoration: none; white-space: nowrap; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(118deg, var(--accent-bright), var(--accent));
  border-color: var(--accent);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: #d9dceb; }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-hover); }
.btn-ghost { color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); }
.btn-icon { min-width: 36px; min-height: 36px; padding: 7px; }
.btn-danger { color: var(--red); background: var(--red-soft); }
.btn-danger:hover:not(:disabled) { border-color: #de9fa7; }
.link-button { background: none; border: none; padding: 0; color: var(--accent); font-weight: 680; text-align: left; }
.link-button:hover { text-decoration: underline; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 18px 19px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; }
.card-head h2, .card-pad h2 { font-size: 1.14rem; font-weight: 745; letter-spacing: -.028em; }
.card-head p, .card-pad > p { margin-top: 4px; font-size: .84rem; line-height: 1.45; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat-card {
  --stat-ink: #5433a8;
  --stat-tint: #f1ebff;
  --stat-edge: #dfd2fb;
  text-align: left;
  width: 100%;
  padding: 15px 15px 13px;
  color: var(--ink);
  background: linear-gradient(152deg, var(--stat-tint), #fff 82%);
  border-color: var(--stat-edge);
  border-top: 3px solid color-mix(in srgb, var(--stat-ink) 58%, var(--stat-edge));
  display: grid;
  gap: 7px;
}
.stat-card:nth-child(2) { --stat-ink: #25549b; --stat-tint: #e9f1ff; --stat-edge: #cedffb; }
.stat-card:nth-child(3) { --stat-ink: #82470d; --stat-tint: #fff3dd; --stat-edge: #f3dfb4; }
.stat-card:nth-child(4) { --stat-ink: #0a6657; --stat-tint: #e4f7ef; --stat-edge: #c8e9dc; }
.stat-card:hover { border-color: var(--stat-ink); box-shadow: 0 5px 15px color-mix(in srgb, var(--stat-ink) 15%, transparent); }
.stat-top { display: flex; justify-content: space-between; gap: 7px; align-items: center; }
.stat-top .arrow { color: var(--stat-ink); width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: #ffffffbd; }
.tile-icon { border-radius: 10px; display: inline-grid; place-items: center; width: 33px; height: 33px; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.tile-icon .icon { width: 17px; height: 17px; }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-slate { background: #eef1f8; color: #485773; }
.stat-card .tile-icon { background: #ffffffd9; border: 1px solid var(--stat-edge); color: var(--stat-ink); width: 37px; height: 37px; }
.stat-value { color: var(--stat-ink); font-size: clamp(1.45rem, 2.4vw, 1.95rem); font-weight: 775; letter-spacing: -.055em; line-height: 1.12; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { font-weight: 680; font-size: .9rem; }
.stat-note { font-size: .76rem; color: var(--muted); }
.process { padding: 16px 18px 17px; }
.process-header { margin-bottom: 13px; }
.process-header h2 { font-size: 1.09rem; letter-spacing: -.02em; }
.process-header p { color: var(--muted); font-size: .83rem; margin-top: 3px; }
.process-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.process-step {
  --step-ink: #5634a6;
  --step-tint: #f4eeff;
  --step-edge: #e5d9fa;
  border: 1px solid var(--step-edge);
  border-radius: 10px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 49px;
  padding: 7px;
  background: var(--step-tint);
  text-align: left;
}
.process-step:nth-child(2) { --step-ink: #2656a0; --step-tint: #edf3ff; --step-edge: #d9e5fc; }
.process-step:nth-child(3) { --step-ink: #10667b; --step-tint: #eaf7fc; --step-edge: #d3edf4; }
.process-step:nth-child(4) { --step-ink: #126758; --step-tint: #e9f8f1; --step-edge: #d3eee1; }
.process-step:nth-child(5) { --step-ink: #8a3d16; --step-tint: #fff1e3; --step-edge: #f6deca; }
.process-step:hover { border-color: var(--step-ink); }
.process-step .tile-icon { width: 29px; height: 29px; background: #fff; color: var(--step-ink); }
.process-step .tile-icon .icon { width: 15px; height: 15px; }
.process-step strong { font-size: .76rem; overflow-wrap: anywhere; }
.process-step span.small { color: var(--muted); font-size: .68rem; }
.process-step .process-arrow { color: var(--step-ink); margin-left: auto; width: 13px; height: 13px; }
.dash-panels { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.stock-alert { display: flex; gap: 10px; align-items: center; padding: 11px 17px; border-top: 1px solid var(--line); }
.stock-alert strong { font-size: .88rem; }
.stock-alert .tile-icon { background: var(--amber-soft); color: var(--amber); }
.stock-alert .quantity { text-align: right; font-variant-numeric: tabular-nums; }
.stock-alert .quantity strong { color: var(--amber); }
.quick-scan {
  --quick-ink: #12647f;
  --quick-tint: #eaf7fc;
  --quick-line: #d3eaf3;
  margin: 9px 16px;
  border: 1px solid var(--quick-line);
  padding: 6px 9px 6px 11px;
  border-radius: 10px;
  background: var(--quick-tint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
}
.quick-scan:last-child { margin-bottom: 14px; }
.quick-scan:has([data-action="purchase-request"]) { --quick-ink: #9b3258; --quick-tint: #fdecf3; --quick-line: #f3d9e5; }
.quick-scan:has([data-action="production-list"]) { --quick-ink: #11695b; --quick-tint: #e8f8f1; --quick-line: #d2eee3; }
.quick-scan :is(.icon, .btn-ghost) { color: var(--quick-ink); }
.quick-scan .btn-ghost:hover:not(:disabled) { background: #ffffffc9; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 13px 16px; }
.filters .spacer { flex: 1; }
.search { display: flex; align-items: center; gap: 8px; width: min(100%, 320px); min-height: 38px; padding: 0 11px; border: 1px solid #d9dceb; border-radius: 10px; color: var(--accent); background: #fcfcff; }
.search:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-line); }
.search .icon { width: 16px; height: 16px; }
.search input { border: 0; outline: none; width: 100%; min-width: 0; color: var(--ink); padding: 7px 0; background: transparent; }
.tabs { display: flex; gap: 4px; align-items: center; overflow-x: auto; padding: 11px 14px 0; }
.tab { border: 1px solid transparent; border-radius: 9px; background: none; color: var(--muted); white-space: nowrap; min-height: 34px; padding: 6px 10px; font-size: .83rem; font-weight: 650; }
.tab:hover { background: #f2f3fa; }
.tab[aria-pressed="true"] { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent-line); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; }
.data-table th, .data-table td { padding: 10px 13px; }
.data-table th:first-child, .data-table td:first-child { padding-left: 17px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 17px; }
.data-table thead th { background: color-mix(in srgb, var(--accent-soft) 58%, #f9faff); border-block: 1px solid var(--line); color: var(--accent-hover); font-size: .74rem; font-weight: 710; white-space: nowrap; }
.data-table tbody td { border-bottom: 1px solid #edf0f7; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 33%, #fff); }
.data-table td .col { gap: 2px; }
.data-table tfoot td { border-top: 1px solid var(--line); font-weight: 700; }
.table-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-foot { padding: 10px 17px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions .btn { min-width: 32px; min-height: 32px; padding: 6px; }
.doc-cell { display: flex; align-items: center; gap: 8px; }
.doc-cell .tile-icon { width: 29px; height: 29px; }
.doc-cell .tile-icon .icon { width: 15px; height: 15px; }
.doc-cell strong { white-space: nowrap; font-size: .84rem; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; white-space: nowrap; background: #edf0f7; color: #4c5873; font-size: .74rem; font-weight: 710; line-height: 1.25; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-good { background: var(--teal-soft); color: var(--teal-dark); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 28px 18px; }
.empty p { max-width: 400px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.empty h3 { font-size: 1rem; }
.empty .btn { margin-top: 4px; }
.notice { border: 1px solid var(--accent-line); border-radius: 10px; padding: 10px 12px; display: flex; align-items: start; gap: 8px; background: var(--accent-soft); color: var(--accent-hover); line-height: 1.43; font-size: .87rem; }
.notice .icon { width: 16px; height: 16px; margin-top: 2px; }
.notice-warn { background: #fff5df; border-color: #eed398; color: #69400c; }
.notice-error { background: var(--red-soft); border-color: #eac1c7; color: #822c36; }
.notice[hidden] { display: none; }

.mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini-grid > div { padding: 12px 14px; background: color-mix(in srgb, var(--accent-soft) 66%, #fff); border: 1px solid var(--accent-line); border-radius: 11px; display: grid; gap: 4px; min-width: 0; }
.mini-grid > div:nth-child(2) { background: #f1eeff; border-color: #e4defa; }
.mini-grid > div:nth-child(3) { background: #eaf8f2; border-color: #d5ebe2; }
.mini-grid strong { font-size: 1.13rem; overflow-wrap: anywhere; }
.count-head { display: grid; gap: 13px; padding: 16px 17px; }
.count-head .badge { margin-left: 5px; }
progress { width: 100%; height: 8px; border: 0; border-radius: 20px; background: var(--accent-soft); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--accent-soft); border-radius: 20px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 20px; }
.scan-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border: 1px solid var(--accent-line); border-radius: 11px; padding: 11px; background: var(--accent-soft); }
.scan-panel .manual-code { display: flex; gap: 7px; align-items: center; flex: 1; }
.manual-code input { flex: 1; min-width: 130px; }
.template-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(270px, .85fr); gap: 15px; align-items: start; }
.template-layout .card { padding: 17px; }
.template-layout h2 { margin-bottom: 10px; }
.template-layout p { line-height: 1.5; }
.template-tokens { margin: 10px 0 0; padding-left: 17px; line-height: 1.85; }
.template-tokens code { color: var(--teal-dark); }
.template-example { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 10px; background: var(--accent-soft); font-size: .88rem; line-height: 1.5; margin-top: 11px; }
.location-list { display: grid; gap: 7px; }
.location-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; background: var(--accent-soft); border-radius: 9px; }

dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--accent-line); border-radius: 19px; width: min(650px, calc(100% - 26px)); padding: 0; max-height: min(91svh, 950px); box-shadow: 0 18px 65px #1a15395c; overflow: auto; }
dialog.wide { width: min(930px, calc(100% - 26px)); }
dialog::backdrop { background: #17152ba8; backdrop-filter: blur(2px); }
.modal-head { position: sticky; top: 0; background: linear-gradient(105deg, #fff, var(--accent-soft)); z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--accent-line); padding: 13px 17px; }
.modal-head h2 { font-size: 1.21rem; letter-spacing: -.03em; }
.modal-body { display: grid; gap: 15px; padding: 17px; }
.modal-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding: 11px 17px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.modal-foot .lead { margin-right: auto; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 13px; }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.field.span { grid-column: 1/-1; }
.field > span:first-child { font-size: .8rem; font-weight: 690; }
.field .help { font-size: .76rem; color: var(--muted); }
input.control, select.control, textarea.control, .manual-code input { border: 1px solid #d6daea; border-radius: 9px; padding: 8px 9px; min-height: 38px; color: var(--ink); background: #fcfcff; width: 100%; }
input.control:read-only, select.control:disabled, textarea.control:read-only { background: #f3f3fa; }
textarea.control { resize: vertical; min-height: 68px; line-height: 1.42; }
.filters select.control { width: auto; max-width: 100%; }
.checkbox { display: flex; align-items: center; gap: 7px; }
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }
.line-grid { display: grid; grid-template-columns: minmax(130px, 2.2fr) minmax(68px, .7fr) minmax(75px, .8fr) minmax(69px, .6fr) 34px; gap: 6px; align-items: end; }
.line-grid + .line-grid { margin-top: 7px; }
.line-grid .control { padding-inline: 6px; }
.line-grid .field > span:first-child { font-size: .74rem; }
.purchase-line { display: grid; grid-template-columns: minmax(130px, 1.4fr) minmax(130px, 1.35fr) minmax(76px, .65fr) minmax(70px, .65fr) 34px; gap: 7px; align-items: end; }
.purchase-line + .purchase-line { margin-top: 9px; }
.purchase-line .field > span:first-child { font-size: .75rem; }
.production-line { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(75px, 1fr) 34px; gap: 8px; align-items: end; }
.production-line + .production-line { margin-top: 8px; }
.clock-numbers { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.active-work, .timer-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; }
.active-work { border-color: #c5e7d9; border-left: 4px solid #2d9b84; background: linear-gradient(105deg, #e3f8ed, #f8fdfb); }
.timer-panel {
  margin: 0 16px 13px;
  padding: 13px;
  border: 1px solid #1d645e;
  border-radius: 13px;
  color: #fff;
  background: radial-gradient(ellipse at 100% 105%, #27766a, transparent 68%), linear-gradient(120deg, #183a4f, #0b5452);
}
.timer-panel .muted { color: #d8f2ec; }
.timer-panel .tile-icon { background: #ffffff20; color: #c4ffe5; }
.timer-panel .btn-primary { color: #154139; background: #c8fae5; border-color: #c8fae5; box-shadow: none; }
.timer-panel .btn-primary:hover:not(:disabled) { background: #e8fff4; }
.timer-panel .btn-secondary { color: #fff; background: #ffffff15; border-color: #ffffff6a; }
.timer-panel .btn-secondary:hover:not(:disabled) { background: #ffffff26; border-color: #fff; }
.timer-panel :focus-visible { outline-color: #b1fadd; }
.timer-value { font-size: clamp(1.3rem, 4vw, 1.95rem); color: #fff; line-height: 1.15; }
.stopwatch-qr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  border-color: #c9eadf;
  background: linear-gradient(115deg, #fff, #eaf8f1);
}
.stopwatch-qr h2 { font-size: 1.12rem; }
.stopwatch-qr p { line-height: 1.5; }
.stopwatch-code { border: 1px solid #d3e7e1; padding: 5px; border-radius: 10px; background: #fff; line-height: 0; }
.stopwatch-code svg { width: 104px; height: 104px; }
.paper-stopwatch { display: flex; align-items: center; gap: 9px; margin-top: 12px; break-inside: avoid; font-size: .8rem; }
.paper-stopwatch svg { width: 28mm; height: 28mm; flex: 0 0 auto; }
.timer-dock {
  position: fixed;
  z-index: 6;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  width: min(330px, calc(100% - 32px));
  padding: 11px;
  border: 1px solid #c6e8dc;
  border-radius: 15px;
  background: #f5fcf9;
  box-shadow: 0 10px 32px #133f4240;
}
.timer-dock .tile-icon { color: #116859; background: #e3f7ef; }
.dock-clock { color: #125f54; font-size: 1.23rem; }
.timer-dock .btn { min-height: 34px; }
body:has(.timer-dock) .main { padding-bottom: calc(135px + env(safe-area-inset-bottom)); }
body:has(.timer-dock) #toasts { bottom: calc(123px + env(safe-area-inset-bottom)); }
.mobile-stopwatch {
  min-height: 100svh;
  background: radial-gradient(ellipse at 15% 10%, #d9f6ec, transparent 42rem), var(--canvas);
}
.stopwatch-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; max-width: 860px; margin: 0 auto; padding: 14px 17px 0; }
.stopwatch-head .brand-caption { color: var(--muted); }
.stopwatch-stage { max-width: 480px; margin: 0 auto; padding: clamp(20px, 6svh, 54px) 15px max(24px, env(safe-area-inset-bottom)); }
.stopwatch-face { display: grid; gap: 12px; padding: 17px; border-color: #c9eadf; }
.stopwatch-face h1 { font-size: clamp(1.4rem, 6vw, 2rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.stopwatch-face > p { overflow-wrap: anywhere; }
.stopwatch-display {
  display: grid;
  gap: 11px;
  padding: 13px;
  color: #f2fff9;
  background: linear-gradient(120deg, #173c50, #0b5852);
  border-radius: 13px;
}
.stopwatch-display > strong { font-size: clamp(2.15rem, 10vw, 3.3rem); line-height: 1.08; }
.stopwatch-buttons .btn { min-height: 44px; flex: 1; }
.line-editor { border: 1px solid var(--accent-line); border-radius: 11px; padding: 10px; background: color-mix(in srgb, var(--accent-soft) 24%, #fff); }
.line-editor > .row { margin-bottom: 7px; }
.editor-total { padding: 8px 11px; background: var(--accent-soft); border-radius: 9px; text-align: right; font-variant-numeric: tabular-nums; }
.doc-link { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 55%, #fff); }
.doc-link .icon { width: 15px; height: 15px; }
.scanner { background: linear-gradient(135deg, #1d2745, #174659); border-radius: 12px; min-height: 190px; display: grid; place-items: center; position: relative; overflow: hidden; color: #ecf8fc; }
.scanner video { width: 100%; max-height: min(50svh, 395px); object-fit: contain; display: none; }
.scanner.live video { display: block; }
.scanner .scan-placeholder { padding: 18px; text-align: center; }
.scanner.live .scan-placeholder { display: none; }
.scan-frame { display: none; position: absolute; width: min(56%, 220px); aspect-ratio: 1; border: 2px solid #83edd0; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 80vmax #08152136; }
.scanner.live .scan-frame { display: block; }
.photo-label { cursor: pointer; }
.photo-label:focus-within { outline: 3px solid var(--accent-bright); outline-offset: 3px; }
.qr-labels { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 15px; }
.qr-label { display: grid; justify-items: center; align-content: start; gap: 4px; border: 1px solid #b6c1ca; border-radius: 7px; padding: 8px; width: 146px; background: #fff; text-align: center; break-inside: avoid; color: #142437; }
.qr-label svg { width: 101px; height: 101px; background: #fff; }
.qr-label .qr-warning { font-size: .63rem; color: #884019; font-weight: 780; letter-spacing: .06em; }
.qr-label strong { overflow-wrap: anywhere; font-size: .82rem; }
#toasts { z-index: 18; position: fixed; right: 17px; bottom: 17px; display: grid; gap: 7px; width: min(385px, calc(100% - 34px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-radius: 11px; color: #fff; background: #18554c; box-shadow: 0 7px 25px #1b4c4640; font-weight: 630; }
.toast.error { background: #94243e; }

#print-root { display: none; }
.paper-preview { border-radius: 11px; overflow: auto; background: #eceef8; padding: 9px; }
.paper { position: relative; isolation: isolate; overflow: hidden; color: #172739; background: #fff; padding: 20px; min-height: 260px; }
.paper-content { position: relative; z-index: 1; overflow-wrap: anywhere; }
.watermark { position: absolute; z-index: 0; pointer-events: none; left: 50%; top: 51%; transform: translate(-50%, -50%) rotate(-30deg); color: #a6441833; font-size: clamp(2.1rem, 7vw, 4.6rem); font-weight: 900; letter-spacing: .08em; white-space: nowrap; line-height: 1; }
.print-warning { display: inline-block; border: 2px solid #a75125; color: #8e401c; padding: 3px 8px; font-size: .79rem; font-weight: 850; letter-spacing: .105em; margin: 0 0 11px; }
.paper h1 { font-size: 1.75rem; margin: 0 0 6px; line-height: 1.15; letter-spacing: -.035em; }
.paper h2 { font-size: 1rem; }
.paper-head { display: flex; justify-content: space-between; align-items: start; gap: 15px; padding-bottom: 12px; margin-bottom: 13px; border-bottom: 1px solid #cbd4dc; }
.paper-head p, .paper p { margin-top: 5px; line-height: 1.45; }
.paper-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 11px 0; font-size: .88rem; }
.paper-parties p { white-space: pre-line; }
.print-meta { text-align: right; font-size: .82rem; }
.paper-copy { white-space: pre-wrap; font-size: .87rem; margin: 10px 0; line-height: 1.45; }
.print-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 10px; }
.print-table th, .print-table td { padding: 6px 4px; border-bottom: 1px solid #c9d2dc; text-align: left; }
.print-table .right { text-align: right; }
.print-table thead th { font-weight: 730; }
.print-total { width: min(100%, 285px); margin: 8px 0 10px auto; display: grid; gap: 4px; font-size: .85rem; }
.print-total .row { justify-content: space-between; }
.print-total .total-row { border-top: 1px solid #a9b6c2; font-weight: 760; padding-top: 5px; }
.print-footer { border-top: 1px solid #c9d2dc; margin-top: 13px; padding-top: 7px; font-size: .75rem; }
.noscript { margin: 20px; }

@media (max-width: 1190px) {
  :root { --sidebar-width: 194px; }
  .process-step .process-arrow { display: none; }
  .dash-panels { grid-template-columns: minmax(0, 1.65fr) minmax(238px, 1fr); }
  .data-table th, .data-table td { padding-inline: 9px; }
}
@media (max-width: 1000px) {
  .dash-panels { grid-template-columns: 1fr; }
  .account-label { display: none; }
  .process-step { align-items: start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-101%); transition: transform .18s ease-out; width: min(265px, 85vw); }
  .sidebar:not(.is-open) { visibility: hidden; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar .sidebar-close { display: inline-flex; color: #fff; margin-left: auto; }
  .sidebar.is-open + .nav-scrim { display: block; position: fixed; inset: 0; background: #0818278c; z-index: 7; border: none; }
  .mobile-toggle { display: inline-flex; }
  .workspace { margin-left: 0; }
  .topbar { min-height: 57px; }
  .breadcrumbs > span:first-of-type, .breadcrumbs > .chevron { display: none; }
  .top-controls { gap: 8px; }
  .training-side { display: none; }
  .training { min-height: 43px; }
  .main { padding-top: 20px; gap: 15px; }
  .page-heading { border-radius: 16px; }
  .page-heading::before { right: -115px; top: -174px; }
  .process-steps { grid-template-columns: repeat(5, minmax(105px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .purchase-line { grid-template-columns: repeat(2, minmax(0, 1fr)) 34px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .purchase-line .field:nth-child(-n+2) { grid-column: 1/-1; }
  .template-layout { grid-template-columns: 1fr; }
  .date-chip { display: none; }
}
@media (max-width: 480px) {
  .page-heading { align-items: start; flex-direction: column; gap: 12px; }
  .heading-actions { justify-content: flex-start; }
  .topbar { padding-inline: 10px; gap: 4px; }
  .topbar .breadcrumbs { gap: 4px; }
  .breadcrumbs strong { display: none; }
  .tenant-picker { padding-inline: 6px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 10px; gap: 5px; }
  .process { padding: 12px; }
  .card-head { padding: 12px; flex-wrap: wrap; }
  .timer-panel { margin-inline: 10px; }
  .stopwatch-qr { grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px; }
  .stopwatch-code svg { width: 86px; height: 86px; }
  .stopwatch-qr > .btn { grid-column: 1/-1; }
  .mini-grid { gap: 6px; }
  .mini-grid > div { padding: 8px; }
  .field-grid { gap: 9px; }
  .modal-body { padding: 12px; }
  .modal-head, .modal-foot { padding-inline: 12px; }
  .line-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) 33px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
  .line-grid .field:first-child { grid-column: 1/-1; }
  .paper { padding: 11px; }
  .paper-parties { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { background: #fff !important; overflow: visible !important; min-width: 0; }
  body > :not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .paper { overflow: visible; padding: 0; min-height: 0; }
  .watermark { position: fixed; top: 49%; left: 50%; font-size: 47pt; color: #bc7958; opacity: .38; }
  .print-warning { color: #7c3512; }
  .paper, .print-warning, .watermark, .qr-label { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-table thead { display: table-header-group; }
  .print-table tr, .paper-head, .paper-parties, .print-total { break-inside: avoid; }
}
