/* TNP Cut & Edge Management System — Next Gen Digital */

@font-face { font-family: "Manrope"; src: url(../fonts/manrope-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(../fonts/manrope-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(../fonts/manrope-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(../fonts/manrope-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url(../fonts/manrope-800.woff2) format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Michroma"; src: url(../fonts/michroma-400.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  /* Workshop graphite (sidebar) */
  --side-950: #0E1013;
  --side-900: #16191D;
  --side-800: #23282E;
  --side-700: #1C6FA8;
  --side-300: #9AA5B1;
  --side-100: #D6EBF8;
  --side-50:  #EEF6FC;

  /* TNP brand: sky blue + sunflower yellow (from the logo) */
  --brand-blue:   #4DADE9;
  --brand-yellow: #F3CF4F;
  --accent:     #1C6FA8;   /* deep TNP blue: buttons, links (white text passes contrast) */
  --accent-600: #175D8D;
  --accent-700: #124A70;
  --accent-50:  #E7F3FB;

  --bg:       #F4F5F3;
  --surface:  #FFFFFF;
  --surface-2:#F9FAF8;
  --line:     #E3E5E1;
  --line-2:   #CDD1CB;
  --ink:      #15191E;
  --ink-2:    #474F59;
  --ink-3:    #6B737D;

  --good: #1C7146;  --good-bg: #E5F3EA;
  --warn: #8A5A00;  --warn-bg: #FDF3D6;
  --bad:  #B42318;  --bad-bg:  #FCE9E7;
  --info: #1C6FA8;  --info-bg: #E7F3FB;
  --mute-bg: #EDEEEB;

  --series-1: #1C6FA8;   /* income */
  --series-2: #B87400;   /* expenses */

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Michroma", "Eurostile", "Arial", sans-serif;
  --num: "Manrope", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(22, 25, 29, .06), 0 1px 1px rgba(22, 25, 29, .04);
  --shadow-pop: 0 18px 50px rgba(14, 16, 19, .22), 0 2px 6px rgba(14, 16, 19, .12);
  --side-w: 252px;
  --top-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14.5px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-600); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-3); }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.96); } }

/* ---------- Sign-in / setup ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); background: var(--surface); }
.auth-visual {
  position: relative; overflow: hidden; color: #fff; background: var(--side-950);
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px;
}
.auth-visual .photo {
  position: absolute; inset: 0; background: url(../img/hero-kitchen.webp) center 40%/cover no-repeat;
  filter: saturate(.9) contrast(1.05) brightness(.9); opacity: .72;
  transform: scale(1.06); animation: drift 26s ease-in-out infinite alternate;
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(115deg, rgba(14,16,19,.96) 0%, rgba(22,25,29,.86) 46%, rgba(22,25,29,.42) 100%);
}
.auth-visual svg.swoosh { position: absolute; z-index: 2; right: 0; bottom: 0; width: 62%; height: 48%; animation: swoosh 1.1s cubic-bezier(.2,.7,.2,1) both; transform-origin: 100% 100%; }
@keyframes swoosh { from { opacity: 0; transform: translateX(8%); } }
.auth-visual > *:not(.photo):not(svg) { position: relative; z-index: 3; }
@keyframes drift { to { transform: scale(1.12) translate(-1.5%, -1%); } }
.auth-logo { width: 168px; height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.auth-head { max-width: 30rem; }
.auth-head h1 { font: 400 clamp(28px, 3.4vw, 46px)/1.12 var(--display); letter-spacing: .01em; text-transform: uppercase; font-synthesis: none; }
.auth-head p { margin: 18px 0 0; font-size: 16px; color: #D9DEE4; max-width: 27rem; }
.auth-foot { font-size: 12.5px; color: var(--side-300); display: flex; flex-direction: column; gap: 4px; max-width: 42%; }
.auth-foot span:first-child { color: var(--brand-yellow); font-weight: 700; letter-spacing: .02em; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font: 400 22px/1.15 var(--display); text-transform: uppercase; letter-spacing: .02em; font-synthesis: none; }
.auth-card .lead { margin: 10px 0 26px; color: var(--ink-2); }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn { width: 100%; margin-top: 22px; height: 46px; font-size: 15px; }
.auth-note { margin-top: 22px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 16px; }
.auth-anim > * { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.auth-anim > *:nth-child(2) { animation-delay: .08s; }
.auth-anim > *:nth-child(3) { animation-delay: .16s; }
.auth-anim > *:nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-900); color: #C9D3E4;
  display: flex; flex-direction: column; z-index: 40;
}
.side-brand { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 12px; }
.side-brand img { width: 168px; height: auto; }
.side-nav { padding: 12px 12px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label { font-size: 12px; color: var(--side-300); padding: 6px 12px 6px; letter-spacing: .01em; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  color: #D7DFEC; font-weight: 500; text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--side-800); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.nav-link.active svg { opacity: 1; }
/* Active marker: a strip of edging tape with mitred (45 degree) ends, in TNP yellow over a blue core */
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 5px; bottom: 5px; width: 6px;
  background: linear-gradient(90deg, var(--brand-blue) 0 2px, var(--brand-yellow) 2px 100%);
  clip-path: polygon(0 0, 100% 6px, 100% calc(100% - 6px), 0 100%);
  animation: tape .35s cubic-bezier(.2,.7,.2,1) both; transform-origin: top;
}
@keyframes tape { from { transform: scaleY(.2); opacity: 0; } }
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 800; background: var(--brand-yellow); color: #15191E; border-radius: 999px; padding: 1px 7px; }
.side-foot { padding: 14px 20px 18px; font-size: 12px; color: var(--side-300); border-top: 1px solid rgba(255,255,255,.07); }
.side-foot a { color: #D2D8DE; }
.side-foot { display: flex; align-items: center; gap: 12px; line-height: 1.45; }
.side-foot .ng-logo { flex: none; display: block; transition: transform .2s ease; }
.side-foot .ng-logo:hover { transform: rotate(-8deg) scale(1.05); }
.side-foot .ng-logo img { width: 40px; height: 40px; }
.side-foot a.ng-name { color: #D9B96A; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(244,245,243,.88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.search input:focus { outline: none; border-color: var(--side-300); box-shadow: 0 0 0 3px var(--side-100); }
.search > svg { position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; color: var(--ink-3); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; max-height: 420px; overflow: auto;
}
.search-results a { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a.on { background: var(--side-50); }
.search-results .t { font-size: 12px; color: var(--ink-3); padding-top: 1px; }
.search-results .m { display: block; font-size: 12.5px; color: var(--ink-3); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; }
.user-btn:hover { background: var(--surface); border-color: var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--side-900); color: #fff; font-weight: 600; font-size: 13px; }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who b { display: block; font-weight: 600; font-size: 13.5px; }
.user-btn .who span { font-size: 12px; color: var(--ink-3); }

.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 8px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--side-50); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .danger { color: var(--bad); }
.pop { position: relative; }

.content { padding: 28px 28px 64px; width: 100%; max-width: 1360px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font: 400 25px/1.15 var(--display); text-transform: uppercase; letter-spacing: .02em; font-synthesis: none; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 13px; margin-bottom: 8px; }
.crumb a { color: var(--ink-3); }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn.navy { background: var(--side-900); border-color: var(--side-900); color: #fff; }
.btn.navy:hover { background: var(--side-800); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--mute-bg); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 38px; padding: 0; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--bad); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select.input { padding-right: 32px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236E7889' stroke-width='1.6'/%3E%3C/svg%3E") right 12px center no-repeat; }
.input:focus { outline: none; border-color: var(--side-700); box-shadow: 0 0 0 3px var(--side-100); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--ink-2); }
.input.money { text-align: right; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; }

.seg { display: inline-flex; background: var(--mute-bg); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 500; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }

/* ---------- Cards, panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 15.5px; font-weight: 600; }
.panel-head .sub { font-size: 12.5px; color: var(--ink-3); }
.panel-body { padding: 18px 20px; }
.panel + .panel { margin-top: 18px; }
.stack > * + * { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 16px 14px; box-shadow: var(--shadow-1); overflow: hidden; min-width: 0; }
.kpi .k-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.kpi .k-label i { width: 8px; height: 8px; border-radius: 2px; background: var(--side-700); flex: none; }
.kpi .k-value { margin-top: 10px; font: 800 clamp(19px, 1.55vw, 25px)/1.05 var(--num); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-value small { font-size: .72em; margin-right: 2px; }
.kpi .k-foot { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi.is-bad .k-value { color: var(--bad); }
.kpi.is-good .k-value { color: var(--good); }
.kpi.feature { background: var(--side-900); border-color: var(--side-900); color: #fff; }
.kpi.feature { background: var(--side-900) linear-gradient(135deg, transparent 72%, rgba(243,207,79,.16) 72% 76%, rgba(77,173,233,.2) 76% 81%, transparent 81%); }
.kpi.feature .k-label { color: #D2D8DE; }
.kpi.feature .k-foot { color: var(--side-300); }
.kpi.feature .k-label i { background: var(--brand-yellow) !important; }
.delta { font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 5px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.kpi.feature .delta.up { color: #9BE3B8; background: rgba(155,227,184,.12); }
.kpi.feature .delta.down { color: #F6A8A8; background: rgba(246,168,168,.12); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; }
.dash-grid > .panel + .panel { margin-top: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 18px; }
.quick a {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink); font-weight: 600; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.quick a:hover { border-color: var(--side-300); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.quick a span.ic { width: 34px; height: 34px; border-radius: 9px; background: var(--side-50); color: var(--side-800); display: grid; place-items: center; flex: none; }
.quick a span.ic svg { width: 18px; height: 18px; }
.quick a small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.row-link { display: contents; color: inherit; text-decoration: none; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow span { font-size: 12.5px; color: var(--ink-3); }
.list li.clickable { cursor: pointer; }
.list li.clickable:hover { background: var(--surface-2); }
.alert-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert-dot svg { width: 15px; height: 15px; }
.alert-dot.critical { background: var(--bad-bg); color: var(--bad); }
.alert-dot.warning { background: var(--warn-bg); color: var(--warn); }
.alert-dot.info { background: var(--info-bg); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover td { background: var(--side-50); }
.t td.num, .t th.num { text-align: right; }
.t tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-2); border-bottom: 0; }
.t .strong { font-weight: 600; }
.t tr.void td { color: var(--ink-3); }
.t tr.void td.ref { text-decoration: line-through; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty > svg { width: 40px; height: 40px; color: var(--line-2); margin: 0 auto 10px; }
.empty h3 { font-size: 16px; margin-bottom: 4px; color: var(--ink); }
.empty p { margin: 0 0 16px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input { height: 36px; width: auto; }
.toolbar .search-in { flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .spacer { flex: 1; }
.totals-bar { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.totals-bar b { font-weight: 600; }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 7px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.mute { background: var(--mute-bg); color: var(--ink-2); }
.chip.brand { background: var(--accent-50); color: var(--accent); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 5px; background: var(--mute-bg); color: var(--ink-2); font-weight: 500; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); }
.chart .bar { transition: opacity .15s; }
.chart .bar-grow { transform-box: fill-box; transform-origin: bottom; animation: grow .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes grow { from { transform: scaleY(0); } }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: rgba(22,25,29,.05); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: absolute; pointer-events: none; background: var(--side-950); color: #fff; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow-pop); min-width: 160px; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--mute-bg); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--side-700); border-radius: 0 4px 4px 0; transform-origin: left; animation: growx .7s cubic-bezier(.2,.7,.2,1) both; }
.hbar .fill.direct { background: var(--series-2); }
@keyframes growx { from { transform: scaleX(0); } }

/* ---------- Document editor (quote / invoice) ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.sheet-head { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 24px 26px; border-bottom: 4px solid transparent; border-image: linear-gradient(90deg, var(--brand-blue) 0 64%, var(--brand-yellow) 64% 100%) 1; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }
.sheet-head .doc-type { font: 400 22px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; font-synthesis: none; }
.sheet-head .doc-no { font: 800 19px/1 var(--num); color: var(--accent); margin-top: 8px; letter-spacing: .01em; }
.sheet-head img { width: 150px; }
.sheet-body { padding: 22px 26px; }
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 12.5px; color: var(--ink-3); font-weight: 600; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
.items th.right { text-align: right; }
.items td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items td .input { height: 36px; }
.items textarea.input { min-height: 36px; height: 36px; padding: 7px 10px; resize: none; overflow: hidden; }
.items .c-code { width: 74px; }
.items .c-price { width: 124px; }
.items .c-qty { width: 78px; }
.items .c-disc { width: 78px; }
.items .c-total { width: 120px; text-align: right; padding-top: 14px; font-weight: 600; }
.items .c-x { width: 72px; white-space: nowrap; text-align: right; }
.items .c-x .btn { width: 30px; height: 30px; padding: 0; }
.items.read td { padding: 11px 6px; }
.doc-totals { margin-left: auto; width: min(340px, 100%); margin-top: 16px; font-size: 14.5px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.doc-totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font: 800 22px/1 var(--num); letter-spacing: -.01em; }
.doc-side .panel-body > * + * { margin-top: 12px; }
.doc-side .btn { width: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.balance-big { font: 800 30px/1 var(--num); letter-spacing: -.015em; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--side-300); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline b { font-weight: 600; }
.timeline span { display: block; color: var(--ink-3); font-size: 12px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner.info { background: var(--info-bg); color: #124A70; }
.banner.warn { background: var(--warn-bg); color: #6E4108; }
.banner.bad { background: var(--bad-bg); color: #8E1C13; }

/* ---------- Expense quick entry ---------- */
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick button { border: 1px solid var(--line-2); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 500; cursor: pointer; transition: all .12s; }
.cat-pick button:hover { border-color: var(--side-700); }
.cat-pick button.on { background: var(--side-900); border-color: var(--side-900); color: #fff; }
.amount-in { position: relative; }
.amount-in span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font: 700 24px/1 var(--num); color: var(--ink-3); }
.amount-in .input { height: 60px; padding-left: 40px; font: 800 30px/1 var(--num); letter-spacing: -.01em; }
.stamp { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 9px 12px; }
.stamp svg { width: 16px; height: 16px; color: var(--ink-3); }
.file-drop { display: flex; align-items: center; gap: 12px; border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--surface-2); }
.file-drop:hover { border-color: var(--side-700); }
.file-drop svg { width: 22px; height: 22px; color: var(--ink-3); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(14,16,19,.45); z-index: 80; display: flex; justify-content: flex-end; animation: fade .18s ease both; }
.overlay.center { justify-content: center; align-items: flex-start; padding: 8vh 16px 16px; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); animation: slide .26s cubic-bezier(.2,.7,.2,1) both; }
.drawer.wide { width: min(760px, 100%); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.dialog { width: min(480px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop .2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.m-head h2 { font: 400 16.5px/1.2 var(--display); text-transform: uppercase; letter-spacing: .03em; font-synthesis: none; }
.m-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.m-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; background: var(--surface-2); }
.dialog .m-foot { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.secret { font: 600 18px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--side-50); border: 1px solid var(--side-100); border-radius: 8px; padding: 12px 14px; letter-spacing: .03em; user-select: all; overflow-wrap: anywhere; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 260px; max-width: 380px; background: var(--side-950); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); font-size: 13.5px; animation: rise .25s ease both; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.good svg { color: #8EDDB0; }
.toast.bad { background: #5C1219; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }

.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period .input { height: 36px; width: auto; }

details.diff summary { cursor: pointer; color: var(--info); font-size: 12.5px; }
details.diff pre { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); border-radius: 6px; padding: 8px; margin: 6px 0 0; max-width: 520px; overflow-wrap: anywhere; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .dash-grid, .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-layout > aside { order: -1; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-pop); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(12,24,48,.4); z-index: 35; }
  .top .menu-btn { display: inline-flex; }
  .top { padding: 0 16px; }
  .content { padding: 20px 16px 56px; }
  .user-btn .who { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { min-height: 300px; padding: 28px 24px; }
  .auth-head h1 { font-size: clamp(22px, 7vw, 34px); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .k-value { font-size: 24px; }
  .kpi .k-value small { font-size: 16px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .page-head h1 { font-size: 19px; }
  .page-head .actions { width: 100%; }
  .search { max-width: none; }
  .items thead { display: none; }
  .items, .items tbody, .items tr, .items td { display: block; width: 100%; }
  .items tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .items td { border: 0; padding: 0; width: auto !important; }
  .items td.c-desc { grid-column: 1 / -1; }
  .items td.c-code { grid-column: 1 / -1; }
  .items td.c-total { grid-column: 1 / 3; text-align: left; padding-top: 6px; }
  .items td.c-x { grid-column: 3; }
  .items td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
  .sheet-head { grid-template-columns: 1fr; padding: 18px; }
  .sheet-head img { display: none; }
  .sheet-body { padding: 16px; }
  .drawer { width: 100%; }
  .m-foot { padding: 12px 16px; }
  .m-foot .btn { flex: 1 1 auto; }
  .drawer .m-foot [data-close] { display: none; }
  .m-body { padding: 16px; }
  .toasts { left: 16px; right: 16px; }
  .toast { max-width: none; }
  .t th, .t td { padding: 10px 12px; }
  .quick a small { display: none; }
  .list li { flex-wrap: wrap; padding: 12px 16px; }
  .list li .grow { flex: 1 1 calc(100% - 40px); }
  .list li .grow b { white-space: normal; }
  .list li > .chip { margin-left: 38px; }
  .list li > .num { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  .side, .top, .page-head .actions, .toolbar, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .panel { box-shadow: none; }
}

/* ============ Phones and tablets (iOS Safari, Android Chrome) ============ */
html { -webkit-tap-highlight-color: transparent; }
button, a, .btn, .nav-link, .seg button, .cat-pick button, label.check { touch-action: manipulation; }

/* Icons inside dropdown menus (New menu, account menu) */
.menu svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.menu .danger svg { color: var(--bad); }
.menu { max-height: calc(100vh - var(--top-h) - 24px); max-height: calc(100dvh - var(--top-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }

/* Full-height areas: use the real visible screen height (iOS toolbars) */
.auth { min-height: 100vh; min-height: 100dvh; }
.boot { min-height: 100vh; min-height: 100dvh; }
.side { height: 100vh; height: 100dvh; overscroll-behavior: contain; }
.side-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

/* Date pickers on iOS collapse or centre their text without this */
input[type="date"].input, input[type="month"].input { -webkit-appearance: none; appearance: none; min-height: 40px; text-align: left; display: block; }
input[type="date"].input::-webkit-date-and-time-value, input[type="month"].input::-webkit-date-and-time-value { text-align: left; }

/* Notch / rounded corners / home bar */
.top { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
.toasts { bottom: calc(20px + env(safe-area-inset-bottom)); }
.m-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.drawer { height: 100%; max-height: 100dvh; }

/* Touch devices: 16px fields stop iPhones zooming in when a field is tapped */
@media (pointer: coarse), (max-width: 960px) {
  .input, select.input, textarea.input, .search input, .toolbar .input, .period .input, .amount-in .input { font-size: 16px; }
  .amount-in .input { font-size: 30px; }
  .nav-link { padding: 11px 12px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
}

@media (max-width: 960px) {
  .top { height: calc(var(--top-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); gap: 10px; }
  .side { width: min(86vw, 300px); padding-top: env(safe-area-inset-top); }
  body.nav-lock { overflow: hidden; }
}

@media (max-width: 640px) {
  /* Summary cards: two per row (overrides per-page column counts) */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kpis .kpi.feature { grid-column: 1 / -1; }
  .kpi .k-label { font-size: 12.5px; }
  /* Top bar: compact New button and search */
  .top-actions { gap: 6px; }
  .top-actions .btn.primary { padding: 0 12px; }
  .search input { padding-left: 34px; }
  /* Menus open full width under the top bar */
  .pop { position: static; }
  .menu { position: fixed; left: 12px; right: 12px; top: calc(var(--top-h) + env(safe-area-inset-top) + 6px); min-width: 0; }
  .menu a, .menu button { padding: 12px 14px; font-size: 15px; }
  /* Page action buttons share the width neatly */
  .page-head .actions .btn { flex: 1 1 auto; }
  .page-head .actions .period, .page-head .actions [data-period] { width: 100%; }
  .period { width: 100%; }
  .period .seg { display: flex; flex: 1 1 100%; }
  .period .seg button { flex: 1; }
  .period .input { flex: 1 1 120px; min-width: 0; }
  .page-head .actions .period .btn, .period .btn.icon { flex: 0 0 40px; width: 40px; }
  /* Tabs scroll sideways instead of wrapping */
  .tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  /* Toolbars stack */
  .toolbar .search-in { max-width: none; flex: 1 1 100%; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .toolbar .seg button { white-space: nowrap; }
  .toolbar > select.input { flex: 1 1 45%; }
  .doc-side .btn { min-height: 44px; }
}
@media (max-width: 380px) {
  .top-actions .btn.primary span { display: none; }
  .top-actions .btn.primary { width: 40px; padding: 0; }
  .kpi .k-value { font-size: 21px; }
}


/* ============ TNP Cut & Edge additions ============ */
.sheet-head img { width: 64px; height: auto; }
.tag.dep { background: #FDF3D6; color: var(--warn); font-weight: 700; }
.drawer.xwide { width: min(1120px, 100%); }
.chip.brand { background: var(--accent-50); color: var(--accent-700); }

/* Workshop pipeline */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 4px; }
.panel > .pipeline { padding: 14px 20px 6px; }
.page-head + .pipeline { padding: 0 0 16px; }
.pipe { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; padding: 10px 11px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none !important; transition: border-color .15s, transform .15s, box-shadow .15s; animation: rise .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d); }
.pipe:hover { border-color: var(--brand-blue); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.pipe.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--side-100); }
.pipe-ic { position: absolute; top: 9px; right: 9px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--side-50); color: var(--accent); }
.pipe-ic svg { width: 16px; height: 16px; }
.pipe-n { font: 800 22px/1 var(--num); }
.pipe-l { font-size: 12px; color: var(--ink-2); font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-bar { grid-column: 1 / -1; height: 4px; background: var(--mute-bg); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.pipe-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-blue), var(--accent)); border-radius: 4px; transform-origin: left; animation: growx .8s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d) + .15s); }
.pipe.zero { color: var(--ink-3); }
.pipe.zero .pipe-ic { background: var(--mute-bg); color: var(--ink-3); }
.pipe.hold .pipe-ic { background: var(--warn-bg); color: var(--warn); }
.pipe.hold .pipe-bar i { background: var(--brand-yellow); }
.dash-grid .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Job stage stepper */
.stepper { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 12px 14px; }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.step::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step.done::before, .step.now::before { background: linear-gradient(90deg, var(--brand-blue), var(--accent)); }
.step .dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-2); font: 800 13px/1 var(--num); color: var(--ink-3); }
.step .dot svg { width: 15px; height: 15px; }
.step.done { color: var(--ink-2); }
.step.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.now { color: var(--ink); }
.step.now .dot { background: var(--brand-yellow); border-color: var(--brand-yellow); color: var(--ink); box-shadow: 0 0 0 5px rgba(243,207,79,.28); animation: nowpulse 2.2s ease-in-out infinite; }
@keyframes nowpulse { 50% { box-shadow: 0 0 0 9px rgba(243,207,79,.08); } }
.stepper.paused .step { opacity: .55; }
.paused-note { position: absolute; right: 12px; top: -11px; display: inline-flex; gap: 6px; align-items: center; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.paused-note svg { width: 14px; height: 14px; }

/* Deposits */
.dep-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface-2); }
.dep-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dep-row { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none !important; font-size: 13.5px; }
.dep-row .num { margin-left: auto; }
.dep-bar { height: 6px; border-radius: 6px; background: var(--mute-bg); overflow: hidden; }
.dep-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-yellow), #E2B52B); border-radius: 6px; transform-origin: left; animation: growx .8s cubic-bezier(.2,.7,.2,1) both; }

/* Cutting list */
.cut-kpis, .cl-live-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.cl-live-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 10px; }
.cut-kpis > div, .cl-live-grid > div { border: 1px solid var(--line); border-top: 3px solid var(--brand-blue); border-radius: 10px; padding: 9px 12px; background: var(--surface); }
.cut-kpis > div:first-child, .cl-live-grid > div:first-child { border-top-color: var(--brand-yellow); }
.cut-kpis span, .cl-live-grid span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.cut-kpis b, .cl-live-grid b { font: 800 22px/1.2 var(--num); }
.cut-mat + .cut-mat { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.cut-mat-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; }
.cut-thumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cut-thumbs .more { font-weight: 700; color: var(--ink-3); }
svg.thumb { width: 118px; height: auto; border-radius: 3px; }
svg.thumb .b { fill: #F1EEE6; stroke: #8C8577; stroke-width: 14; }
svg.thumb .p { fill: #CFE7F7; stroke: var(--accent); stroke-width: 8; animation: fade .4s ease both; animation-delay: calc(var(--i) * 25ms); }
.cl-board { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
.cl-table { min-width: 860px; }
.cl-table th { font-size: 12px; text-align: left; padding: 6px; color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--line); }
.cl-table td { padding: 4px 4px; vertical-align: middle; }
.cl-table td:nth-child(1) { width: 22%; } .cl-table td:nth-child(2) { width: 24%; }
.cl-table td:nth-child(3), .cl-table td:nth-child(4) { width: 10%; } .cl-table td:nth-child(5) { width: 7%; }
.cl-table td:nth-child(6), .cl-table td:nth-child(7) { width: 7%; }
.cl-table .input { height: 36px; padding: 0 8px; }
.cl-table .input.r { text-align: right; }
.cl-table .c { text-align: center; }
.cl-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.cl-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 14px; }
.cl-live { border-top: 1px solid var(--line); padding-top: 14px; min-height: 60px; }
.cl-live-mat { margin-top: 8px; font-size: 13.5px; }
.cl-live-mat .cut-thumbs { margin-top: 6px; }

@media (max-width: 960px) {
  .pipeline, .dash-grid .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stepper { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 14px 4px 12px; }
  .step { font-size: 10.5px; }
  .step .dot { width: 26px; height: 26px; }
  .step::before { top: 12px; }
  .cut-kpis, .cl-live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cl-table { min-width: 0; }
  .cl-table tr { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .cl-table td[data-l=Part], .cl-table td[data-l=Material] { grid-column: 1 / -1; }
  svg.thumb { width: 96px; }
  .auth-visual svg.swoosh { height: 30%; width: 48%; }
  .auth-visual { min-height: 0; gap: 22px; }
  .auth-foot { max-width: 60%; }
  .auth-head p { font-size: 14.5px; }
}
@media (max-width: 640px) {
  .items.read tr td:nth-child(2) { grid-column: 2 / -1; }
}
