/* Bambu Farm — v0.6 «Apple-minimal».
   Shell like the owner's ERP (topbar + tabs, no sidebar, Commissioner self-hosted, radii 8/12/18),
   colours from Apple's system palette, light #F5F5F7 / dark #000. */

@font-face { font-family: 'Commissioner'; font-weight: 300 900; font-display: swap;
  src: url('/fonts/commissioner-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Commissioner'; font-weight: 300 900; font-display: swap;
  src: url('/fonts/commissioner-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }

:root {
  --font: 'Commissioner', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r-xs: 6px; --r-sm: 8px; --r: 12px; --r-lg: 18px;
  color-scheme: light;

  /* Apple light */
  --bg: #f5f5f7; --card: #ffffff; --card2: #f5f5f7; --soft: #ececf0; --line: rgba(0,0,0,.07);
  --ink: #1d1d1f; --mute: #6e6e73; --mute-strong: #515154; --faint: #a1a1a6;
  --acc: #007aff; --acc-text: #0066cc; --acc-soft: rgba(0,122,255,.12);
  --edge: rgba(0,0,0,.14);
  --ok: #1e7e34; --ok-bg: rgba(52,199,89,.14);
  --bad: #d70015; --bad-bg: rgba(255,59,48,.12);
  --warn: #b25000; --warn-bg: rgba(255,149,0,.14);
  --info: #0058b8; --info-bg: rgba(0,122,255,.10);
  --seg: rgba(118,118,128,.12); --seg-on: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-hi: 0 2px 6px rgba(0,0,0,.06), 0 12px 32px rgba(0,0,0,.08);
  --glass: rgba(245,245,247,.78);
  /* printers: Apple blue, orange, green, pink */
  --d1: #007aff; --d2: #ff9500; --d3: #34c759; --d4: #ff2d55;
  /* categories / series: Apple system colours */
  --c1: #5856d6; --c2: #ff9500; --c3: #34c759; --c4: #ff3b30; --c5: #5ac8fa; --c6: #af52de; --c7: #ffcc00; --c8: #a2845e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --card: #1c1c1e; --card2: #2c2c2e; --soft: #2c2c2e; --line: rgba(255,255,255,.08);
    --ink: #f5f5f7; --mute: #98989d; --mute-strong: #aeaeb2; --faint: #636366;
    --acc: #0a84ff; --acc-text: #409cff; --acc-soft: rgba(10,132,255,.2);
    --edge: rgba(255,255,255,.18);
    --ok: #30d158; --ok-bg: rgba(48,209,88,.16);
    --bad: #ff6961; --bad-bg: rgba(255,69,58,.16);
    --warn: #ff9f0a; --warn-bg: rgba(255,159,10,.16);
    --info: #64d2ff; --info-bg: rgba(10,132,255,.18);
    --seg: rgba(118,118,128,.24); --seg-on: #636366;
    --shadow: none; --shadow-hi: 0 0 0 1px rgba(255,255,255,.06);
    --glass: rgba(0,0,0,.72);
    --d1: #0a84ff; --d2: #ff9f0a; --d3: #30d158; --d4: #ff375f;
    --c1: #5e5ce6; --c2: #ff9f0a; --c3: #30d158; --c4: #ff453a; --c5: #64d2ff; --c6: #bf5af2; --c7: #ffd60a; --c8: #ac8e68;
  }
  :root:not([data-theme="light"]) .drawer { background: rgba(0,0,0,.6); }
  :root:not([data-theme="light"]) .drawer-inner { border-left: 1px solid var(--line); }
}
/* night / morning button (☾/☀ in the header) forces one theme */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000; --card: #1c1c1e; --card2: #2c2c2e; --soft: #2c2c2e; --line: rgba(255,255,255,.08);
    --ink: #f5f5f7; --mute: #98989d; --mute-strong: #aeaeb2; --faint: #636366;
    --acc: #0a84ff; --acc-text: #409cff; --acc-soft: rgba(10,132,255,.2);
    --edge: rgba(255,255,255,.18);
    --ok: #30d158; --ok-bg: rgba(48,209,88,.16);
    --bad: #ff6961; --bad-bg: rgba(255,69,58,.16);
    --warn: #ff9f0a; --warn-bg: rgba(255,159,10,.16);
    --info: #64d2ff; --info-bg: rgba(10,132,255,.18);
    --seg: rgba(118,118,128,.24); --seg-on: #636366;
    --shadow: none; --shadow-hi: 0 0 0 1px rgba(255,255,255,.06);
    --glass: rgba(0,0,0,.72);
    --d1: #0a84ff; --d2: #ff9f0a; --d3: #30d158; --d4: #ff375f;
    --c1: #5e5ce6; --c2: #ff9f0a; --c3: #30d158; --c4: #ff453a; --c5: #64d2ff; --c6: #bf5af2; --c7: #ffd60a; --c8: #ac8e68;
}
:root[data-theme="dark"] .drawer { background: rgba(0,0,0,.6); }
:root[data-theme="dark"] .drawer-inner { border-left: 1px solid var(--line); }

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; overflow-x: clip; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.47 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -.005em; }
main { max-width: 1680px; margin: 0 auto; padding: 22px calc(24px + env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left)); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; letter-spacing: -.015em; }
h3 { font-size: 12px; margin: 18px 0 8px; color: var(--mute); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
a { color: var(--acc-text); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--soft); padding: 1px 6px; border-radius: var(--r-xs); }
.muted { color: var(--mute); } .small { font-size: 13px; }
.hidden { display: none !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* ---------- header (frosted) + segmented tabs ---------- */
.top { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) 10px calc(24px + env(safe-area-inset-left)); background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand svg { color: var(--acc); flex: none; }
.brand h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand #period { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.tabs { grid-column: 2; display: inline-flex; gap: 2px; padding: 3px; background: var(--seg); border-radius: var(--r-sm); margin: 0; }
.tabs button { background: transparent; border: 0; border-radius: var(--r-xs); padding: 6px 16px; font: inherit; font-size: 14px; font-weight: 550; color: var(--ink); cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.tabs button:hover { background: rgba(127,127,127,.08); }
.tabs button.active { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--soft); color: var(--mute-strong); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--ok-bg); color: var(--ok); } .pill.off { background: var(--bad-bg); color: var(--bad); } .pill.wait { background: var(--warn-bg); color: var(--warn); }
.iconbtn { background: var(--soft); border: 0; border-radius: 50%; width: 36px; height: 36px; font: inherit; cursor: pointer; color: var(--ink); position: relative; display: inline-grid; place-items: center; }
.iconbtn::before, .drawer .close::before { content: ""; position: absolute; inset: -6px; }
.iconbtn:hover { background: var(--seg); }
.iconbtn.alert-dot::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.banner { width: min(1680px, calc(100% - 48px)); margin: 14px auto 0; padding: 11px 16px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 500; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.tab { display: none; } .tab.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: .3; transform: translateY(2px) } to { opacity: 1; transform: none } }

/* ---------- buttons ---------- */
.btn { background: var(--acc-text); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.ghost { background: var(--soft); color: var(--ink); font-weight: 550; }
.linkbtn { text-decoration: none; }

/* ---------- big numbers (centred) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--r-lg); padding: 18px 16px 16px; box-shadow: var(--shadow); min-width: 0; text-align: center; border: 0; }
.kpi .v { font-size: clamp(24px, 2.2vw, 30px); font-weight: 700; letter-spacing: -.035em; line-height: 1.12; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .l { color: var(--ink); font-size: 13.5px; font-weight: 550; margin-top: 4px; }
.kpi .s { font-size: 12.5px; margin-top: 3px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .more { font-size: 12px; color: var(--acc-text); margin-top: 8px; font-weight: 600; }
.v.ok, .ok-t { color: var(--ok); } .v.bad, .bad-t { color: var(--bad); } .v.warn, .warn-t { color: var(--warn); }
button.kpi.tile { font: inherit; color: inherit; cursor: pointer; transition: transform .12s, box-shadow .15s; overflow: hidden; }
button.kpi.tile:hover { box-shadow: var(--shadow-hi); transform: translateY(-1px); }
button.kpi.tile:active { transform: scale(.985); }
button.kpi.tile.on { box-shadow: 0 0 0 2px var(--acc), var(--shadow-hi); }
.bigstrip { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 1320px; margin: 4px auto 22px; }
.tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); max-width: 1500px; margin: 4px auto 22px; }
@media (max-width: 1180px) and (min-width: 641px) { .tiles, .bigstrip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
#statPanel { scroll-margin-top: 72px; }
.note { font-size: 13px; color: var(--mute); margin: 10px 0 0; }

/* ---------- cards, tables, charts ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.span-all { grid-column: 1 / -1; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--mute); font-weight: 600; font-size: 12px; letter-spacing: .01em; background: transparent; }
.card.flush th { background: var(--card2); }
th[data-k] { cursor: pointer; user-select: none; } th[data-k].sorted::after { content: " ↓"; color: var(--acc-text); } th[data-k].sorted.asc::after { content: " ↑"; }
td.t { white-space: normal; min-width: 200px; overflow-wrap: anywhere; }
tbody tr.clickable { cursor: pointer; transition: background .1s; } tbody tr.clickable:hover { background: var(--card2); }
.bar { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.stack { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--soft); }
.stack > span { height: 100%; }
.sw { display: inline-block; width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--edge); vertical-align: -2px; margin-right: 7px; flex: none; }
.st { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--mute-strong); }
.st.ok { background: var(--ok-bg); color: var(--ok); } .st.failed { background: var(--bad-bg); color: var(--bad); } .st.cancelled { background: var(--warn-bg); color: var(--warn); } .st.running { background: var(--info-bg); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--soft); border-radius: 999px; padding: 2px 9px 2px 4px; white-space: nowrap; }
.chip .sw { margin: 0; width: 12px; height: 12px; }
.badge { font-size: 10px; font-weight: 700; background: var(--acc-text); color: #fff; border-radius: var(--r-xs); padding: 0 4px; margin-left: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--mute); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.rowlist { display: grid; gap: 10px; }
.rowlist .r { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr auto; gap: 12px; align-items: center; font-size: 14px; }
.rowlist .r b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; min-width: 64px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--mute); font-size: 10px; font-family: var(--font); }
svg.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 110px; margin-bottom: 20px; }
.hist > div { flex: 1; background: var(--acc); border-radius: var(--r-xs) var(--r-xs) 1px 1px; position: relative; min-height: 2px; opacity: .85; }
.hist i { position: absolute; top: 100%; left: 0; right: 0; font-size: 10px; color: var(--mute); text-align: center; font-style: normal; padding-top: 4px; }
.axisnote { margin-top: 4px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 14px; }
.panel-h h2 { margin: 0; font-size: 19px; }

/* ---------- printers (Τώρα) ---------- */
.livegrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1280px) { .livegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pc { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s; }
.pc.flash { box-shadow: 0 0 0 3px var(--acc), var(--shadow-hi); }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.pc-head .name { font-weight: 700; font-size: 16px; letter-spacing: -.015em; display: flex; align-items: center; gap: 8px; }
.pc-head .name::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dc, var(--acc)); flex: none; }
.pc-head .sub { font-size: 12.5px; color: var(--mute); margin-left: 17px; }
.state { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--mute-strong); white-space: nowrap; }
.state.RUNNING { background: var(--info-bg); color: var(--info); } .state.PREPARE { background: var(--acc-soft); color: var(--acc-text); }
.state.FINISH { background: var(--ok-bg); color: var(--ok); } .state.FAILED { background: var(--bad-bg); color: var(--bad); } .state.PAUSE { background: var(--warn-bg); color: var(--warn); }
.pc-body { padding: 10px 16px 14px; display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.ring { position: relative; width: 96px; height: 96px; }
.ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring svg circle:first-child { stroke: var(--soft); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .c b { font-size: 22px; font-weight: 700; letter-spacing: -.03em; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.ring .c span { font-size: 10.5px; color: var(--mute); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .title { font-weight: 600; font-size: 14px; line-height: 1.3; margin-bottom: 6px; word-break: break-word; }
.job .kv2 { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.job .kv2 span:nth-child(odd) { color: var(--mute); }
.temps { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; padding: 0 16px 12px; }
.temp { background: var(--card2); border-radius: var(--r-sm); padding: 6px 8px; font-size: 11.5px; text-align: center; }
.temp b { display: block; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.temp small { color: var(--mute); }
.ams { padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.ams-h { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--mute); margin-bottom: 8px; font-weight: 600; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { border-radius: var(--r); padding: 8px 4px 6px; text-align: center; background: var(--card2); min-width: 0; border: 2px solid transparent; }
.slot.active { border-color: var(--acc); }
.slot.empty { opacity: .4; }
.slot .dot { width: 24px; height: 24px; border-radius: 50%; margin: 0 auto 5px; box-shadow: inset 0 0 0 1px var(--edge); }
.slot.empty .dot { background: transparent; box-shadow: none; border: 1.5px dashed var(--faint); }
.slot .ty { font-size: 12px; font-weight: 650; }
.slot .sb { font-size: 10.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .rm { height: 3px; border-radius: 3px; background: var(--soft); margin: 5px 4px 0; overflow: hidden; }
.slot .rm span { display: block; height: 100%; }
.alerts { padding: 0 16px 12px; display: grid; gap: 6px; }
.alert { font-size: 12.5px; line-height: 1.4; border-radius: var(--r); padding: 8px 11px; background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--card2); color: var(--mute-strong); }
.alert code { font-size: 10.5px; opacity: .75; background: transparent; padding: 0; }
.pc-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--mute); }
.empty-state { text-align: center; padding: 44px 12px; color: var(--mute); }

/* ---------- stats: printer & category cards ---------- */
.dc .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.dc .head b { font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.dc .head b::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dc, var(--acc)); }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.mini div { background: var(--card2); border-radius: var(--r); padding: 10px; text-align: center; }
.mini b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini small { color: var(--mute); font-size: 11.5px; }
.swgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.swc { display: flex; gap: 10px; align-items: center; background: var(--card2); border-radius: var(--r); padding: 8px 10px; font-size: 12px; }
.swc .big { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--edge); flex: none; }
.swc b { display: block; font-size: 13px; }

/* ---------- prints ---------- */
.chiprow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 14px; }
.chipbtn { background: var(--card); border: 0; box-shadow: var(--shadow); border-radius: 999px; padding: 7px 15px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.chipbtn b { font-variant-numeric: tabular-nums; font-weight: 700; }
.chipbtn.on { background: var(--acc-text); color: #fff; }
.filterbar { display: flex; gap: 8px; margin-bottom: 8px; max-width: 760px; margin-inline: auto; }
.filterbar input[type=search] { flex: 1; padding: 10px 14px; border: 0; border-radius: var(--r); font: inherit; font-size: 14px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 0 0 12px; }
.filters input, .filters select { padding: 7px 10px; border: 0; border-radius: var(--r-sm); font: inherit; font-size: 13px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
#fCount { text-align: center; }
.thumb { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--soft); display: block; }
.thumb.ph { display: grid; place-items: center; color: var(--faint); font-size: 18px; }
.show-m { display: none; }

/* ---------- drawer ---------- */
body:has(.drawer:not(.hidden)) { overflow: hidden; }
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.32); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); z-index: 30; display: flex; justify-content: flex-end; animation: fade .15s ease; }
.drawer-inner { width: min(600px, 100%); height: 100%; background: var(--bg); overflow: auto; overscroll-behavior: contain; padding: calc(22px + env(safe-area-inset-top)) 22px calc(40px + env(safe-area-inset-bottom)); position: relative; box-shadow: -10px 0 40px rgba(0,0,0,.15); }
.drawer .close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--soft); border: 0; font-size: 20px; line-height: 1; color: var(--mute); cursor: pointer; }
.drawer img { max-width: 100%; border-radius: var(--r); background: var(--card2); }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.photos figure { margin: 0; } .photos figcaption { font-size: 12px; color: var(--mute); margin-top: 4px; text-align: center; }
.photos img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; cursor: zoom-in; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 14px 0; background: var(--card); border-radius: var(--r-lg); padding: 14px 16px; }
.kv > div:nth-child(odd) { color: var(--mute); }
.retro { font-size: 12px; color: var(--warn); }

/* ---------- filament tab ---------- */
.srcbar { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; justify-content: center; font-size: 13px; color: var(--mute); background: var(--card); border-radius: var(--r); padding: 10px 16px; margin: 4px auto 18px; box-shadow: var(--shadow); max-width: 1180px; }
.srcbar b { color: var(--ink); font-weight: 600; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--mute-strong); }
.tag.reorder { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.ok { background: var(--ok-bg); color: var(--ok); }
.mrf { font-family: var(--mono); font-size: 11.5px; color: var(--mute); }
.pform { display: flex; gap: 6px; align-items: center; }
.pform input { width: 130px; padding: 6px 9px; border: 0; border-radius: var(--r-sm); font: inherit; font-size: 13px; background: var(--card2); color: var(--ink); }
.pform button { padding: 6px 12px; font-size: 12.5px; }
.steps { margin: 6px 0 0; padding-left: 22px; font-size: 14px; } .steps li { margin: 5px 0; }
.printer-h { font-size: 12px; font-weight: 700; color: var(--mute); padding: 12px 10px 5px; background: var(--card2); }

/* ---------- narrow windows / iPad ---------- */
@media (max-width: 900px) { .brand #period { display: none; } .tabs button { padding: 6px 12px; } }
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; display: flex; }
  .tabs button { flex: 1; padding: 9px 4px; font-size: 13px; }
  #statPanel { scroll-margin-top: 114px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  main { padding: 14px calc(12px + env(safe-area-inset-right)) calc(70px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
  .banner { width: calc(100% - 24px); margin-top: 10px; }
  .filterbar input, .filters input, .filters select, .pform input { font-size: 16px; }
  #printsTable th { padding-top: 12px; padding-bottom: 12px; }
  .hide-m { display: none !important; }
  .show-m { display: inline-flex; }
  .filters.collapsible { display: none; }
  .filters.collapsible.open { display: flex; }
  .bigstrip, .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .bigstrip > :last-child:nth-child(odd), .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px 10px 12px; } .kpi .v { font-size: 24px; }
  .livegrid, .grid, .grid2 { grid-template-columns: 1fr; }
  .pc .temps, .pc .ams { display: none; }
  .pc.open .temps { display: grid; } .pc.open .ams { display: block; }
  .pc .pc-head { cursor: pointer; }
  .pc .pc-head::after { content: "›"; color: var(--faint); font-size: 20px; transform: rotate(90deg); }
  .pc.open .pc-head::after { transform: rotate(-90deg); }
  .kv { grid-template-columns: 110px 1fr; }
  #printsTable td.t { min-width: 0; width: 100%; }
  #printsTable th, #printsTable td { padding: 8px 6px; }
  #printsTable td:nth-child(2) { white-space: normal; font-size: 12.5px; color: var(--mute); width: 78px; }
}

/* ---------- v0.7: Φιλαμέντ (loaded first, then stock by zone) ---------- */
.bigstrip.four { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 980px; }
h2.sect { font-size: 22px; font-weight: 700; letter-spacing: -.025em; margin: 30px 0 14px; }
.ldgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ldcard h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.ldcard h2 .sw { margin: 0; }
.ld, .stk { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.ld:first-of-type { border-top: 0; }
.ld.on .nm b { color: var(--acc); }
.ld .dot, .stk .dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.ld .nm, .stk .nm { min-width: 0; }
.ld .nm b, .stk .nm b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld .nm small, .stk .nm small { display: block; font-size: 11.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld .rm { height: 3px; border-radius: 3px; background: var(--soft); margin-top: 5px; overflow: hidden; }
.ld .rm span { display: block; height: 100%; }
.ld .qty, .stk .qty { text-align: right; }
.ld .qty b, .stk .qty b { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ld .qty small, .stk .qty small { display: block; font-size: 11px; color: var(--mute); white-space: nowrap; }
.zone h3 { display: flex; align-items: baseline; gap: 10px; text-transform: none; font-size: 15px; color: var(--ink); letter-spacing: -.01em; margin: 22px 0 10px; }
.zone h3 small { color: var(--mute); font-weight: 500; font-size: 12.5px; }
.stkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.stk { background: var(--card); border: 0; border-radius: var(--r); padding: 10px 14px; box-shadow: var(--shadow); }
.stk.zero { opacity: .5; }
.stk .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--mute); white-space: nowrap; cursor: pointer; }
details.more { margin-top: 26px; }
details.more > summary { cursor: pointer; list-style: none; text-align: center; color: var(--acc); font-weight: 550; font-size: 14px; padding: 12px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 14px; }
@media (max-width: 1280px) { .ldgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .bigstrip.four { grid-template-columns: 1fr 1fr; }
  .ldgrid { grid-template-columns: 1fr; }
  h2.sect { font-size: 19px; margin: 22px 0 10px; }
  .stkgrid { grid-template-columns: 1fr; }
}

/* ---------- v0.7: Εκτυπώσεις — period chips + status segmented filter ---------- */
#printChips, #statFilters { display: grid; justify-items: center; gap: 10px; margin: 4px 0 14px; }
.chipgrp { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.chipsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.chipbtn.sub { box-shadow: none; background: transparent; color: var(--mute-strong); padding: 6px 12px; }
.chipbtn.sub:hover { background: var(--soft); }
.chipbtn.sub.on { background: var(--acc-soft); color: var(--acc-text); }
.chipbtn .sw { margin-right: 6px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--seg); border-radius: var(--r-sm); }
.seg button { background: transparent; border: 0; border-radius: var(--r-xs); padding: 6px 14px; font: inherit; font-size: 13.5px; font-weight: 550; color: var(--ink); cursor: pointer; white-space: nowrap; }
.seg button small { color: var(--mute); font-variant-numeric: tabular-nums; margin-left: 3px; }
.seg button.active { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button.bad.active { color: var(--bad); }

/* ---------- v0.7: Live view — card link + page per printer ---------- */
.more-btn { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 11px 16px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--acc-text); cursor: pointer; text-align: center; }
.more-btn:hover { background: var(--card2); }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.pp-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.pp-switch .chipbtn { white-space: nowrap; flex: none; display: inline-flex; align-items: center; }
.pp-grid { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.pp-side { display: grid; gap: 16px; }
.pp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.pp-card { margin-bottom: 16px; }
.pc.full .ring { width: 112px; height: 112px; } .pc.full .ring svg { width: 112px; height: 112px; }
.pc.full .pc-body { grid-template-columns: 112px 1fr; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.spark > div { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }
.spark span { display: block; width: 100%; background: var(--dc, var(--acc)); border-radius: var(--r-xs) var(--r-xs) 2px 2px; min-height: 2px; opacity: .9; }
.spark i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bad); border-radius: 2px; }
.spark-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); margin-top: 6px; }
@media (max-width: 1180px) { .pp-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .pp-kpis { grid-template-columns: 1fr 1fr; }
  .pp-switch { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding: 2px 2px 6px; scrollbar-width: none; }
  .seg { width: 100%; } .seg button { flex: 1; padding: 8px 4px; font-size: 12.5px; }
  .chipsep { display: none; }
  .pc.full .pc-head::after { content: none; } .pc.full .pc-head { cursor: default; }
}

/* ---------- v0.8: maintenance checklist ---------- */
.mt-group h3 { display: flex; align-items: center; gap: 6px; text-transform: none; font-size: 14px; color: var(--ink); letter-spacing: -.01em; margin: 18px 0 6px; }
.mt-group h3 .sw { margin: 0; } .mt-group h3 small { color: var(--mute); font-weight: 500; margin-left: auto; font-size: 12.5px; }
.mt { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.mt-group .mt:first-of-type { border-top: 0; }
.mt-check { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--faint); background: transparent; color: transparent; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s, color .15s; }
.mt-check:hover { border-color: var(--ok); color: var(--ok); }
.mt.done .mt-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.mt.due .mt-check { border-color: var(--warn); }
.mt .nm b { display: block; font-size: 14px; font-weight: 600; }
.mt .nm small { display: block; font-size: 12px; color: var(--mute); }
.mt.done .nm b { color: var(--mute); }
.mt .when { font-size: 12.5px; color: var(--mute); text-align: right; white-space: nowrap; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--acc-text); cursor: pointer; text-decoration: underline; }
@media (max-width: 640px) { .mt { grid-template-columns: 40px minmax(0, 1fr); } .mt .when { grid-column: 2; text-align: left; } }

/* ---------- v0.8: stock item card (click a filament) ---------- */
[data-item] { cursor: pointer; }
.stk[data-item]:hover { box-shadow: var(--shadow-hi); }
.ld[data-item]:hover .nm b { color: var(--acc-text); }
.item-link { text-decoration: none; color: var(--ink); font-weight: 550; text-align: left; }
.item-link:hover { color: var(--acc-text); text-decoration: underline; }
.item-head { display: flex; gap: 14px; align-items: center; margin-right: 40px; }
.item-head .dot { width: 48px; height: 48px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px var(--edge); }
ul.plain { margin: 0; padding-left: 18px; } ul.plain li { margin: 4px 0; }
.mt-check:disabled { cursor: default; }
.card.flush-pad { padding-bottom: 14px; }
.chipbtn .cnt { display: inline-block; min-width: 22px; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--soft); color: var(--mute-strong); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chipbtn.on .cnt { background: rgba(255,255,255,.25); color: #fff; }
.chipbtn.sub.on .cnt { background: var(--card); color: var(--acc-text); }

/* ---------- v0.9: notifications bell ---------- */
.bell-n { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--acc); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.bell-n.bad { background: var(--bad); }
.nt { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: start; width: 100%; text-align: left; background: var(--card); border: 0; border-radius: var(--r); padding: 11px 14px; margin: 0 0 6px; font: inherit; color: var(--ink); cursor: pointer; }
.nt:hover { background: var(--card2); }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--faint); }
.nt.ok .nt-dot { background: var(--ok); } .nt.bad .nt-dot { background: var(--bad); } .nt.warn .nt-dot { background: var(--warn); } .nt.info .nt-dot { background: var(--faint); }
.nt.new { box-shadow: inset 3px 0 0 var(--acc); }
.nt-b b { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.nt-b small { display: block; font-size: 12.5px; color: var(--mute); overflow-wrap: anywhere; }
.nt-t { font-size: 12px; color: var(--mute); white-space: nowrap; }
.ring .c .ic { display: grid; justify-items: center; gap: 2px; }
.ring .c .ic svg { display: block; width: 30px; height: 30px; transform: none; }
.ring .c .ic span { color: inherit; font-weight: 600; font-size: 11.5px; letter-spacing: .01em; }
.ring.done svg circle:first-child { stroke: var(--ok-bg); }

#statTiles.loading, #statPanel.loading { opacity: .45; transition: opacity .15s; pointer-events: none; }
#statFilters[data-err]:not([data-err=""])::after { content: attr(data-err); color: var(--warn); font-size: 12.5px; }

/* ---------- v0.12: print drawer, everything once ---------- */
.pd-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.pd-tags .chip .sw { margin: 0 2px 0 0; }
.pd-kpis { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin: 14px 0 6px; }
.pd-kpis .kpi { padding: 12px 10px; } .pd-kpis .kpi .v { font-size: 22px; }
.pd-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
details.pd-ev { margin-top: 14px; } details.pd-ev > summary { cursor: pointer; color: var(--acc-text); font-weight: 600; font-size: 14px; padding: 6px 0; }
