@font-face { font-family: "IBM Plex Sans"; src: url("../../assets/fonts/ibm-plex-sans.woff2") format("woff2"); font-weight: 100 700; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../../assets/fonts/ibm-plex-sans-rupee.woff2") format("woff2"); font-weight: 100 700; font-display: swap; unicode-range: U+20B9; }

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e0e3e9;
  --line-2: #cfd4dc;
  --text: #161a22;
  --text-2: #4d5666;
  --text-3: #5f6878;
  --brand: #0f6e6e;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1f0;
  --bar: #0f6e6e;
  --bar-muted: #9ccfcc;
  --target: #c2410c;
  --s-done: #067647;  --s-done-bg: #e7f6ec;
  --s-run: #175cd3;   --s-run-bg: #e9f0fd;
  --s-late: #b42318;  --s-late-bg: #fdecea;
  --s-wait: #475467;  --s-wait-bg: #eef0f3;
  --s-hold: #93370d;  --s-hold-bg: #fdf1e6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --focus: #175cd3;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1217;
  --surface: #161a21;
  --surface-2: #1d222b;
  --line: #262c36;
  --line-2: #343b47;
  --text: #e7eaef;
  --text-2: #aab2bf;
  --text-3: #959eac;
  --brand: #4cc0bb;
  --brand-ink: #0b1414;
  --brand-soft: #14302f;
  --bar: #4cc0bb;
  --bar-muted: #2a5c5a;
  --target: #fb923c;
  --s-done: #6fd69a;  --s-done-bg: #11291c;
  --s-run: #8db8ff;   --s-run-bg: #15233d;
  --s-late: #ff8f85;  --s-late-bg: #361614;
  --s-wait: #b4bcc8;  --s-wait-bg: #232832;
  --s-hold: #f5b979;  --s-hold-bg: #33230f;
  --shadow: none;
  --focus: #8db8ff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body, h1, h2, h3, p, ul, figure, dl, dd { margin: 0; }
ul { list-style: none; padding: 0; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; }

body {
  background: var(--bg); color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", Roboto, sans-serif; font-size: 0.9375rem; line-height: 1.5;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -5rem; z-index: 99; background: var(--brand); color: var(--brand-ink); padding: 0.75rem 1rem; font-weight: 600; border-radius: 6px; }
.skip:focus { top: 1rem; }
.num { text-align: right; }

.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - 2.5rem); }
.main-col, .content > * { min-width: 0; }
@media (min-width: 62em) {
  .app { grid-template-columns: 15rem minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

/* sidebar */
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 1.25rem; }
.side__brand { display: flex; align-items: center; gap: 0.625rem; padding: 0.25rem 0.5rem; }
.side__brand svg { width: 2rem; height: 2rem; flex: none; }
.side__brand rect { fill: var(--brand); }
.side__brand path { fill: var(--brand-ink); }
.side__co { font-weight: 600; line-height: 1.25; }
.side__sub { font-size: 0.8125rem; color: var(--text-3); }
.side__nav a { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border-radius: 6px; text-decoration: none; color: var(--text-2); font-weight: 500; min-height: 2.5rem; }
.side__nav a:hover { background: var(--surface-2); color: var(--text); }
.side__nav a[aria-current="true"] { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.side__nav svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; flex: none; }
.side__nav a[aria-current="true"] svg { stroke: var(--brand); }
.side__foot { margin-top: auto; font-size: 0.8125rem; color: var(--text-3); padding: 0 0.5rem; }

@media (max-width: 61.99em) {
  .side { position: sticky; top: 0; z-index: 10; flex-direction: row; align-items: center; padding: 0.5rem 0.75rem; border-right: 0; border-bottom: 1px solid var(--line); gap: 0.75rem; overflow-x: auto; }
  .side__brand div, .side__foot { display: none; }
  .side__brand { padding: 0; }
  .side__nav { display: flex; gap: 0.25rem; }
  .side__nav a { white-space: nowrap; padding-inline: 0.625rem; }
}
@media (max-width: 30em) { .side__nav svg { display: none; } }

/* top bar */
.bar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 0; }
.crumbs { font-size: 0.8125rem; color: var(--text-3); }
.crumbs span { margin-inline: 0.25rem; }
h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.bar__tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.select {
  appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%23727b8a' stroke-width='1.8'/%3E%3C/svg%3E") right 0.5rem center / 1.125rem no-repeat;
  border: 1px solid var(--line-2); border-radius: 6px; padding: 0.5rem 2.25rem 0.5rem 0.75rem; min-height: 2.5rem; font-weight: 500; box-shadow: var(--shadow);
}
.icon-btn { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.5rem 0.75rem; min-height: 2.5rem; min-width: 2.5rem; justify-content: center; cursor: pointer; font-weight: 500; box-shadow: var(--shadow); }
.icon-btn:hover, .select:hover { border-color: var(--text-3); }
.icon-btn svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
#theme[aria-pressed="true"] svg { fill: currentColor; }
.avatar { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 0.875rem; }
@media (max-width: 30em) { .theme__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }

/* content */
.content { padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 3rem; display: grid; gap: 1.25rem; }
.noscript { background: var(--s-hold-bg); color: var(--s-hold); padding: 1rem; border-radius: 6px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.kpi { background: var(--surface); padding: 1rem 1.25rem; display: grid; gap: 0.25rem; align-content: start; }
.kpi__label { font-size: 0.8125rem; color: var(--text-2); font-weight: 500; }
.kpi__value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.kpi__meta { font-size: 0.8125rem; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }
.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 0.125rem; }
.delta--up { color: var(--s-done); }
.delta--down { color: var(--s-late); }
.spark { width: 100%; height: 2rem; margin-top: 0.5rem; }
.spark path { fill: none; stroke: var(--brand); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .spark__area { fill: var(--brand-soft); stroke: none; }

.cols { display: grid; gap: 1.25rem; }
@media (min-width: 75em) { .cols { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.125rem 1.25rem 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1rem; }
.panel__head--wrap { flex-wrap: wrap; align-items: end; }
.panel h2 { font-size: 1.0625rem; font-weight: 600; }
.panel__sub { font-size: 0.8125rem; color: var(--text-3); }
.panel__h3 { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); margin: 1.25rem 0 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }

.legend { display: flex; gap: 1rem; font-size: 0.8125rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.375rem; }
.legend__bar::before { content: ""; width: 0.75rem; height: 0.75rem; background: var(--bar); border-radius: 2px; }
.legend__line::before { content: ""; width: 1rem; height: 0; border-top: 2px dashed var(--target); }

.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--line); }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .b { fill: var(--bar); }
.chart .b--partial { fill: var(--bar-muted); }
.chart .b--sel { fill: var(--bar); }
.chart .t { fill: none; stroke: var(--target); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .val { fill: var(--text-2); font-size: 11px; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .chart .b { transform-box: fill-box; transform-origin: bottom; animation: grow 0.6s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes grow { from { transform: scaleY(0); } }
}
.chart-table { margin-top: 0.75rem; }
.chart-table summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 0.875rem; padding-block: 0.5rem; display: inline-block; }
[data-theme="light"] .chart-table summary { color: #0b5a5a; }

.aging__bar { display: flex; height: 0.875rem; border-radius: 4px; overflow: hidden; gap: 2px; }
.aging__bar span { display: block; }
.aging__keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; margin-top: 1rem; }
.aging__keys div { border-left: 3px solid var(--c); padding-left: 0.625rem; }
.aging__keys dt { font-size: 0.8125rem; color: var(--text-2); }
.aging__keys dd { font-weight: 600; font-size: 1.0625rem; }
.owed li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.875rem; }
.owed li:last-child { border-bottom: 0; }
.owed span:last-child { font-weight: 600; white-space: nowrap; }
.owed small { display: block; color: var(--text-3); font-size: 0.8125rem; }

/* work orders */
.wo-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 0.625rem; top: 50%; width: 1.125rem; height: 1.125rem; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 1.7; stroke-linecap: round; pointer-events: none; }
.search input { width: min(20rem, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.5rem 0.75rem 0.5rem 2.25rem; min-height: 2.5rem; }
.search input::placeholder { color: var(--text-3); opacity: 1; }
@media (max-width: 40em) { .wo-tools, .search, .search input { width: 100%; } }

.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 0.875rem; }
.chip { display: inline-flex; align-items: center; gap: 0.375rem; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 0.3125rem 0.75rem; min-height: 2.25rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip b { font-weight: 600; opacity: 0.8; }

.table-wrap { overflow-x: auto; position: relative; }
.table-wrap:focus-visible { outline-offset: 0; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-bottom-color: var(--line-2); white-space: nowrap; }
.tbl thead th:first-child { border-top-left-radius: 6px; }
.tbl thead th:last-child { border-top-right-radius: 6px; }
.tbl--compact th, .tbl--compact td { padding: 0.375rem 0.75rem; font-size: 0.875rem; }
.tbl--wo { min-width: 58rem; }
.tbl--wo thead th { padding: 0; }
.tbl--wo thead button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 0.375rem; width: 100%; padding: 0.625rem 0.75rem; cursor: pointer; min-height: 2.5rem; }
.tbl--wo thead button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tbl--wo thead button::after { content: ""; width: 0.5rem; height: 0.5rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: 0.25; }
.tbl--wo th[aria-sort="ascending"] button::after { opacity: 1; transform: rotate(-135deg) translateY(-2px); }
.tbl--wo th[aria-sort="descending"] button::after { opacity: 1; }
.tbl--wo tbody tr { cursor: pointer; }
.tbl--wo tbody tr:hover td { background: var(--surface-2); }
.wo-id { font-weight: 600; white-space: nowrap; }
.wo-id button { all: unset; display: inline-flex; align-items: center; min-height: 2rem; cursor: pointer; color: var(--brand); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: transparent; }
[data-theme="light"] .wo-id button { color: #0b5a5a; }
.wo-id button:hover { text-decoration-color: currentColor; }
.wo-id button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.cust { color: var(--text-2); }
.due { white-space: nowrap; }
.due--late { color: var(--s-late); font-weight: 600; }

.prog { display: grid; grid-template-columns: 5rem auto; align-items: center; gap: 0.5rem; white-space: nowrap; font-size: 0.875rem; }
.prog__track { height: 0.375rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; outline: 1px solid var(--line); }
.prog__fill { height: 100%; background: var(--brand); border-radius: inherit; }

.status { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; color: var(--c); background: var(--cb); }
.status svg { width: 0.75rem; height: 0.75rem; fill: currentColor; }
.status--done { --c: var(--s-done); --cb: var(--s-done-bg); }
.status--run { --c: var(--s-run); --cb: var(--s-run-bg); }
.status--late { --c: var(--s-late); --cb: var(--s-late-bg); }
.status--wait { --c: var(--s-wait); --cb: var(--s-wait-bg); }
.status--hold { --c: var(--s-hold); --cb: var(--s-hold-bg); }

.empty { padding: 2rem 1rem; text-align: center; color: var(--text-2); }
.link { all: unset; color: var(--brand); text-decoration: underline; cursor: pointer; font-weight: 600; }
.link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* stock */
.btn { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 6px; padding: 0.5rem 1rem; min-height: 2.5rem; font-weight: 600; cursor: pointer; }
[data-theme="light"] .btn { background: #0b5a5a; }
.btn:hover { filter: brightness(1.1); }
.stock { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0.75rem; }
.stock li { border: 1px solid var(--line); border-radius: 6px; padding: 0.875rem 1rem; display: grid; gap: 0.375rem; }
.stock__name { font-weight: 600; }
.stock__code { font-size: 0.8125rem; color: var(--text-3); }
.stock__bar { position: relative; height: 0.5rem; background: var(--surface-2); border-radius: 999px; margin-top: 0.25rem; outline: 1px solid var(--line); }
.stock__bar span { position: absolute; inset: 0 auto 0 0; background: var(--s-late); border-radius: inherit; }
.stock__bar i { position: absolute; top: -0.25rem; bottom: -0.25rem; width: 2px; background: var(--text); }
.stock__nums { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--text-2); }
.stock__nums b { color: var(--s-late); }
.demo-note { margin-top: 0.75rem; font-size: 0.875rem; color: var(--text-2); }
.demo-note:empty { display: none; }

/* drawer */
.drawer { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(32rem, 100%); border: 0; border-left: 1px solid var(--line); padding: 0; background: var(--surface); color: var(--text); }
.drawer::backdrop { background: rgba(10, 14, 20, 0.45); }
@media (prefers-reduced-motion: no-preference) {
  .drawer[open] { animation: slide 0.25s cubic-bezier(.2,.7,.2,1); }
  @keyframes slide { from { transform: translateX(2rem); opacity: 0; } }
}
.drawer__head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.drawer__id { font-size: 0.8125rem; color: var(--text-3); font-weight: 600; }
.drawer h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.drawer__body { padding: 1.25rem 1.5rem 2rem; display: grid; gap: 1.25rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem 1rem; }
.facts dt { font-size: 0.8125rem; color: var(--text-3); }
.facts dd { font-weight: 500; }
.ops h3 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); margin-bottom: 0.5rem; }
.ops ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.ops li { position: relative; padding: 0 0 0.875rem 1.25rem; }
.ops li::before { content: ""; position: absolute; left: -0.4375rem; top: 0.3rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.ops li.is-done::before { background: var(--s-done); border-color: var(--s-done); }
.ops li.is-now::before { background: var(--surface); border-color: var(--s-run); box-shadow: 0 0 0 3px var(--s-run-bg); }
.ops li span { display: block; font-size: 0.8125rem; color: var(--text-3); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .status, .chip[aria-pressed="true"] { border: 1px solid CanvasText; } .prog__fill, .stock__bar span, .aging__bar span { forced-color-adjust: none; } }
