/* ============================================================
   Theme tokens. Three states are supported:
     :root                          -> light (the default)
     @media prefers-color-scheme    -> dark, unless light is forced
     :root[data-theme="dark"|"light"] -> explicit user choice wins
   Every colour below is declared here first, so nothing is left
   defined only inside a media query.
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #1a1d21;
  --ink-2: #5a6069;
  --ink-3: #8a929c;
  --line: #e3e6ea;
  --line-strong: #b9c7bf;

  --brand: #0f4c3a;
  --brand-2: #1a6b52;
  --brand-deep: #0a3529;
  --accent: #c8a34e;
  --accent-ink: #1a1d21;
  --on-solid: #ffffff;

  /* sidebar keeps its dark green identity in both themes */
  --side-bg: #0f4c3a;
  --side-ink: #e8eeeb;
  --side-ink-2: #cfe0d9;
  --side-ink-3: #9fc2b5;
  --side-label: #7fae9d;
  --side-count: #dcebe4;
  --side-active: #1a6b52;

  --ok: #16a34a;
  --ok-2: #128a3d;
  --ok-ink: #14532d;
  --ok-bg: #f2f9f4;
  --ok-border: #cfe8d8;

  --warn: #d97706;
  --warn-ink: #8a5a12;
  --warn-bg: #fff8ec;
  --warn-bg-2: #fdefd6;
  --warn-border: #f0dcb8;

  --crit: #dc2626;
  --crit-solid: #c62828;
  --crit-solid-2: #b71c1c;
  --crit-solid-3: #8e1b1b;
  --crit-ink: #8c2f2f;
  --crit-bg: #fdf0f0;
  --crit-border: #f0c4c4;

  --info: #4338ca;
  --info-2: #2563eb;
  --info-bg: #eef2ff;
  --info-border: #dde3ff;
  --teal: #0891b2;
  --pink-ink: #9d174d;
  --pink-bg: #fdf2f8;

  --toast-bg: #1a1d21;
  --toast-ink: #ffffff;

  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.18);
  --radius: 10px;

  --s-notstarted:#8a929c; --s-progress:#2563eb; --s-waiting:#d97706;
  --s-blocked:#dc2626; --s-completed:#16a34a; --s-na:#b0b6bd;
  --sev-low:#16a34a; --sev-medium:#d97706; --sev-high:#ea580c; --sev-critical:#dc2626;
}

/* --- dark: follows the operating system unless light is forced --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1512;
    --surface: #16211d;
    --surface-2: #1c2825;
    --ink: #e8efeb;
    --ink-2: #a8bab2;
    --ink-3: #7d8f87;
    --line: #26332e;
    --line-strong: #3a4d45;

    --brand: #2c7d61;
    --brand-2: #359a77;
    --brand-deep: #071f18;
    --accent: #d3ae5c;
    --accent-ink: #12201b;
    --on-solid: #ffffff;

    --side-bg: #0c332810;
    --side-bg: #0b2c23;
    --side-ink: #dfeae5;
    --side-ink-2: #bccfc6;
    --side-ink-3: #92b3a5;
    --side-label: #74a08e;
    --side-count: #cfe0d9;
    --side-active: #1c6650;

    --ok: #4cbd83;
    --ok-2: #3da972;
    --ok-ink: #b9ecce;
    --ok-bg: #14261d;
    --ok-border: #285b41;

    --warn: #e0a552;
    --warn-ink: #f2cd93;
    --warn-bg: #2a2214;
    --warn-bg-2: #362a17;
    --warn-border: #4d3c1e;

    --crit: #ef7a72;
    --crit-solid: #c0392f;
    --crit-solid-2: #a8302a;
    --crit-solid-3: #8c2622;
    --crit-ink: #f5b3ad;
    --crit-bg: #2b1715;
    --crit-border: #5c2c28;

    --info: #a5b4fc;
    --info-2: #7aa5f7;
    --info-bg: #1b2040;
    --info-border: #313a68;
    --teal: #4cc0d8;
    --pink-ink: #f4a4c8;
    --pink-bg: #2c1622;

    --toast-bg: #e8efeb;
    --toast-ink: #12201b;

    --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg: 0 14px 44px rgba(0,0,0,.62);

    --s-notstarted:#7d8f87; --s-progress:#5b93f5; --s-waiting:#d99a3f;
    --s-blocked:#e2645b; --s-completed:#42b578; --s-na:#68786f;
    --sev-low:#4cbd83; --sev-medium:#e0a552; --sev-high:#ef8f52; --sev-critical:#ef7a72;
  }
}

/* --- dark: chosen explicitly --- */
:root[data-theme="dark"] {
  --bg: #0e1512;
  --surface: #16211d;
  --surface-2: #1c2825;
  --ink: #e8efeb;
  --ink-2: #a8bab2;
  --ink-3: #7d8f87;
  --line: #26332e;
  --line-strong: #3a4d45;

  --brand: #2c7d61;
  --brand-2: #359a77;
  --brand-deep: #071f18;
  --accent: #d3ae5c;
  --accent-ink: #12201b;
  --on-solid: #ffffff;

  --side-bg: #0b2c23;
  --side-ink: #dfeae5;
  --side-ink-2: #bccfc6;
  --side-ink-3: #92b3a5;
  --side-label: #74a08e;
  --side-count: #cfe0d9;
  --side-active: #1c6650;

  --ok: #4cbd83;
  --ok-2: #3da972;
  --ok-ink: #b9ecce;
  --ok-bg: #14261d;
  --ok-border: #285b41;

  --warn: #e0a552;
  --warn-ink: #f2cd93;
  --warn-bg: #2a2214;
  --warn-bg-2: #362a17;
  --warn-border: #4d3c1e;

  --crit: #ef7a72;
  --crit-solid: #c0392f;
  --crit-solid-2: #a8302a;
  --crit-solid-3: #8c2622;
  --crit-ink: #f5b3ad;
  --crit-bg: #2b1715;
  --crit-border: #5c2c28;

  --info: #a5b4fc;
  --info-2: #7aa5f7;
  --info-bg: #1b2040;
  --info-border: #313a68;
  --teal: #4cc0d8;
  --pink-ink: #f4a4c8;
  --pink-bg: #2c1622;

  --toast-bg: #e8efeb;
  --toast-ink: #12201b;

  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 14px 44px rgba(0,0,0,.62);

  --s-notstarted:#7d8f87; --s-progress:#5b93f5; --s-waiting:#d99a3f;
  --s-blocked:#e2645b; --s-completed:#42b578; --s-na:#68786f;
  --sev-low:#4cbd83; --sev-medium:#e0a552; --sev-high:#ef8f52; --sev-critical:#ef7a72;
}


* { box-sizing: border-box; }
/* The `hidden` attribute must always win over display:grid/flex rules below,
   otherwise hidden overlays (login screen, modals) stay painted on top. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 264px; flex-shrink: 0; background: var(--side-bg);
  color: var(--side-ink); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 24px 18px 20px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 20px;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 11px; color: var(--side-ink-3); }

/* ---------- kāya wordmark ---------- */
.wordmark { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.wordmark-name {
  font-family: 'Jost', 'Century Gothic', sans-serif; font-weight: 300;
  font-size: 34px; letter-spacing: .18em; color: var(--ink); padding-left: .18em;
}
.wordmark-sub {
  font-family: 'Jost', 'Century Gothic', sans-serif; font-weight: 400;
  font-size: 9px; letter-spacing: .34em; color: var(--ink-2);
  margin-top: 7px; padding-left: .34em;
}
.wordmark.light .wordmark-name { color: var(--on-solid); }
.wordmark.light .wordmark-sub { color: var(--side-ink-3); }
.auth-brand .wordmark { align-items: flex-start; }
.auth-brand .wordmark-name { font-size: 30px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--side-label); padding: 16px 10px 6px;
}
.nav-item {
  width: 100%; text-align: left; border: none; background: none;
  color: var(--side-ink-2); padding: 9px 10px; border-radius: 7px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; gap: 9px;
  font-family: inherit; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--on-solid); }
.nav-item.active { background: var(--side-active); color: var(--on-solid); font-weight: 500; }
.nav-ico { width: 16px; text-align: center; opacity: .85; }
.nav-item .count {
  margin-left: auto; font-size: 11px; background: rgba(255,255,255,.14);
  padding: 1px 7px; border-radius: 10px; color: var(--side-count);
}

.nav-group {
  width: 100%; display: flex; align-items: center; gap: 9px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--side-label); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  padding: 16px 10px 6px; text-align: left;
}
.nav-group:hover { color: var(--side-ink-2); }
.nav-group .caret { font-size: 9px; opacity: .9; }
.nav-group .count {
  margin-left: auto; font-size: 11px; letter-spacing: 0; text-transform: none;
  color: var(--side-count); background: rgba(255,255,255,.14); padding: 1px 7px; border-radius: 10px;
}
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); font-weight: 600; display: grid; place-items: center; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--side-ink-3); }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; flex-shrink: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#global-search {
  width: 240px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 13px; background: var(--surface-2);
}
#global-search:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-family: inherit; font-size: 13px;
  cursor: pointer; font-weight: 500;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-solid); }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--s-blocked); border-color: var(--crit-border); }
.btn.danger:hover { background: var(--crit-bg); }
.icon-btn { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink-2); padding: 4px 8px; }
.menu-toggle { display: none; }

.content { flex: 1; overflow-y: auto; padding: 22px; }

/* ---------- Dashboard ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .num { font-size: 28px; font-weight: 700; line-height: 1; }
.kpi .label { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.kpi.alert .num { color: var(--s-blocked); }
.kpi.warn .num { color: var(--s-waiting); }
.kpi.good .num { color: var(--s-completed); }
.kpi.clickable { cursor: pointer; transition: transform .08s, box-shadow .12s, border-color .12s; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,24,40,.12); border-color: var(--brand-2); }
.kpi .go { font-size: 11px; color: var(--ink-3); margin-top: 8px; opacity: 0; transition: opacity .12s; }
.kpi.clickable:hover .go { opacity: 1; }

/* ---------- greeting / my tasks ---------- */
.greeting {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px;
}
.greeting h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.greeting .pending { font-size: 14px; color: var(--ink-2); margin: 0; }
.greeting .pending b { color: var(--brand-2); font-size: 16px; }
.greeting .pending.clear { color: var(--s-completed); }
.greeting-actions { margin-top: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.disclose {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-family: inherit; font-size: 13px;
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 8px;
}
.disclose:hover { border-color: var(--brand-2); }
.disclose .caret { transition: transform .15s; display: inline-block; }
.disclose[aria-expanded="true"] .caret { transform: rotate(180deg); }
#mine-body { margin-top: 16px; border-top: 1px solid var(--line); }
#mine-body table { margin-top: 0; }

/* ---------- close period buttons ---------- */
.close-group { display: inline-flex; gap: 6px; margin-right: 4px; }
.close-btn {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); font-size: 12.5px; padding: 8px 11px;
}
.close-btn:hover { background: var(--warn-bg-2); border-color: var(--accent); }
.takings-total {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 13px 16px; margin: 6px 0 4px;
}
.takings-total span { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); font-weight: 600; }
.takings-total strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.takings-total.bad { background: var(--crit-bg); border-color: var(--crit-border); }
.takings-total.bad strong { color: var(--s-blocked); }
.danger-note {
  background: var(--crit-bg); border: 1px solid var(--crit-border); color: var(--crit-ink);
  padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.55;
}
.scope-list {
  max-height: 220px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; margin-top: 10px;
}
.scope-list table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.scope-list td { padding: 7px 12px; border-bottom: 1px solid var(--line); }
.report-meta { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px 20px; margin-bottom: 6px; }
.report-meta div span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); font-weight: 600; }
.report-meta div strong { font-size: 14px; font-weight: 500; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 10px; margin: 16px 0; }
.mini-kpi { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface-2); }
.mini-kpi .n { font-size: 20px; font-weight: 700; line-height: 1; }
.mini-kpi .l { font-size: 11px; color: var(--ink-2); margin-top: 5px; }
.mini-kpi.bad .n { color: var(--s-blocked); }
.mini-kpi.warn .n { color: var(--s-waiting); }
.mini-kpi.good .n { color: var(--s-completed); }
.period-chip {
  display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 11px;
  font-weight: 600; background: var(--info-bg); color: var(--info); text-transform: capitalize;
}
.tr-btn { font-size: 11.5px; padding: 4px 10px; margin-top: 6px; align-self: flex-start; }

/* ---------- SHIFT MODE (frontline, mobile-first) ---------- */
body.shift-mode .sidebar { display: none; }
body.shift-mode .topbar { display: none; }
body.shift-mode .content { padding: 0; background: var(--bg); }

.shift-wrap { max-width: 760px; margin: 0 auto; padding: 16px 14px 90px; }
.shift-head {
  background: var(--brand); color: var(--on-solid); padding: 18px 18px 16px;
  border-radius: 14px; margin-bottom: 14px;
}
.shift-head .hello { font-size: 20px; font-weight: 600; }
.shift-head .prog { font-size: 13px; color: var(--side-ink-3); margin-top: 4px; }
.shift-head .bar { height: 8px; background: rgba(255,255,255,.2); border-radius: 5px; margin-top: 12px; overflow: hidden; }
.shift-head .bar > span { display: block; height: 100%; background: var(--accent); transition: width .25s; }

.seg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.seg-tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 11px; padding: 12px 8px; font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; text-align: center; line-height: 1.3;
}
.seg-tab .n { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); margin-top: 3px; }
.seg-tab.active { background: var(--brand); border-color: var(--brand); color: var(--on-solid); }
.seg-tab.active .n { color: var(--side-ink-3); }

.shift-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px;
  padding: 15px 16px; margin-bottom: 11px; box-shadow: var(--shadow);
}
.shift-card.is-done { background: var(--ok-bg); border-color: var(--ok-border); }
.shift-card.has-problem { background: var(--crit-bg); border-color: var(--crit-border); }
.shift-card .txt { font-size: 15.5px; font-weight: 500; line-height: 1.4; }
.shift-card .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.shift-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 2px; margin: -16px 0 4px;
  position: sticky; top: 0; z-index: 15; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.sm-menu.exit { background: var(--brand); border-color: var(--brand); color: var(--on-solid); }
.sm-menu.exit:hover { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-solid); }
.sm-wordmark {
  font-family: 'Jost', 'Century Gothic', sans-serif; font-weight: 300;
  font-size: 22px; letter-spacing: .18em; color: var(--ink); padding-left: .18em;
}
.sm-right { display: flex; align-items: center; gap: 8px; }
.sm-menu {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 9px; padding: 9px 14px; font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.sm-menu:hover { border-color: var(--brand-2); color: var(--ink); }
/* language switch sits in the header, sized for a thumb */
#shift-lang { border-radius: 9px; overflow: hidden; }
#shift-lang button { padding: 9px 13px; font-size: 13px; }
@media (max-width: 380px) {
  .sm-menu { padding: 9px 11px; }
  .sm-wordmark { font-size: 19px; }
}

.card-top { display: flex; align-items: flex-start; gap: 10px; }
.card-top .txt { flex: 1; }
.info-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--line-strong, var(--line-strong)); background: var(--surface-2);
  color: var(--ink-2); font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; line-height: 1;
}
.info-btn:hover { border-color: var(--brand-2); color: var(--brand-2); }

.note-line {
  margin-top: 9px; font-size: 12.5px; color: var(--ink-2);
  background: var(--surface-2); border-radius: 7px; padding: 7px 10px;
}
.wait-mark { color: var(--warn-ink); font-weight: 700; font-size: 13px; margin-top: 10px; }
.shift-card.is-waiting { background: var(--warn-bg); border-color: var(--warn-border); }
.route-hint { font-size: 12px; color: var(--ink-3); margin-top: 9px; text-align: center; }
.link-btn {
  display: block; width: 100%; margin-top: 9px; background: none; border: none;
  color: var(--ink-3); font-family: inherit; font-size: 13px;
  text-decoration: underline; cursor: pointer; padding: 6px;
}
.big-btn.note { background: var(--surface-2); color: var(--ink); border: 2px solid var(--line); }
.big-btn.note:active { background: var(--line); }

/* help affordance on form labels */
.field label .help {
  border: none; background: none; color: var(--ink-3); cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700; padding: 0 0 0 5px;
}
.field label .help:hover { color: var(--brand-2); }

.shift-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.shift-actions.three { grid-template-columns: 1fr 1fr; }
.shift-actions.three .big-btn:last-child { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .shift-actions.three { grid-template-columns: 1fr 1fr 1.3fr; }
  .shift-actions.three .big-btn:last-child { grid-column: auto; }
}
.big-btn {
  border: none; border-radius: 11px; padding: 15px 10px; font-family: inherit;
  font-size: 15px; font-weight: 700; cursor: pointer; letter-spacing: .2px;
}
.big-btn.done { background: var(--ok); color: var(--on-solid); }
.big-btn.done:active { background: var(--ok-2); }
.big-btn.prob { background: var(--surface); color: var(--crit-solid); border: 2px solid var(--crit-border); }
.big-btn.prob:active { background: var(--crit-bg); }
.shift-card.is-done .big-btn.done { background: var(--ok-border); color: var(--ok-ink); }
.done-mark { color: var(--ok); font-weight: 700; font-size: 13px; margin-top: 10px; }
.prob-mark { color: var(--crit-solid); font-weight: 700; font-size: 13px; margin-top: 10px; }

.shift-foot {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--line); padding: 10px 14px;
  display: flex; gap: 10px; justify-content: center; z-index: 20;
}
.shift-foot .big-btn { flex: 1; max-width: 250px; padding: 14px 10px; font-size: 14px; }
.big-btn.emg { background: var(--crit-solid); color: var(--on-solid); }
.big-btn.idea { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.shift-toggle {
  display: block; margin: 18px auto 0; background: none; border: none;
  color: var(--ink-3); font-family: inherit; font-size: 12.5px;
  text-decoration: underline; cursor: pointer;
}
.shift-allDone { text-align: center; padding: 34px 20px; color: var(--s-completed); font-size: 16px; font-weight: 600; }

@media (min-width: 700px) { .shift-actions { grid-template-columns: 180px 180px; } }

/* ---------- kaizen strength mix ---------- */
.strength-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.strength-row .lbl { min-width: 230px; color: var(--ink-2); }
.strength-row .bar { flex: 1; height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; min-width: 80px; }
.strength-row .bar > span { display: block; height: 100%; border-radius: 5px; }
.strength-row .bar .strong { background: var(--s-completed); }
.strength-row .bar .weak { background: var(--s-waiting); }
.strength-row .val { min-width: 74px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.kpi .label strong { color: var(--ink); font-weight: 600; }
@media (max-width: 640px) { .strength-row .lbl { min-width: 140px; font-size: 12px; } }

/* ---------- safety & emergency ---------- */
.emergency-btn {
  background: var(--crit-solid); border-color: var(--crit-solid-2); color: var(--on-solid); font-weight: 700;
  letter-spacing: .4px; font-size: 12px; padding: 8px 13px; margin-right: 4px;
}
.emergency-btn:hover { background: var(--crit-solid-2); border-color: var(--crit-solid-3); color: var(--on-solid); }

/* safety strip shown on every operational sheet */
.safety-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-left: 5px solid var(--warn);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
}
.safety-strip .warn-ico { font-size: 18px; line-height: 1; }
.safety-strip .msg { font-size: 12.5px; color: var(--warn-ink); font-weight: 500; }
.safety-strip .spacer { flex: 1; }
.hz-chip {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--warn-border); color: var(--warn-ink);
}
.emg-num {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.emg-num .n {
  font-size: 24px; font-weight: 800; color: var(--crit-solid); min-width: 74px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
.emg-num .lab { flex: 1; }
.emg-num .lab strong { display: block; font-size: 13.5px; }
.emg-num .lab small { color: var(--ink-3); font-size: 11.5px; }
.emg-call {
  background: var(--crit-solid); color: var(--on-solid); border: none; border-radius: 8px;
  padding: 9px 15px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.emg-call:hover { background: var(--crit-solid-2); }
.proc { border-left: 4px solid var(--crit-solid); padding: 2px 0 2px 13px; margin-bottom: 14px; }
.proc strong { display: block; font-size: 13.5px; margin-bottom: 3px; }
.proc span { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.stopwork {
  background: var(--ok-bg); border: 1px solid var(--ok-border); border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; color: var(--ok-ink); line-height: 1.55;
}
.eq-overdue { color: var(--s-blocked); font-weight: 700; font-size: 11px; }
.eq-soon { color: var(--s-waiting); font-weight: 700; font-size: 11px; }

/* ---------- continuous improvement / review ---------- */
.st-proposed    { background:var(--s-notstarted); color:var(--on-solid); }
.st-approved    { background:var(--info-2); color:var(--on-solid); }
.st-in-progress { background:var(--warn); color:var(--on-solid); }
.st-implemented { background:var(--teal); color:var(--on-solid); }
.st-verified    { background:var(--ok); color:var(--on-solid); }
.st-rejected    { background:var(--s-na); color:var(--on-solid); }
.pdca-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; padding: 2px 7px;
  border-radius: 4px; background: var(--info-bg); color: var(--info);
}
.why-chip { font-size: 11px; padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.why-failure { background:var(--crit-bg); color:var(--crit-ink); }
.why-blocked { background:var(--warn-bg); color:var(--warn-ink); }
.why-critical_open { background:var(--pink-bg); color:var(--pink-ink); }
.spot-row { display:flex; align-items:flex-start; gap:12px; padding:12px 16px; border-bottom:1px solid var(--line); }
.spot-row .sc-main { flex:1; }
.spot-row .sc-main strong { font-size:13.5px; display:block; }
.spot-row .sc-main small { color:var(--ink-3); font-size:11.5px; }
.spot-done { color: var(--s-completed); font-weight:600; font-size:12.5px; }
.spot-fail { color: var(--s-blocked); font-weight:600; font-size:12.5px; }
.section-hd {
  font-size: 13px; font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--line);
  display:flex; align-items:center; gap:10px; background: var(--surface-2);
}
.section-hd .sub { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left:auto; }
.count-pill { background: var(--brand); color:var(--on-solid); border-radius:20px; padding:1px 9px; font-size:11.5px; }
.count-pill.zero { background: var(--ink-3); }
.count-pill.bad { background: var(--s-blocked); }

/* frequency tabs */
.freq-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 2px; }
.freq-tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 7px 13px; border-radius: 20px; font-family: inherit; font-size: 12.5px;
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 7px;
}
.freq-tab:hover { background: var(--surface-2); border-color: var(--brand-2); color: var(--ink); }
.freq-tab .n {
  font-size: 11px; background: var(--surface-2); color: var(--ink-2);
  border-radius: 10px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.freq-tab:hover .n { background: var(--ok-bg); color: var(--brand-2); }
.back-link {
  border: none; background: none; color: var(--brand-2); font-family: inherit;
  font-size: 13px; cursor: pointer; padding: 6px 0; font-weight: 500;
}

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden;
}
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.panel-head .sub { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: auto; }

/* area progress table */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
  text-align: left; padding: 11px 16px; font-size: 13px; border-bottom: 1px solid var(--line);
}
table.grid th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3);
  font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }

.progress-bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 90px; }
.progress-bar > span { display: block; height: 100%; background: var(--s-completed); }

/* ---------- Task table toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px;
}
.toolbar select, .toolbar input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  font-family: inherit; font-size: 13px; background: var(--surface);
}
.toolbar .spacer { flex: 1; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.status { color: var(--on-solid); }
.st-not-started { background: var(--s-notstarted); color:var(--on-solid); }
.st-in-progress { background: var(--s-progress); color:var(--on-solid); }
.st-waiting-approval { background: var(--s-waiting); color:var(--on-solid); }
.st-blocked { background: var(--s-blocked); color:var(--on-solid); }
.st-completed { background: var(--s-completed); color:var(--on-solid); }
.st-na { background: var(--s-na); color:var(--on-solid); }
.badge.status::before { background: rgba(255,255,255,.85); }

.sev { font-weight: 600; font-size: 12px; }
.sev-low { color: var(--sev-low); }
.sev-medium { color: var(--sev-medium); }
.sev-high { color: var(--sev-high); }
.sev-critical { color: var(--sev-critical); }
.pill-crit { background:var(--crit-bg); color:var(--sev-critical); padding:2px 7px; border-radius:5px; font-size:11px; font-weight:600; }

.flag { color: var(--s-blocked); font-weight: 600; }
.chip-yes { color: var(--brand-2); font-weight: 600; }
.chip-no { color: var(--ink-3); }

/* task table specific */
.task-table td.task-name { font-weight: 500; max-width: 340px; }
.task-table td.task-name small { display:block; color:var(--ink-3); font-weight:400; font-size:11px; }
.task-id { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--ink-3); }

.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto;
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px; position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .task-id { display:block; margin-top: 3px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px 22px; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px;
  justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px;
  font-family: inherit; font-size: 13.5px; background: var(--surface); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.field .readonly { color: var(--ink-2); }

.section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--brand); margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.section-label:first-child { margin-top: 0; }

/* workers list */
.worker-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.worker-row .avatar { width: 30px; height: 30px; font-size: 12px; }
.worker-row .w-meta { flex: 1; }
.worker-row .w-meta strong { font-size: 13.5px; }
.worker-row .w-meta span { display:block; font-size: 11.5px; color: var(--ink-3); }

.add-worker-form { display: flex; gap: 8px; margin-top: 16px; }
.add-worker-form input, .add-worker-form select { flex: 1; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; font-family: inherit; font-size: 13px; }

/* ---------- Auth screen ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
}
.auth-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 28px 30px 30px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand strong { display: block; font-size: 20px; }
.auth-brand span { font-size: 11px; color: var(--ink-3); }
.auth-brand .lang-switch { margin-left: auto; }
.auth-form h2 { margin: 0 0 18px; font-size: 18px; }
.auth-form label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); font-weight: 600; margin: 12px 0 5px; }
.auth-form input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: var(--surface-2);
}
.auth-form input:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.auth-btn { width: 100%; margin-top: 20px; padding: 11px; font-size: 14px; }
.auth-link { display: block; width: 100%; margin-top: 12px; background: none; border: none; color: var(--brand-2); font-family: inherit; font-size: 13px; cursor: pointer; }
.auth-error { color: var(--s-blocked); font-size: 13px; margin-top: 14px; background: var(--crit-bg); padding: 9px 12px; border-radius: 8px; }
.auth-info { color: var(--brand-2); font-size: 13px; margin-top: 14px; background: var(--ok-bg); padding: 9px 12px; border-radius: 8px; }
.auth-note { font-size: 12px; color: var(--ink-3); margin: 14px 0 0; line-height: 1.5; }

/* ---------- Language switch ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.lang-switch button {
  border: none; background: var(--surface); color: var(--ink-2);
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.lang-switch button.active { background: var(--brand); color: var(--on-solid); }
.lang-switch.dark { border-color: rgba(255,255,255,.2); margin-bottom: 12px; width: max-content; }
.lang-switch.dark button { background: transparent; color: var(--side-ink-3); }
.lang-switch.dark button.active { background: var(--side-active); color: var(--on-solid); }

.logout-btn { margin-left: auto; color: var(--side-ink-3); font-size: 18px; }
.logout-btn:hover { color: var(--on-solid); }
.foot-link {
  display: block; width: 100%; margin-top: 10px; padding: 6px 0;
  background: none; border: none; color: var(--side-ink-3); font-family: inherit;
  font-size: 12px; text-align: left; cursor: pointer;
}
.foot-link:hover { color: var(--on-solid); }

/* ---------- Permissions / users ---------- */
.perm-list { display: grid; gap: 10px; margin-top: 8px; }
.perm-toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.perm-toggle input { width: 16px; height: 16px; }
.approve-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 8px; }
.badge-type { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
.badge-type.admin { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge-type.sudo_admin { background: var(--ok-bg); color: var(--brand-2); border-color: var(--ok-border); }
.badge-type.pending { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }
.badge-share { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.worker-row .actions { display: flex; gap: 6px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-ink); padding: 11px 20px; border-radius: 9px;
  font-size: 13px; z-index: 100; box-shadow: var(--shadow-lg);
}

/* ---------- Responsive ---------- */

/* ============================================================
   Documents library
   ============================================================ */
.btn.sm { padding: 5px 10px; font-size: 12px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

.chip-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip-tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 12.5px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.chip-tab:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-tab span {
  background: var(--bg); border-radius: 999px; padding: 1px 7px;
  font-size: 11px; color: var(--ink-3);
}
.chip-tab.on { background: var(--brand); border-color: var(--brand); color: var(--on-solid); }
.chip-tab.on span { background: rgba(255,255,255,.18); color: var(--on-solid); }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.doc-card {
  display: flex; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.doc-ico {
  flex: none; width: 40px; height: 40px; border-radius: 8px;
  background: var(--ok-bg); color: var(--brand);
  display: grid; place-items: center; font-size: 20px;
}
.doc-body { min-width: 0; flex: 1; }
.doc-body strong { display: block; font-size: 14px; color: var(--ink); word-break: break-word; }
.doc-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.doc-note { font-size: 12.5px; color: var(--ink-2); margin-top: 7px; }
.doc-file {
  font-size: 11px; color: var(--ink-3); margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ============================================================
   Financials
   ============================================================ */
/* Money tiles carry long values (€210,000.00), so they size down and get
   wider columns than the counting tiles on the dashboard. */
.kpi-grid.money { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.kpi-grid.money .num { font-size: 21px; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.kpi-grid.money .label { font-size: 11.5px; }

/* The native file button ships white; give it the panel's own colours. */
input[type="file"] {
  font: inherit; font-size: 12.5px; color: var(--ink-2);
  padding: 7px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
}
input[type="file"]::file-selector-button {
  font: inherit; font-size: 12px; margin-right: 10px; cursor: pointer;
  padding: 5px 11px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
input[type="file"]::file-selector-button:hover { border-color: var(--brand-2); color: var(--brand-2); }

.link-edit {
  border: 0; background: none; padding: 0 0 0 6px; cursor: pointer;
  font: inherit; font-size: 11px; color: var(--brand-2); text-decoration: underline;
}
.panel-note { font-size: 12px; color: var(--ink-3); margin: 0; padding: 12px 18px 16px; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }

/* how much of the money put in has been used */
.burn-wrap { margin-bottom: 18px; }
.burn-bar {
  height: 10px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line); overflow: hidden;
}
.burn-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); }
.burn-lbl { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

.acc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.donut-wrap { display: flex; gap: 20px; align-items: center; padding: 18px; flex-wrap: wrap; }
.donut { width: 190px; height: 190px; flex: none; }
.donut-num { font-size: 15px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.donut-lbl { font-size: 8.5px; fill: var(--ink-3); text-anchor: middle; letter-spacing: .06em; text-transform: uppercase; }

.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 210px; }
.legend li {
  display: grid; grid-template-columns: 10px 1fr auto auto; gap: 9px;
  align-items: center; padding: 4px 0; font-size: 12.5px;
}
.legend i { width: 10px; height: 10px; border-radius: 2px; display: block; }
.lg-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { color: var(--ink); font-variant-numeric: tabular-nums; }
.lg-pct { color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* month columns: spend beside revenue */
.mbars { display: flex; align-items: flex-end; gap: 12px; padding: 18px; height: 200px; overflow-x: auto; }
.mbar { flex: 1; min-width: 42px; display: flex; flex-direction: column; height: 100%; }
.mbar-cols { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.mbar-cols span { width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; display: block; }
.mb-spend { background: var(--brand-2); }
.mb-rev { background: var(--accent); }
.mbar-lbl { font-size: 10.5px; color: var(--ink-3); text-align: center; padding-top: 7px; }
.mlegend { display: flex; gap: 16px; padding: 0 18px 16px; font-size: 11.5px; color: var(--ink-3); }
.mlegend span { display: inline-flex; align-items: center; gap: 6px; }
.mlegend i { width: 10px; height: 10px; border-radius: 2px; display: block; }

.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 7px; }
.share-bar { height: 7px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.share-bar span { display: block; height: 100%; border-radius: 999px; }

.kind-chip {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap;
}
.kind-chip.k-spend { background: var(--crit-bg); border-color: var(--crit-border); color: var(--crit-ink); }
.kind-chip.k-funding { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-ink); }
.kind-chip.k-transfer { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }

.live-chip {
  font-size: 10px; padding: 2px 8px; border-radius: 999px; margin-left: 7px;
  background: var(--brand); color: var(--on-solid); letter-spacing: .04em;
}
td.num.neg { color: var(--crit); }
td.num.pos { color: var(--ok); }

.imp-summary { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.imp-sheets { list-style: none; margin: 0 0 14px; padding: 0; }
.imp-sheets li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed var(--line);
}
.imp-sheets strong { color: var(--ink); font-weight: 600; }
.imp-sheets span { color: var(--ink-3); }


/* ---- takings adjustment history ---- */
.adjusted-chip {
  font-size: 10px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink);
}
.adj-meta { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.adj-note {
  font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px;
  padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.adj-hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 12px; }
.adj-none { font-size: 12.5px; color: var(--ink-3); margin: 0; }

.adj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.adj-item {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px;
}
.adj-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; margin-bottom: 8px; }
.adj-head strong { color: var(--ink); }
.adj-head span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.adj-changes { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; }
.adj-change {
  display: grid; grid-template-columns: 1fr auto 14px auto; gap: 8px;
  align-items: baseline; font-size: 12.5px;
}
.adj-field { color: var(--ink-3); }
.adj-was { color: var(--ink-3); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.adj-arrow { color: var(--ink-3); text-align: center; }
.adj-now { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.adj-reason { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.adj-flag { font-size: 11.5px; color: var(--crit); margin-top: 7px; }

.adj-live { font-size: 12.5px; margin-top: 4px; }
.adj-live-ok { color: var(--ok); }
.adj-live-bad { color: var(--crit); }


/* ============================================================
   Quick-access PIN
   ============================================================ */
.pin-hello { font-size: 15px; color: var(--ink); margin: 0 0 2px; text-align: center; font-weight: 600; }
.pin-prompt { font-size: 12.5px; color: var(--ink-2); margin: 0 0 16px; text-align: center; }

.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 14px; }
.pin-dots span {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: transparent;
  transition: background .12s, border-color .12s, transform .12s;
}
.pin-dots span.on { background: var(--brand); border-color: var(--brand); transform: scale(1.12); }
.pin-dots.shake { animation: pinshake .34s; }
@keyframes pinshake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pin-err { text-align: center; margin-bottom: 12px; }

.pin-keys {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 260px; margin: 0 auto 8px;
}
.pin-key {
  font: inherit; font-size: 20px; font-weight: 500; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 0; cursor: pointer;
  transition: background .1s, border-color .1s, transform .06s;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:hover:not(:disabled) { border-color: var(--brand-2); }
.pin-key:active:not(:disabled) { background: var(--ok-bg); transform: scale(.96); }
.pin-key:disabled { opacity: .5; cursor: default; }
.pin-key.pin-del { font-size: 17px; color: var(--ink-2); }
.pin-gap { display: block; }

.pin-setup { text-align: center; }
.pin-setup-hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 16px; line-height: 1.55; text-align: left; }
.pin-setup .pin-setup-hint { text-align: center; }

.pin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pin-devices { list-style: none; margin: 0; padding: 0; }
.pin-devices li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px; padding: 7px 0; border-bottom: 1px solid var(--line);
}
.pd-name { color: var(--ink-2); }
.pd-name em { color: var(--brand-2); font-style: normal; font-size: 11px; }
.pd-when { color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  #global-search { width: 140px; }
  .topbar-actions .btn { padding: 8px 10px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .toolbar { display: none !important; }
  .content { overflow: visible; padding: 0; }
  .panel { box-shadow: none; }
}

/* ============================================================
   MOBILE PORTRAIT
   The full system is dense by nature. On a narrow phone the
   priority is: never scroll the page sideways, keep touch
   targets big, and let wide tables scroll inside their panel.
   ============================================================ */
.yokoten-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 14px; }
.yk-chip {
  background: var(--info-bg); color: var(--info); border-radius: 4px;
  padding: 1px 6px; font-size: 10px; font-weight: 700; letter-spacing: .04em;
}

@media (max-width: 700px) {
  .pin-keys { max-width: 300px; gap: 12px; }
  .pin-key { padding: 17px 0; font-size: 22px; }

  .adj-change { grid-template-columns: 1fr; gap: 1px; }
  .adj-arrow { display: none; }
  .adj-head { flex-direction: column; gap: 2px; }

  .acc-two { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr; }
  .doc-card { flex-wrap: wrap; }
  .doc-actions { flex-direction: row; width: 100%; }
  .doc-actions .btn { flex: 1; justify-content: center; }
  .donut-wrap { justify-content: center; }
  .donut { width: 160px; height: 160px; }
  .chip-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chip-tab { white-space: nowrap; }
  .row-actions { justify-content: flex-start; }

  /* the page itself must never scroll sideways */
  html, body { max-width: 100%; overflow-x: hidden; }
  .content { padding: 14px 12px 28px; }

  /* wide tables scroll inside their own panel, headers stay put */
  .panel table.grid { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel table.grid thead,
  .panel table.grid tbody { display: table; width: 100%; min-width: 560px; }
  table.grid th, table.grid td { padding: 10px 12px; }
  .task-table td.task-name { max-width: none; }

  /* topbar: title on its own line, actions wrap beneath */
  .topbar {
    flex-wrap: wrap; gap: 8px; padding: 10px 12px; align-items: center;
  }
  .topbar h1 { font-size: 16px; order: 1; flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-toggle { order: 0; font-size: 22px; padding: 4px 6px; }
  #btn-emergency { order: 2; }
  .topbar-actions {
    order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; gap: 6px;
  }
  #global-search { display: none; }
  .close-group { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
  .close-btn { padding: 9px 3px; font-size: 10.5px; line-height: 1.25; text-align: center; }
  .safety-strip { padding: 9px 12px; gap: 8px; }
  .safety-strip .msg { font-size: 12px; }
  .topbar-actions > .btn { flex: 1; min-height: 42px; }

  /* filters stack into a readable grid */
  .toolbar { gap: 8px; }
  .toolbar select, .toolbar input {
    flex: 1 1 calc(50% - 4px); min-width: 0; padding: 10px; font-size: 15px;
  }
  .toolbar .spacer { display: none; }
  .toolbar .btn, .toolbar .back-link { flex: 1 1 100%; min-height: 42px; }

  /* KPI tiles: two up, tighter */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .num { font-size: 23px; }
  .kpi .label { font-size: 11px; }
  .kpi .go { display: none; }

  /* modals go full-bleed so forms have room */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal {
    max-width: 100%; max-height: 100%; height: 100%;
    border-radius: 0; display: flex; flex-direction: column;
  }
  .modal-body { flex: 1; overflow-y: auto; padding: 16px 16px 24px; }
  .modal-head { padding: 14px 16px; }
  .modal-head h2 { font-size: 16px; }
  .modal-foot { padding: 12px 16px; gap: 8px; }
  .modal-foot .btn, .modal-foot .big-btn { flex: 1; min-height: 46px; }
  .form-grid { gap: 12px; }
  .field input, .field select, .field textarea { font-size: 16px; padding: 11px; }

  /* greeting + frequency chips */
  .greeting { padding: 18px 16px; }
  .greeting h2 { font-size: 19px; }
  .freq-tab { padding: 9px 12px; font-size: 12.5px; }

  /* users / equipment rows stack */
  .worker-row { flex-wrap: wrap; }
  .worker-row .actions { width: 100%; }
  .worker-row .actions .btn { flex: 1; min-height: 40px; }
  .add-worker-form { flex-wrap: wrap; }
  .add-worker-form input, .add-worker-form select { flex: 1 1 100%; padding: 11px; font-size: 16px; }
  .add-worker-form .btn { flex: 1 1 100%; min-height: 44px; }

  /* kaizen + report rows */
  .strength-row { flex-wrap: wrap; gap: 6px 10px; }
  .strength-row .lbl { min-width: 0; flex: 1 1 100%; }
  .strength-row .bar { flex: 1; }
  .report-meta { grid-template-columns: 1fr 1fr; }
  .mini-kpis { grid-template-columns: 1fr 1fr; }
  .approve-grid, .yokoten-grid { grid-template-columns: 1fr; }
  .emg-num { flex-wrap: wrap; gap: 10px; }
  .emg-num .lab { flex: 1 1 60%; }
  .emg-call { flex: 1 1 100%; text-align: center; padding: 12px; }
  .section-hd { flex-wrap: wrap; gap: 6px; }
  .section-hd .sub { margin-left: 0; flex: 1 1 100%; }
  .panel-head { flex-wrap: wrap; gap: 6px; }
  .panel-head .sub { margin-left: 0; }
}

@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .mini-kpis, .report-meta { grid-template-columns: 1fr; }
}

/* ---------- theme toggle ---------- */
.foot-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.foot-row .lang-switch { margin-bottom: 0; }
.theme-btn {
  border: 1px solid rgba(255,255,255,.2); background: transparent; color: var(--side-ink-3);
  border-radius: 7px; padding: 5px 10px; font-size: 13px; cursor: pointer;
  font-family: inherit; line-height: 1.4;
}
.theme-btn:hover { color: var(--on-solid); border-color: rgba(255,255,255,.4); }
/* in the shift header it sits on the page ground, not the sidebar */
.sm-menu.theme-btn {
  border-color: var(--line); background: var(--surface); color: var(--ink-2);
  padding: 9px 12px; font-size: 14px;
}
.sm-menu.theme-btn:hover { border-color: var(--brand-2); color: var(--ink); }

/* the login screen paints its own ground, so keep it readable in both themes */
.auth-screen { background: linear-gradient(135deg, var(--side-bg) 0%, var(--brand-deep) 100%); }
