/* ASW ERP — design system v2 (mobile-first) */
:root {
  --bg: #f3f5f9;
  --bg-2: #e9edf4;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-soft: #eef2ff;
  --accent: #f97316;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --info: #0891b2;
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  --sidebar: 248px;
  --bottombar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --bg-2: #111832; --panel: #141b2f; --panel-2: #1a2238; --text: #e7ebf5; --muted: #95a0b8;
    --line: #253049; --brand: #818cf8; --brand-2: #a5b4fc; --brand-soft: #1e2347; --accent: #fb923c;
    --ok: #4ade80; --ok-soft: #13301f; --bad: #f87171; --bad-soft: #3a1717; --warn: #fbbf24; --warn-soft: #3a2a0c; --info: #22d3ee;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --bg-2: #111832; --panel: #141b2f; --panel-2: #1a2238; --text: #e7ebf5; --muted: #95a0b8;
  --line: #253049; --brand: #818cf8; --brand-2: #a5b4fc; --brand-soft: #1e2347; --accent: #fb923c;
  --ok: #4ade80; --ok-soft: #13301f; --bad: #f87171; --bad-soft: #3a1717; --warn: #fbbf24; --warn-soft: #3a2a0c; --info: #22d3ee;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 20px var(--gutter) 2px; }
h2 { font-size: 1rem; font-weight: 650; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 10px 0 6px; }
.muted { color: var(--muted); margin: 0 var(--gutter) 12px; }
.text-bad { color: var(--bad); font-weight: 600; }
small, .help { color: var(--muted); font-size: .8rem; }

/* ---------- app layout ---------- */
.app { min-height: 100vh; }
.sidebar { display: none; }
.main { padding-bottom: calc(var(--bottombar) + 24px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px var(--gutter); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar .page-title { font-weight: 650; font-size: 1rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: .8rem; font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #f97316);
  box-shadow: 0 4px 14px rgba(99, 102, 241, .4);
}
.logo small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: var(--brand-soft); color: var(--brand); flex: none;
}

/* bottom bar (phone) */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottombar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bottombar a, .bottombar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 600;
  color: var(--muted); text-decoration: none; background: none; border: 0; min-height: 0; padding: 6px 0; border-radius: 0;
}
.bottombar .active { color: var(--brand); }
.bottombar .active svg.i { stroke-width: 2.3; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--bottombar) + 18px + env(safe-area-inset-bottom)); z-index: 11;
  width: 56px; height: 56px; border-radius: 18px; border: 0; color: #fff; display: grid; place-items: center; padding: 0;
  background: linear-gradient(135deg, var(--brand), #8b5cf6); box-shadow: 0 8px 24px rgba(99, 102, 241, .45);
}
.fab svg.i { width: 26px; height: 26px; stroke-width: 2.4; }

/* sheet menu (More) */
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .82rem; font-weight: 600; text-align: center;
}
.sheet-grid a .tile-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }

/* desktop sidebar */
@media (min-width: 960px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 9;
    background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px;
  }
  .main { margin-left: var(--sidebar); padding-bottom: 40px; }
  .bottombar, .topbar .logo, .fab { display: none; }
  .nav-group { margin-top: 18px; }
  .nav-group-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 0 10px 6px; }
  .nav-link {
    display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text);
    text-decoration: none; font-weight: 550; font-size: .92rem; margin-bottom: 2px;
  }
  .nav-link svg.i { color: var(--muted); }
  .nav-link:hover { background: var(--panel-2); }
  .nav-link.active { background: var(--brand-soft); color: var(--brand); }
  .nav-link.active svg.i { color: var(--brand); }
  .sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .sidebar-foot .who { flex: 1; min-width: 0; font-size: .85rem; }
  .sidebar-foot .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.content { max-width: 1240px; margin: 0 auto; padding: 0 0 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px var(--gutter) 14px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: var(--gutter);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(99, 102, 241, .35), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(249, 115, 22, .25), transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow-lg);
}
.auth-card h2 { font-size: 1.25rem; }
.brand-big { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.auth-card > .muted { margin: 6px 0 0; }
.auth-form { display: grid; gap: 14px; margin-top: 20px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.divider { text-align: center; color: var(--muted); margin: 16px 0; position: relative; font-size: .85rem; }
.divider::before, .divider::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--line); }
.divider::before { left: 0; } .divider::after { right: 0; }

/* ---------- cards & KPIs ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px var(--gutter); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-inline { margin-top: 12px; }
.grid { display: grid; gap: 12px; margin: 12px var(--gutter); }
.grid > .card { margin: 0; }
@media (min-width: 960px) { .grid.two { grid-template-columns: 1.6fr 1fr; } .grid.even { grid-template-columns: 1fr 1fr; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px var(--gutter); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.stat {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat-value { font-size: 1.55rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 550; margin-top: 2px; }
.stat small { display: block; margin-top: 4px; }
.stat.hero { background: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #db2777); color: #fff; border: 0; }
.stat.hero .stat-label, .stat.hero small { color: rgba(255, 255, 255, .82); }
.stat.hero .stat-ic { background: rgba(255, 255, 255, .18); color: #fff; }
.tone-ok .stat-ic { background: var(--ok-soft); color: var(--ok); }
.tone-bad .stat-ic { background: var(--bad-soft); color: var(--bad); }
.tone-warn .stat-ic { background: var(--warn-soft); color: var(--warn); }
.trend { font-size: .75rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.trend.up { background: var(--ok-soft); color: var(--ok); }
.trend.down { background: var(--bad-soft); color: var(--bad); }

.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 190px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px var(--gutter); }
.toolbar label { display: inline-flex; gap: 6px; align-items: center; }
.search { flex: 1 1 200px; min-width: 0; padding-left: 38px !important;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; }
.empty {
  color: var(--muted); padding: 32px 18px; text-align: center; background: var(--panel); border: 1.5px dashed var(--line);
  border-radius: var(--radius); margin: 0 var(--gutter);
}
.alert { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px var(--gutter); font-weight: 550; }
.notice { background: var(--brand-soft); color: var(--brand); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px var(--gutter); font-weight: 550; display: flex; gap: 10px; align-items: center; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin: 4px 0; }

/* list rows (activity feed, machines) */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .grow span { color: var(--muted); font-size: .8rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }

/* quick actions */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px var(--gutter); }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text);
  text-decoration: none; font-size: .78rem; font-weight: 600; text-align: center;
}
.quick .tile-ic, .sheet-grid .tile-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; }
.c-indigo { background: #eef2ff; color: #4f46e5; } .c-orange { background: #ffedd5; color: #ea580c; }
.c-green { background: #dcfce7; color: #16a34a; } .c-sky { background: #e0f2fe; color: #0284c7; }
.c-rose { background: #ffe4e6; color: #e11d48; } .c-violet { background: #f3e8ff; color: #9333ea; }
.c-amber { background: #fef3c7; color: #d97706; } .c-slate { background: #e2e8f0; color: #475569; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) [class*="c-"].tile-ic { background: color-mix(in srgb, currentColor 18%, transparent); } }
:root[data-theme="dark"] [class*="c-"].tile-ic { background: color-mix(in srgb, currentColor 18%, transparent); }

/* ---------- controls ---------- */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 20%, transparent); }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); padding: 10px 16px; min-height: 44px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s, background .15s, box-shadow .15s;
}
button:active { transform: scale(.97); }
button.primary { background: linear-gradient(135deg, var(--brand), #7c3aed); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
button.ghost { background: transparent; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; }
button.small { padding: 6px 12px; min-height: 34px; font-size: .85rem; }
button.link { background: none; border: none; color: var(--brand); padding: 4px 0; min-height: 0; font-weight: 600; }
button.icon { border: none; background: transparent; min-width: 36px; min-height: 36px; padding: 4px; font-size: 1rem; }
button.icon.danger { color: var(--bad); }
button.wide { width: 100%; margin-top: 6px; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-2) 55%, transparent); outline-offset: 2px; }
.inline { display: inline-flex; align-items: center; gap: 8px; }

/* segmented / pill tabs */
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 0 var(--gutter) 10px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav button {
  white-space: nowrap; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: .84rem; min-height: 0;
}
.subnav button.active { background: var(--text); border-color: var(--text); color: var(--panel); }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.field { display: grid; gap: 6px; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.field.wide { grid-column: 1 / -1; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-item { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--panel-2); font-size: .88rem; }
.check-item input { width: auto; min-height: 0; }

.lines { display: grid; gap: 10px; }
.line-row { display: grid; grid-template-columns: 30px 1fr 36px; gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--panel-2); }
.line-index { color: var(--muted); font-size: .8rem; padding-top: 12px; font-weight: 700; }
.line-cells { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cell { display: grid; gap: 3px; }
.cell small { font-size: .72rem; font-weight: 600; }
.lines > button.ghost { justify-self: start; }

/* quick-entry pickers */
.pick-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.pick-label:first-child { margin-top: 0; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; flex-wrap: wrap; }
.pill {
  border: 1.5px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; padding: 10px 14px;
  min-height: 0; font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.pill small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.pill.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.pill.bad.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.stepper button { min-height: 52px; font-size: 1.4rem; padding: 0; border-radius: 14px; }
.stepper input { text-align: center; font-size: 1.5rem; font-weight: 750; min-height: 52px; font-variant-numeric: tabular-nums; }
.qty-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .qty-grid { grid-template-columns: 1fr 1fr; } }
.chips-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chips-quick button { min-height: 0; padding: 5px 10px; font-size: .8rem; border-radius: 999px; background: var(--panel-2); }
.summary-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line); margin-top: 16px; font-size: .9rem;
}
.summary-bar b { font-size: 1.1rem; }
details.more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 650; color: var(--brand); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 12px; }

/* ---------- modal / sheet ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 12, 24, .5); backdrop-filter: blur(3px); z-index: 30;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.modal {
  background: var(--panel); width: 100%; max-width: 760px; max-height: 94vh;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg);
  animation: up .22s cubic-bezier(.2, .9, .3, 1.1);
}
.modal::before { content: ""; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; flex: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 12px; }
.modal-head h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel-2); }
.modal-foot button { flex: 1 1 auto; }
.modal-foot button.danger { margin-right: auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 var(--gutter); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--panel-2); font-weight: 650; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--brand) 6%, transparent); }

/* ---------- chips, bars, toasts ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 650;
  background: var(--panel-2); color: var(--muted); white-space: nowrap; text-transform: capitalize;
}
.chip-accept, .chip-pass, .chip-inspected, .chip-running, .chip-completed, .chip-dispatched, .chip-ok, .chip-received, .chip-closed { color: var(--ok); background: var(--ok-soft); }
.chip-reject, .chip-fail, .chip-breakdown, .chip-cancelled, .chip-overdue { color: var(--bad); background: var(--bad-soft); }
.chip-hold, .chip-rework, .chip-pending-qc, .chip-in-progress, .chip-maintenance, .chip-due, .chip-open, .chip-partial { color: var(--warn); background: var(--warn-soft); }
.chip-planned, .chip-draft { color: var(--brand); background: var(--brand-soft); }

.bar { background: var(--bg-2); border-radius: 6px; height: 8px; min-width: 120px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #8b5cf6); border-radius: 6px; }

.ring { --p: 0; --c: var(--brand); width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-2) 0); }
.ring > div { width: 68px; height: 68px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 750; font-size: 1rem; }
.oee-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.oee-parts { display: grid; gap: 8px; flex: 1; min-width: 160px; }
.oee-parts div { display: grid; grid-template-columns: 96px 1fr 46px; gap: 8px; align-items: center; font-size: .82rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottombar) + 20px); transform: translateX(-50%); z-index: 40;
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 14px; max-width: 92vw; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-lg); animation: up .2s ease-out;
}
.toast.ok { background: #15803d; }
.toast.error { background: #b91c1c; }
@media (min-width: 960px) { .toast { bottom: 24px; } }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; height: 96px; margin: 12px var(--gutter); border: 1px solid var(--line); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- wider screens ---------- */
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .line-cells { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 22px; max-height: 88vh; }
  .modal::before { display: none; }
  .modal-head { padding-top: 16px; }
  .modal-foot button { flex: 0 0 auto; }
  .quick { grid-template-columns: repeat(8, 1fr); }
  h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- type-to-search picker ---------- */
.combo { position: relative; }
.combo.picked .search { border-color: var(--brand); background-color: var(--brand-soft); font-weight: 600; }
.combo-list { display: none; position: absolute; z-index: 35; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.combo-list.open { display: block; }
.combo-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 12px; min-height: 0; font-weight: 500; }
.combo-item:last-child { border-bottom: 0; }
.combo-item:hover, .combo-item:focus { background: var(--brand-soft); }
.combo-item b { display: block; font-weight: 650; }
.combo-item small { display: block; }
.combo-empty { padding: 12px; color: var(--muted); font-size: .88rem; }
.req::after { content: " *"; color: var(--bad); }
.meas-grid { display: grid; gap: 10px; }
.meas-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.meas-row.fail { border-color: var(--bad); background: var(--bad-soft); }
.meas-row.pass { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.meas-row b { display: block; }
.meas-row small { color: var(--muted); }
.okng { display: flex; gap: 6px; }
.okng button { flex: 1; min-height: 40px; padding: 0 8px; }
.okng button.on.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.okng button.on.ng { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.diff { font-size: .8rem; } .diff del { color: var(--bad); } .diff ins { color: var(--ok); text-decoration: none; }
.toolbar.period input[type=date] { width: auto; min-height: 38px; padding: 6px 10px; }
.toolbar.period label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.export-btns button { min-height: 34px; }
.master-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px var(--gutter) 12px; }
@media (min-width: 720px) { .master-groups { grid-template-columns: repeat(6, 1fr); } }
.master-groups button { flex-direction: column; gap: 6px; padding: 12px 6px; min-height: 0; border-radius: var(--radius); font-size: .8rem; background: var(--panel); box-shadow: var(--shadow); }
.master-groups button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.master-groups .tile-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }

.gdt-frame { display: inline-flex; margin: 4px 0 2px; padding: 2px 8px; border: 1.5px solid var(--ink, currentColor); border-radius: 3px; font: 600 13px/1.4 ui-monospace, "Segoe UI Symbol", monospace; letter-spacing: .5px; width: fit-content; }
.meas-row > div:first-child { display: flex; flex-direction: column; }

/* ---------- in-app alert centre ---------- */
.icon-btn.bell { position: relative; }
.bell-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn, #f59e0b); color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center; }
.bell-badge.hot { background: var(--bad, #e11d48); animation: bellpulse 1.6s ease-in-out infinite; }
@keyframes bellpulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--bad, #e11d48) 25%, transparent); } }
.live-alerts { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius, 14px); border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; }
.live-alerts.hot { border-color: var(--bad); background: var(--bad-soft); }
.live-alerts .grow { display: flex; flex-direction: column; min-width: 0; }
.live-alerts .grow span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-list { gap: 10px; }
.alert-item { border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); padding: 10px 12px; background: var(--panel-2); }
.alert-item.st-open { border-left: 4px solid var(--bad); }
.alert-item.st-ack { border-left: 4px solid var(--warn, #f59e0b); }
.alert-item.st-progress { border-left: 4px solid var(--brand); }
.alert-item-head { display: flex; gap: 10px; align-items: flex-start; }
.alert-item-head .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.alert-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; margin: 8px 0 4px; font-size: .85rem; }
.alert-lines div { display: flex; flex-direction: column; } .alert-lines span { color: var(--muted); font-size: .78rem; }
.alert-hist { display: grid; gap: 6px; margin: 6px 0; font-size: .85rem; }
[hidden] { display: none !important; }
@media (min-width: 900px) { .subnav { flex-wrap: wrap; overflow-x: visible; } }

/* ---------- collapsible side menu ---------- */
@media (min-width: 960px) {
  .sidebar { overflow-y: auto; transition: width .18s ease; }
  .main { transition: margin-left .18s ease; }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sidebar-nav { display: flex; flex-direction: column; }
  .nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-toggle { flex: none; }
  html.nav-collapsed { --sidebar: 72px; }
  html.nav-collapsed .sidebar:not(:hover) { padding: 14px 10px; }
  html.nav-collapsed .sidebar:not(:hover) .sidebar-head { flex-direction: column; }
  html.nav-collapsed .sidebar:not(:hover) .logo-text, html.nav-collapsed .sidebar:not(:hover) .nav-text, html.nav-collapsed .sidebar:not(:hover) .sidebar-foot .who { display: none; }
  html.nav-collapsed .sidebar:not(:hover) .nav-toggle svg { transform: scaleX(-1); }
  html.nav-collapsed .sidebar:not(:hover) .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  html.nav-collapsed .sidebar:not(:hover) .nav-group-title { display: none; }
  html.nav-collapsed .sidebar:not(:hover) .nav-link { justify-content: center; padding: 10px 0; }
  html.nav-collapsed .sidebar:not(:hover) .sidebar-foot { flex-direction: column; padding: 10px 0 0; }
}
@media (max-width: 959px) { .nav-toggle { display: none; } }
@media (min-width: 960px) { html.nav-collapsed .content { max-width: 1480px; } }
.calloff + .calloff { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.calloff-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }

/* ================= professional report & planning layout ================= */
.rpt-layout { display: block; }
.rpt-nav { display: none; }
.rpt-select { display: block; margin: 4px var(--gutter) 8px; }
.rpt-select select { width: 100%; font-weight: 650; }
@media (min-width: 1100px) {
  .rpt-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 4px; align-items: start; margin-left: var(--gutter); }
  .rpt-select { display: none; }
  .rpt-nav { display: block; position: sticky; top: 72px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 12px; box-shadow: var(--shadow); }
  .rpt-nav .g { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 8px 4px; }
  .rpt-nav .g:first-child { padding-top: 2px; }
  .rpt-nav button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; font-weight: 550; font-size: .88rem; color: var(--text); min-height: 0; box-shadow: none; }
  .rpt-nav button:hover { background: var(--panel-2); }
  .rpt-nav button.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
}
.rpt-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px var(--gutter) 0; }
.rpt-title h2 { font-size: 1.15rem; margin: 0; }
.rpt-title p { margin: 0; color: var(--muted); font-size: .85rem; }

.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px var(--gutter);
  padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.fb-left, .fb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-field { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.fb-field select, .fb-field input { min-height: 34px; padding: 4px 8px; width: auto; font-size: .86rem; color: var(--text); }
.fb-sep { width: 1px; height: 22px; background: var(--line); }
.filter-bar button.small { min-height: 34px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel-2); }
.seg button { border: 0; border-radius: 0; background: none; min-height: 32px; padding: 4px 12px; font-size: .84rem; font-weight: 600; color: var(--muted); box-shadow: none; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--panel); color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.ms { position: relative; }
.ms-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; font-size: .84rem; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; box-shadow: none; }
.ms-btn .ms-label { color: var(--muted); font-weight: 600; }
.ms-btn b { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.ms-caret { color: var(--muted); font-size: .7rem; }
.ms-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(300px, 86vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; }
.ms-pop .search { margin-bottom: 6px; min-height: 34px; }
.ms-list { max-height: 260px; overflow: auto; }
.ms-item { display: flex; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 8px; font-size: .88rem; cursor: pointer; }
.ms-item:hover { background: var(--panel-2); }
.ms-foot { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }

/* quieter KPI row: no gradient, accent rule, tighter */
.pro .stats { gap: 10px; }
@media (min-width: 960px) { .pro .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pro .stat { padding: 12px 14px 12px 16px; box-shadow: none; }
.pro .stat::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--line); }
.pro .stat.hero { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.pro .stat.hero::before { background: var(--brand); }
.pro .stat.hero .stat-label, .pro .stat.hero small { color: var(--muted); }
.pro .stat.hero .stat-ic { background: var(--brand-soft); color: var(--brand); }
.pro .stat-top { position: absolute; top: 12px; right: 12px; margin: 0; }
.pro .stat-ic { width: 28px; height: 28px; border-radius: 8px; }
.pro .stat-ic svg { width: 15px; height: 15px; }
.pro .stat-value { font-size: 1.35rem; padding-right: 34px; }
.pro .stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; margin-top: 4px; }
.pro .stat small { font-size: .78rem; color: var(--muted); }
.pro .card { box-shadow: none; padding: 14px 16px; }
.pro .card-head h2 { font-size: .95rem; }
.pro .card .table-wrap, .pro .card .table-block .table-wrap { margin: 0; box-shadow: none; }
.pro table { font-size: .84rem; }
.pro th, .pro td { padding: 8px 10px; }
.pro tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.pro tbody tr:hover td { background: var(--brand-soft); }
.pro td:first-child, .pro th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.pro th:first-child { background: var(--panel-2); z-index: 2; }
.pro .notice { font-weight: 500; font-size: .86rem; padding: 10px 12px; }
.pro .grid { gap: 12px; }
.table-block .row-more { display: none; }
.table-block .show-all .row-more, .table-block.show-all .row-more { display: table-row; }
.table-block .table-wrap.show-all .row-more { display: table-row; }
.table-more { margin: 8px 0 0; }
.assess { display: flex; flex-direction: column; gap: 2px; white-space: normal; min-width: 230px; max-width: 360px; }
.assess small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.assess .sep { display: none; }
.badge { display: inline-block; width: fit-content; padding: 2px 8px; border-radius: 6px; font-size: .76rem; font-weight: 650; line-height: 1.5; }
.badge.neutral { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.howto { margin: 4px var(--gutter) 20px; color: var(--muted); font-size: .84rem; }
.howto summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.howto summary svg { width: 14px; height: 14px; }
.howto p { margin: 8px 0 0; line-height: 1.5; max-width: 900px; }
.cell-sub { display: block; color: var(--muted); font-size: .76rem; }

.fb-field input[type=date] { width: 150px; }
@media (max-width: 600px) {
  .pro .stat-top { display: none; }
  .pro .stat-value { font-size: 1.08rem; padding-right: 0; overflow-wrap: anywhere; }
  .pro .stat-label { font-size: .68rem; }
  .filter-bar { padding: 8px; }
}

/* ================= BI reports ================= */
.bi { --bi-ink: #1f2937; --bi-band: #1b2333; --bi-band-2: #252f44; font-family: "Segoe UI", Inter, system-ui, sans-serif; padding-bottom: 24px; }
.bi-band { background: linear-gradient(180deg, var(--bi-band), var(--bi-band-2)); color: #e5e9f2; padding: 14px var(--gutter) 12px; border-bottom: 3px solid #118DFF; }
.bi-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.bi-crumb { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #8fa3c7; font-weight: 700; }
.bi-band h1 { margin: 2px 0 0; color: #fff; font-size: 1.35rem; font-weight: 650; letter-spacing: -.01em; }
.bi-actions .export-btns button { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff; min-height: 32px; }
.bi-actions .export-btns button:hover { background: rgba(255,255,255,.16); }
.bi-actions svg.i { color: #fff; }
.bi-slicers { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.bi-slicer { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: #a8b6d1; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.bi-select, .bi-date { min-height: 32px; padding: 3px 8px; width: auto; font-size: .86rem; background: #0f1623; color: #fff; border: 1px solid #3a4760; border-radius: 6px; text-transform: none; letter-spacing: 0; }
.bi-date { width: 145px; color-scheme: dark; }
.bi-slicer .seg { background: #0f1623; border-color: #3a4760; border-radius: 6px; }
.bi-slicer .seg button { color: #a8b6d1; }
.bi-slicer .seg button + button { border-left-color: #3a4760; }
.bi-slicer .seg button.on { background: #118DFF; color: #fff; box-shadow: none; }
.bi-slicer .ms-btn { background: #0f1623; border-color: #3a4760; color: #fff; border-radius: 6px; min-height: 32px; text-transform: none; letter-spacing: 0; }
.bi-slicer .ms-btn .ms-label { color: #a8b6d1; }
.bi-slicer .ms-btn.on { border-color: #118DFF; background: #0f2a4a; color: #fff; }
.bi-slicer .ms-pop { color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; }
.bi-compare { margin-left: auto; font-size: .78rem; color: #8fa3c7; }
.bi-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 var(--gutter); }
.bi-tabgroup { display: flex; align-items: stretch; flex: none; }
.bi-tabgroup + .bi-tabgroup { border-left: 1px solid var(--line); margin-left: 6px; padding-left: 6px; }
.bi-tabgroup-label { align-self: center; font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 750; padding: 0 6px; }
.bi-tabs button { border: 0; background: none; border-radius: 0; box-shadow: none; min-height: 40px; padding: 0 12px; font-size: .86rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.bi-tabs button:hover { color: var(--text); background: var(--panel-2); }
.bi-tabs button.on { color: #118DFF; border-bottom-color: #118DFF; }
.bi .bi-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px var(--gutter) 8px; }
@media (min-width: 720px) { .bi .bi-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; border-top: 3px solid #118DFF; min-width: 0; }
.kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 4px; }
.kpi-value { font-size: 1.5rem; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { width: 84px; height: 26px; flex: none; }
.spark polyline { fill: none; stroke: #118DFF; stroke-width: 1.6; stroke-linejoin: round; }
.kpi-foot { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.kpi-sub { overflow: hidden; text-overflow: ellipsis; }
.kpi-delta { font-weight: 700; padding: 0 5px; border-radius: 3px; }
.kpi-delta.good { color: #0e7a3a; background: #dcf5e6; }
.kpi-delta.bad { color: #b42318; background: #fde4e1; }
.kpi-delta.flat { color: var(--muted); background: var(--panel-2); }
.bi-canvas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin: 0 var(--gutter); }
.bi-canvas > * { grid-column: span 12; }
@media (min-width: 960px) {
  .bi-canvas > .s4 { grid-column: span 4; } .bi-canvas > .s5 { grid-column: span 5; } .bi-canvas > .s6 { grid-column: span 6; }
  .bi-canvas > .s7 { grid-column: span 7; } .bi-canvas > .s8 { grid-column: span 8; }
}
.bi .viz { margin: 0; border-radius: 4px; box-shadow: none; padding: 10px 12px 12px; display: flex; flex-direction: column; min-width: 0; }
.viz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.viz-head h2 { font-size: .86rem; font-weight: 650; margin: 0; color: var(--text); }
.viz-note { font-size: .74rem; color: var(--muted); }
.viz-empty { color: var(--muted); font-size: .84rem; padding: 14px 4px; }
.bi .chart-box { height: 230px; } .bi .chart-box.lg { height: 290px; }
.bi .table-wrap { margin: 0; border-radius: 3px; box-shadow: none; border-color: var(--line); }
.bi table { font-size: .82rem; }
.bi th, .bi td { padding: 6px 9px; }
.bi th { font-size: .68rem; background: var(--panel-2); }
.bi tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.bi tbody tr:hover td { background: #e8f3ff; }
.bi tfoot td { font-weight: 700; background: var(--panel-2); border-top: 2px solid var(--text); border-bottom: 0; }
.bi td:first-child, .bi th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.bi th:first-child, .bi tfoot td:first-child { background: var(--panel-2); }
.bi .empty { padding: 12px; border: 0; background: none; font-size: .84rem; text-align: left; color: var(--muted); }
.bi-note { display: flex; gap: 8px; align-items: center; background: #fff7e6; color: #8a5a00; border: 1px solid #f5d9a0; border-radius: 4px; padding: 8px 10px; font-size: .84rem; }
.bi-nodata { margin: 4px var(--gutter); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid #D9B300; border-radius: 4px; font-size: .88rem; }
.bi .assess { min-width: 210px; }
.bi .badge { border-radius: 3px; }
@media (max-width: 600px) { .bi-compare { margin-left: 0; width: 100%; } .kpi-value { font-size: 1.15rem; } .spark { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bi tbody tr:hover td { background: #1c2b44; } :root:not([data-theme="light"]) .bi-note { background: #2a2210; color: #f5c56b; border-color: #5a4415; } }
:root[data-theme="dark"] .bi tbody tr:hover td { background: #1c2b44; }

/* ================= app-wide professional look ================= */
.page-band { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 0 0 4px; padding: 14px var(--gutter) 12px;
  background: linear-gradient(180deg, #1b2333, #252f44); color: #e5e9f2; border-bottom: 3px solid #118DFF; }
.page-band h1 { margin: 2px 0 0; color: #fff; font-size: 1.35rem; font-weight: 650; letter-spacing: -.01em; }
.page-band p { margin: 2px 0 0; color: #a8b6d1; font-size: .85rem; }
.page-band .pb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-band .pb-actions button:not(.primary) { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff; }
.page-band .pb-actions svg.i { color: inherit; }
.content.pro { max-width: none; }
@media (min-width: 960px) { .content.pro > :not(.page-band):not(.bi) { max-width: 1400px; } }
.pro .subnav { gap: 2px; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); background: var(--panel); margin-bottom: 4px; }
.pro .subnav button { border: 0; border-radius: 0; background: none; box-shadow: none; min-height: 40px; padding: 0 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.pro .subnav button.active { background: none; color: #118DFF; border-bottom-color: #118DFF; }
.pro .stat { border-radius: 4px; border-top: 3px solid #118DFF; }
.pro .stat::before { display: none; }
.pro .stat.hero { border-top-color: #12239E; }
.pro .stat.tone-bad { border-top-color: #D64550; } .pro .stat.tone-ok { border-top-color: #1AAB40; }
.pro .card { border-radius: 4px; }
.pro .card .card-head h2 { font-size: .9rem; }
.pro .table-wrap { border-radius: 3px; }
.pro .rows { border-radius: 4px; }
.pro .notice, .pro .alert { border-radius: 4px; }
.pro .toolbar { margin-top: 10px; }
.pro .row { border-radius: 4px; }
.pro tfoot td { font-weight: 700; background: var(--panel-2); border-top: 2px solid var(--text); }

.kpi { position: relative; }
.kpi .spark { position: absolute; top: 10px; right: 10px; width: 64px; height: 20px; opacity: .9; }
.kpi .spark + .kpi-label { padding-right: 70px; }
.kpi-value { overflow: visible; text-overflow: clip; }
@media (min-width: 720px) { .bi .bi-kpis { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); } }

/* toolbars as a quiet filter strip; primary buttons in the report blue */
.pro > .toolbar, .pro > div > .toolbar { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.pro .toolbar.period { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.page-band .pb-actions button.primary, .pro button.primary { background: #118DFF; border-color: #118DFF; box-shadow: none; }
.page-band .pb-actions button.primary:hover, .pro button.primary:hover { background: #0b74d6; }
.pro .empty { border-radius: 4px; padding: 18px; }
.pro .stats { margin-top: 12px; }
.kpi-label { white-space: normal; line-height: 1.25; min-height: 1.25em; }
.cell-wrap { white-space: normal; display: inline-block; min-width: 140px; max-width: 280px; line-height: 1.3; }
.pro .card > .table-wrap, .pro .card > .table-block { margin: 0; }
tr.clickable { cursor: pointer; }


/* ================= v3: auto-hide sidebar, single page title, table filters, document view ================= */
@media (min-width: 960px) {
  html.nav-collapsed .sidebar { transition: width .18s ease .12s, box-shadow .18s ease .12s; }
  html.nav-collapsed .sidebar:hover { width: 248px; z-index: 60; box-shadow: 10px 0 36px rgba(15, 23, 42, .22); }
  html.nav-collapsed .sidebar:hover .nav-toggle svg { transform: none; }
}
.topbar .page-title { visibility: hidden; }

.table-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 var(--gutter) 10px; }
.table-filters .tf-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-filters .tf-select { width: auto; max-width: 220px; min-height: 0; padding: 6px 28px 6px 10px; font-size: .84rem; border-radius: 8px; }
.table-filters .tf-select.on { border-color: var(--brand); color: var(--brand); font-weight: 650; background-color: var(--brand-soft); }
.table-filters .tf-count { margin-left: auto; font-size: .8rem; color: var(--muted); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--brand); }
td.tf-none { text-align: center; color: var(--muted); padding: 22px; }

.modal.modal-wide { width: min(1120px, calc(100vw - 24px)); max-width: none; }
.doc-view .dv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.doc-view .dv-type { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.doc-view .dv-no { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; margin: 2px 0; }
.doc-view .dv-party { color: var(--muted); font-size: .9rem; }
.doc-view .dv-status .chip { font-size: .8rem; padding: 4px 12px; }
.doc-view .dv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 4px; }
.doc-view .dv-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.doc-view .dv-kpi span { display: block; font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.doc-view .dv-kpi b { font-size: 1.15rem; }
.doc-view .dv-kpi.ok b { color: #15803d; }
.doc-view .dv-kpi.warn b { color: #b45309; }
.doc-view .dv-kpi.bad b { color: #dc2626; }
.doc-view .dv-section { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.doc-view .dv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 22px; }
.doc-view .dv-field span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.doc-view .dv-field b { font-weight: 600; word-break: break-word; }
.doc-view .table-wrap { margin: 0; box-shadow: none; }
.doc-view td.wrap { white-space: normal; min-width: 200px; }
.doc-view .muted-line { display: block; color: var(--muted); font-size: .78rem; white-space: normal; }
.doc-view .qc-bar { display: flex; height: 6px; min-width: 110px; margin-top: 5px; border-radius: 3px; overflow: hidden; background: var(--line); }
.doc-view .qc-bar i { display: block; height: 100%; }
.doc-view .qc-bar .a { background: #16a34a; }
.doc-view .qc-bar .r { background: #dc2626; }
.doc-view .dv-history { margin: 0; padding-left: 18px; }
.doc-view .dv-history li { margin: 4px 0; }
.chip.chip-partial { background: #fef3c7; color: #92400e; }


/* ================= v4: merged top bar, performance, 8D/CAPA, HR ================= */
.topbar { background: #1b2333; color: #e5e9f2; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.topbar .icon-btn { color: #e5e9f2; background: transparent; border-color: rgba(255, 255, 255, .16); }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .08); }
.topbar + .content > .page-band:first-child { padding-top: 2px; }
.txt-bad { color: #dc2626; font-weight: 650; }
.chip.doc-invoice { background: #dbeafe; color: #1e40af; }
.chip.doc-dc { background: #ede9fe; color: #5b21b6; }

.perf-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 var(--gutter) 12px; padding: 12px 14px; }
.perf-period label { display: flex; flex-direction: column; gap: 3px; font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.perf-period input { min-height: 0; padding: 6px 10px; }
.perf-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.perf-tabs { display: flex; gap: 2px; margin: 6px var(--gutter) 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.perf-tab { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; font-weight: 650; color: var(--muted); white-space: nowrap; min-height: 0; box-shadow: none; }
.perf-tab:hover { color: var(--text); }
.perf-tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.perf-hl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 0 var(--gutter) 12px; }
.hl { border: 1px solid var(--line); border-left: 4px solid #118DFF; border-radius: 10px; padding: 10px 14px; background: var(--panel); cursor: pointer; }
.hl span { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hl b { display: block; font-size: 1rem; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl small { color: var(--muted); }
.hl.green { border-left-color: #16a34a; } .hl.red { border-left-color: #dc2626; } .hl.violet { border-left-color: #7c3aed; }
.perf-bars { margin: 0 var(--gutter) 14px; padding: 14px 16px; }
.perf-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.perf-card-head h3 { margin: 0; font-size: .95rem; }
.legend { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend i.ok, .pbar i.ok, .tbar i.ok { background: #118DFF; }
.legend i.rej, .pbar i.rej, .tbar i.rej { background: #ef4444; }
.pbar-row { display: grid; grid-template-columns: minmax(100px, 230px) 1fr auto; gap: 10px; align-items: center; padding: 4px 0; cursor: pointer; }
.pbar-row:hover .pbar-name { color: var(--brand); }
.pbar-row.static { cursor: default; }
.pbar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; }
.pbar { display: flex; height: 12px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.pbar i { display: block; height: 100%; }
.pbar-val { font-size: .84rem; font-weight: 650; white-space: nowrap; }
.pbar-val small { color: #dc2626; font-weight: 500; }
.perf-table-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px var(--gutter) 8px; }
.perf-table-head h3 { margin: 0; font-size: 1rem; }
.perf-table-head small { color: var(--muted); }
.metric { font-weight: 650; } .metric.good { color: #15803d; } .metric.mid { color: #b45309; } .metric.bad { color: #dc2626; }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 6px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tcol { flex: 1 0 14px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.tbar { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.tbar i { display: block; width: 100%; }
.tcol small { font-size: .6rem; color: var(--muted); }
.perf-split { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 800px) { .perf-split { grid-template-columns: 1fr 1fr; } }

.d-dots { display: inline-flex; align-items: center; gap: 3px; }
.d-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.d-dots i.done { background: #16a34a; } .d-dots i.now { background: #f59e0b; }
.d-dots small { margin-left: 6px; color: var(--muted); }
.eightd .d-sec { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--panel); }
.d-sec-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.d-code { background: #1b2333; color: #fff; font-weight: 700; border-radius: 6px; padding: 4px 8px; font-size: .8rem; }
.d-sec-head h4 { margin: 0; font-size: .95rem; }
.d-sec-head small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.form-grid .field.wide, .eightd .field.wide { grid-column: 1 / -1; }
.eightd textarea, .eightd input:not([type="checkbox"]), .eightd select, .form-grid textarea, .form-grid input, .form-grid select { width: 100%; }
.act-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.act-row { display: grid; grid-template-columns: 24px minmax(180px, 3fr) minmax(100px, 1fr) 140px 120px 32px; gap: 6px; align-items: center; }
.act-n { color: var(--muted); font-weight: 650; text-align: center; }
@media (max-width: 720px) { .act-row { grid-template-columns: 24px 1fr 1fr; } }
.fishbone { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-bottom: 12px; }
.fb-cell span, .why span { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.why-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 10px; }
@media (min-width: 800px) { .why-grid { grid-template-columns: 1fr 1fr; } }
.why { display: block; margin-bottom: 6px; }
.doc-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; }
.chk input { width: auto; min-height: 0; }

.att-card { margin: 0 var(--gutter) 14px; padding: 14px; }
.att-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.att-bulk { display: flex; gap: 6px; align-items: center; margin-left: auto; font-size: .85rem; color: var(--muted); }
.att-card .table-wrap { margin: 0; }
.att-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.att-pill { min-height: 0; padding: 5px 9px; font-size: .78rem; font-weight: 700; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); box-shadow: none; }
.att-pill.on.att-P { background: #16a34a; color: #fff; border-color: #16a34a; }
.att-pill.on.att-A { background: #dc2626; color: #fff; border-color: #dc2626; }
.att-pill.on.att-HD { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.att-pill.on.att-L { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.att-pill.on.att-WO, .att-pill.on.att-H { background: #64748b; color: #fff; border-color: #64748b; }
.att-ot { width: 80px; min-height: 0; padding: 5px 8px; }
.att-shift { width: auto; min-height: 0; padding: 5px 8px; }
.att-save { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px var(--gutter) 0; flex-wrap: wrap; }
.att-card .att-save { margin: 10px 0 0; }
.att-reg td, .att-reg th { padding: 6px 5px; font-size: .78rem; }
.att-cell.att-P { color: #15803d; font-weight: 700; } .att-cell.att-A { color: #dc2626; font-weight: 700; background: #fee2e2; }
.att-cell.att-HD { color: #b45309; } .att-cell.att-L { color: #7c3aed; } .att-cell.att-WO, .att-cell.att-H { color: #64748b; }
.inline-month { margin: 0; }
.inline-month input { min-height: 0; padding: 6px 10px; }
.skill-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 var(--gutter) 12px; padding: 10px 14px; font-size: .85rem; }
.skill-legend span { display: inline-flex; gap: 6px; align-items: center; }
.lvl { min-width: 32px; min-height: 0; padding: 5px 0; border-radius: 6px; font-weight: 700; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); text-align: center; display: inline-block; box-shadow: none; }
.lvl-1 { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.lvl-2 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.lvl-3 { background: #bbf7d0; color: #166534; border-color: #86efac; }
.lvl-4 { background: #15803d; color: #fff; border-color: #15803d; }
.skill-matrix th.rot { height: 130px; vertical-align: bottom; }
.skill-matrix th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.lvl-td { text-align: center; }
.pay-in { width: 100px; min-height: 0; padding: 5px 8px; text-align: right; }
.pay-help { margin: 0 var(--gutter) 8px; }


/* ================= v5: company logo, consistent spacing, table tools ================= */
.logo-mark.logo-img { background: #fff; border-radius: 10px; padding: 3px; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px var(--line); flex: none; }
.logo-mark.logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-big .logo-mark.logo-img, .auth-card .logo-mark.logo-img { width: 72px; height: 72px; border-radius: 16px; }

/* one rhythm for every page: sections separated by an even gap */
.content.pro { display: flex; flex-direction: column; gap: 18px; padding-bottom: 48px; }
.content.pro > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.content.pro > .page-band { margin-bottom: -4px !important; }
.pro .stats { gap: 14px; }
@media (min-width: 960px) { .content.pro .stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
.pro .stat { padding: 14px 16px; }
.content.pro > .card, .content.pro > section.card { padding: 16px 18px; }
.perf-tabs { margin-top: 0; margin-bottom: 0; }
.perf-table-head { margin: 0 var(--gutter); }

/* tables: own toolbar (filters, count, export), roomier cells, serial column */
.table-block { display: flex; flex-direction: column; gap: 10px; }
.table-filters { margin: 0 var(--gutter); padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.table-tools { display: flex; gap: 6px; margin-left: 6px; }
.table-tools button { min-height: 0; padding: 5px 10px; font-size: .8rem; }
th, td { padding: 11px 14px; }
th.sn, td.sn { width: 1%; color: var(--muted); text-align: right; padding-right: 10px; }
.doc-view .table-filters, .modal .table-filters { margin: 0; }
.modal .table-block { gap: 8px; }


/* ================= v6: one layout system ================= */
/* page rhythm */
.content.pro { gap: 16px; }
.content.pro > .page-band { margin-bottom: 0 !important; }
.page-band { padding: 16px var(--gutter) 14px; }
.page-band h1 { font-size: 1.3rem; }
.page-band p { font-size: .84rem; }
.pb-actions button { min-height: 36px; }

/* tabs: one underline style wherever a page has sections */
.seg:not(.pb-seg), .subnav, .perf-tabs, .pills.tabs { display: flex; gap: 0; margin: 0 var(--gutter); border-bottom: 1px solid var(--line); overflow-x: auto; background: none; padding: 0; border-radius: 0; box-shadow: none; }
.seg:not(.pb-seg) > button, .subnav > a, .subnav > button, .perf-tabs > button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; font-weight: 650; color: var(--muted); white-space: nowrap; min-height: 0; box-shadow: none; margin: 0; }
.seg:not(.pb-seg) > button.on, .subnav > .active, .subnav > .on, .perf-tabs > button.on { color: var(--brand); border-bottom-color: var(--brand); background: none; }
.toolbar:has(> .seg:only-child) { padding: 0; margin: 0; background: none; border: 0; box-shadow: none; }

/* KPI tiles: 4 per row on desktop, 2 on phone, same height */
.stats, .pro .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 var(--gutter); }
@media (min-width: 960px) { .stats, .pro .stats, .content.pro .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px 16px; }
.stat .stat-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .stat-label { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat small { color: var(--muted); font-size: .76rem; }
.modal .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }

/* filters: one bar style for toolbar / filter-bar / period bar */
.toolbar, .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 var(--gutter); padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.filter-bar .fb-left, .filter-bar .fb-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-bar .fb-right { margin-left: auto; }
.fb-label, .fb-field > span, .rp-flabel { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toolbar input, .toolbar select, .filter-bar input, .filter-bar select { min-height: 36px; }
.toolbar .search, .filter-bar .search { flex: 1 1 220px; max-width: 360px; }
.seg.pb-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.seg.pb-seg > button { border: 0; border-radius: 0; background: none; padding: 7px 12px; font-size: .82rem; font-weight: 600; color: var(--muted); min-height: 0; box-shadow: none; }
.seg.pb-seg > button + button { border-left: 1px solid var(--line); }
.seg.pb-seg > button.on { background: var(--brand); color: #fff; }
.pb-dates { display: none; gap: 8px; align-items: center; }
.pb-dates.on { display: inline-flex; }
.pb-dates label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.pb-dates input { min-height: 32px; padding: 4px 8px; }
.pb-text { font-size: .8rem; color: var(--muted); }
.export-btns { display: none !important; }

/* tables */
.table-block { gap: 8px; }
.table-filters { margin: 0 var(--gutter); min-height: 40px; }
.table-filters .tf-count { margin-left: 0; }
.table-filters .table-tools { margin-left: auto; }
.table-wrap { margin: 0 var(--gutter); }
th { font-size: .7rem; letter-spacing: .06em; }
th, td { padding: 10px 14px; }
td .cell-sub, td .help { display: block; font-size: .76rem; color: var(--muted); white-space: nowrap; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
tbody tr.clickable:hover td { background: var(--brand-soft); }
tfoot td { font-weight: 700; background: var(--panel-2); border-top: 2px solid var(--line); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 650; white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #166534; } .badge.warn { background: #fef3c7; color: #92400e; } .badge.bad { background: #fee2e2; color: #991b1b; } .badge.neutral { background: var(--panel-2); color: var(--muted); }

/* cards / panels */
.card, .panel, section.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: none; padding: 16px 18px; margin: 0 var(--gutter); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card h2, .card-head h2 { font-size: 1rem; margin: 0; }
.card .table-wrap, .card .table-filters, .card .toolbar, .card .filter-bar, .card .stats { margin-left: 0; margin-right: 0; }
.notice, .alert { margin: 0 var(--gutter); border-radius: 10px; }
.howto { margin: 0 var(--gutter); }
.calloff { padding-top: 10px; }

/* reports library */
.rp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 var(--gutter); padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.rp-f { display: flex; flex-direction: column; gap: 3px; }
.rp-select { min-height: 36px; padding: 6px 28px 6px 10px; border-radius: 8px; max-width: 260px; }
.rp-select.on { border-color: var(--brand); color: var(--brand); font-weight: 650; }
.rp-extra { display: contents; }
.rp-custom { display: none; gap: 8px; } .rp-custom.on { display: inline-flex; }
.rp-custom label { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.rp-range { margin-left: auto; font-size: .8rem; color: var(--muted); }
.rp-group { margin: 0 var(--gutter); }
.rp-group-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; }
.rp-group-head h2 { margin: 0; font-size: 1.05rem; }
.rp-group-head span { color: var(--muted); font-size: .84rem; }
.rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rp-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-height: 0; box-shadow: none; cursor: pointer; }
.rp-card:hover { border-color: var(--brand); box-shadow: 0 6px 22px rgba(15, 23, 42, .08); }
.rp-card-ic { font-size: 1.4rem; }
.rp-card-t { font-weight: 700; font-size: 1rem; }
.rp-card-q { color: var(--muted); font-size: .84rem; line-height: 1.35; min-height: 2.6em; }
.rp-card-k { margin-top: 8px; } .rp-card-k b { font-size: 1.3rem; display: block; } .rp-card-k small { color: var(--muted); }
.rp-card-go { margin-top: 8px; color: var(--brand); font-weight: 650; font-size: .84rem; }
.rp-summary { margin: 0 var(--gutter); padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--panel); }
.rp-sum-head { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.rp-summary ul { margin: 0; padding-left: 18px; } .rp-summary li { margin: 3px 0; line-height: 1.45; }
.rp-todo { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 var(--gutter); }
@media (min-width: 960px) { .rp-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.rp-kpi { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px 14px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; }
.rp-kpi-l { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rp-kpi-v { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-kpi-s { display: flex; gap: 8px; align-items: center; font-size: .76rem; color: var(--muted); min-height: 1.2em; }
.rp-delta { font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.rp-delta.good { background: #dcfce7; color: #166534; } .rp-delta.bad { background: #fee2e2; color: #991b1b; } .rp-delta.flat { background: var(--panel-2); }
.rp-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 0 var(--gutter); }
@media (min-width: 960px) { .rp-grid { grid-template-columns: 1fr 1fr; } .rp-sec.wide { grid-column: 1 / -1; } .rp-sec:has(.table-block) { grid-column: 1 / -1; } }
.rp-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 16px; min-width: 0; }
.rp-sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.rp-sec-head h3 { margin: 0; font-size: .98rem; } .rp-sec-head p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.rp-sec-tools { display: flex; gap: 6px; flex: none; } .rp-sec-tools button { min-height: 0; padding: 5px 10px; font-size: .78rem; }
.rp-sec .table-wrap, .rp-sec .table-filters { margin: 0; }
.rp-chart svg { overflow: visible; }


/* ================= v7: smooth sidebar peek, hidden one-time tools ================= */
@media (min-width: 960px) {
  /* collapsed width never changes while peeking, so the page never shifts */
  html.nav-collapsed .sidebar { width: var(--sidebar); transition: width .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s; will-change: width; overflow: hidden; }
  html.nav-collapsed.nav-peek .sidebar { width: 252px; box-shadow: 12px 0 40px rgba(15, 23, 42, .25); z-index: 80; padding: 14px 12px; }
  /* labels fade instead of popping (no display toggling) */
  html.nav-collapsed .sidebar .nav-text, html.nav-collapsed .sidebar .logo-text, html.nav-collapsed .sidebar .sidebar-foot .who, html.nav-collapsed .sidebar .nav-group-title {
    display: block !important; opacity: 0; max-width: 0; overflow: hidden; white-space: nowrap; transition: opacity .16s ease .06s, max-width .22s ease; }
  html.nav-collapsed .sidebar .nav-group-title { height: 0; margin: 0; padding: 0; }
  html.nav-collapsed.nav-peek .sidebar .nav-text, html.nav-collapsed.nav-peek .sidebar .logo-text, html.nav-collapsed.nav-peek .sidebar .sidebar-foot .who, html.nav-collapsed.nav-peek .sidebar .nav-group-title {
    opacity: 1; max-width: 200px; }
  html.nav-collapsed.nav-peek .sidebar .nav-group-title { height: auto; margin: 14px 0 4px; padding: 0 10px; }
  html.nav-collapsed .sidebar .nav-link { justify-content: flex-start; padding: 10px 12px; gap: 12px; }
  html.nav-collapsed .sidebar .nav-link svg { flex: none; }
  html.nav-collapsed .sidebar-head { flex-direction: row; align-items: center; }
  html.nav-collapsed:not(.nav-peek) .sidebar-head { flex-direction: column; }
  html.nav-collapsed.nav-peek .sidebar-foot { flex-direction: row; }
  html.nav-collapsed .sidebar:hover .nav-toggle svg { transform: scaleX(-1); }
  html.nav-collapsed .sidebar .nav-link[data-tip]:not(.peeked)::after { content: none; }
}
.setup-tools { margin: 0 var(--gutter); }
.setup-tools .rows .row { align-items: center; }


/* ================= v8: one header, one table density ================= */
/* Desktop: the top bar stops being a separate empty strip — its icons sit on the page banner itself. */
@media (min-width: 960px) {
  .main { position: relative; }
  .topbar { position: absolute; top: 0; right: 0; left: auto; width: auto; height: auto;
    background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 12px var(--gutter) 0 0; gap: 8px; z-index: 30; }
  .topbar .logo, .topbar .page-title { display: none; }
  .topbar .icon-btn, .topbar .avatar { border-color: rgba(255, 255, 255, .22); }
  .page-band { padding-right: 170px; position: relative; }
  .page-band .pb-actions { position: relative; z-index: 31; }
}

/* One table density everywhere, with column-true digits */
.table-wrap table { font-variant-numeric: tabular-nums; }
.table-wrap th, .table-wrap td { padding: 10px 14px; }
.table-wrap th.sn, .table-wrap td.sn { padding-right: 12px; white-space: nowrap; }
.table-wrap th { height: auto; white-space: nowrap; }
tfoot td[colspan] { text-align: left; }
td .chip { vertical-align: middle; }


/* ================= v9: name and code/sub-text never touch inside a table cell ================= */
.table-wrap td b + span, .table-wrap td b + small, .table-wrap td b + em, .table-wrap td b + .help, .table-wrap td b + .cell-sub { margin-left: 8px; }
.table-wrap td b + span:not(.chip):not(.badge) { font-size: .8rem; color: var(--muted); font-weight: 500; }


/* ================= v10: KPI trend charts ================= */
.rp-trends { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 960px) { .rp-trends { grid-template-columns: 1fr 1fr; } }
.rp-trend { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); min-width: 0; }
.rp-trend-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.rp-trend-head b { font-size: .92rem; }
.rp-trend-note { margin: 6px 0 0; font-size: .78rem; color: var(--muted); line-height: 1.4; }


/* ================= v11: KPI sparklines ================= */
.rp-spark { margin: 4px 0 2px; }
.rp-spark svg { overflow: visible; }
