/* DailyCut Studio dashboard: one neutral system, one accent, page colours only as identity dots. */
/* DailyCut Studio dashboard. Brand "Il taglio" (assets/brand_dailycut/BRAND.md): paper, ink and ONE red.
   Square corners, thin lines, no shadows. The pages' own colours only appear on their own avatars/previews. */
:root {
  color-scheme: light;
  --bg: #F4F1EA;            /* carta */
  --surface: #FFFFFF;       /* cards, inputs */
  --surface-2: #ECE7DD;     /* hover, wells */
  --surface-3: #E4DED2;     /* sabbia */
  --line: rgba(18, 18, 18, 0.14);
  --line-2: rgba(18, 18, 18, 0.32);
  --ink: #121212;           /* inchiostro */
  --ink-2: #5F5A52;         /* grafite */
  --ink-3: #7A7468;
  --accent: #FF4A1C;        /* rosso taglio: never body text */
  --accent-ink: #121212;    /* text on red */
  --accent-soft: rgba(255, 74, 28, 0.12);
  --red-text: #9A3412;
  --bad: #9A3412; --bad-line: #C2410C;
  --side-bg: #121212; --side-ink: #F4F1EA; --side-muted: #C9C3B7; --side-hover: #1F1E1C;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --grid: #E4DED2; --axis: #B9B1A3;
  --shadow: none;
  --shadow-lg: 0 18px 60px rgba(18, 18, 18, 0.22);
  --r: 0px; --r-s: 0px;
  --b: 1.5px;
  --side: 240px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212; --surface: #1A1918; --surface-2: #232220; --surface-3: #2E2C29;
    --line: rgba(244, 241, 234, 0.12); --line-2: rgba(244, 241, 234, 0.3);
    --ink: #F4F1EA; --ink-2: #C9C3B7; --ink-3: #8F887B;
    --accent-soft: rgba(255, 74, 28, 0.16); --bad: #F0A07E; --bad-line: #E2683A;
    --side-bg: #0B0B0B; --side-hover: #1A1918;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --grid: #2E2C29; --axis: #4A4741;
    --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --surface: #1A1918; --surface-2: #232220; --surface-3: #2E2C29;
  --line: rgba(244, 241, 234, 0.12); --line-2: rgba(244, 241, 234, 0.3);
  --ink: #F4F1EA; --ink-2: #C9C3B7; --ink-3: #8F887B;
  --accent-soft: rgba(255, 74, 28, 0.16); --bad: #F0A07E; --bad-line: #E2683A;
  --side-bg: #0B0B0B; --side-hover: #1A1918;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --grid: #2E2C29; --axis: #4A4741;
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body.locked { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: var(--b) solid var(--line-2); border-radius: 0;
  padding: 9px 11px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
textarea { resize: vertical; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
h1 { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
h2 { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h3 { font-family: var(--display); font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }
.err { color: var(--bad); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; align-items: center; }
.row.wrap, .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap-s { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.w100 { width: 100%; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ic { flex: none; }

/* ---------------------------------------------------------------- layout */
.app { min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); padding: 20px 0 16px; display: flex; flex-direction: column; gap: 22px;
  background: var(--side-bg); color: var(--side-ink); overflow-y: auto;
}
.main { margin-left: var(--side); padding: 32px 40px 72px; max-width: 1260px; display: flex; flex-direction: column; gap: 20px; }
.topbar, .tabbar { display: none; }

.logo { display: flex; align-items: center; gap: 10px; padding: 0 20px; }
.logo img { width: 30px; height: 30px; display: block; }
.wm { display: flex; flex-direction: column; line-height: 1; }
.wm b { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.05em; }
.wm b i { font-style: normal; color: var(--accent); }
.wm small { font-family: var(--mono); font-weight: 500; font-size: 8.5px; letter-spacing: .42em; margin-top: 4px; opacity: .75; }
.logo.big { padding: 0; }
.logo.big img { width: 44px; height: 44px; }
.logo.big .wm b { font-size: 28px; }
.logo.big .wm small { font-size: 10px; }

.nav { display: flex; flex-direction: column; }
.nav a, .pg {
  display: flex; align-items: center; gap: 11px; padding: 9px 20px; color: var(--side-muted); font-weight: 500;
  border: 0; border-left: 3px solid transparent; background: none; text-align: left; width: 100%;
}
.nav a:hover, .pg:hover { background: var(--side-hover); color: var(--side-ink); }
.nav a.on { color: var(--side-ink); border-left-color: var(--accent); background: var(--side-hover); font-weight: 600; }
.nav a.on .ic { color: var(--accent); }
.side-sec { display: flex; flex-direction: column; }
.side-t { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--side-muted); opacity: .7; text-transform: uppercase; letter-spacing: .2em; padding: 0 20px 8px; }
.pg { font-size: 13.5px; }
.pg.on { color: var(--side-ink); border-left-color: var(--side-muted); }
.pg-dot { width: 9px; height: 9px; flex: none; }
.pg-dot.all { background: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 14px; }
.farm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid rgba(244,241,234,.16); color: var(--side-ink); font-size: 12.5px; font-weight: 500; }
.farm small { width: 100%; padding-left: 16px; color: var(--side-muted); }
.side .icon-btn { color: var(--side-muted); }
.side .icon-btn:hover { background: var(--side-hover); color: var(--side-ink); }

.led { width: 8px; height: 8px; border-radius: 0; flex: none; background: var(--ink-3); }
.led.ok { background: #3FAE5A; }
.led.busy { background: var(--accent); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.led.bad { background: var(--bad); }
.led.q { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.led.off { background: var(--ink-3); opacity: .6; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: var(--b) solid var(--ink); position: relative; margin-bottom: 10px; }
.head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 8px; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 12px); opacity: .35; }
.head p { margin-top: 4px; }
.head-a { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview-bar { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }

/* ---------------------------------------------------------------- pieces */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px;
  border: var(--b) solid var(--ink); background: transparent; color: var(--ink); font-weight: 600; white-space: nowrap;
  transition: background .12s, color .12s, transform .05s;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-accent { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--bad-line); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-line); color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; gap: 5px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: none; opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 18px 2px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; font-size: 12px; font-weight: 600; white-space: nowrap; border: var(--b) solid transparent; }
.pill-sym { font-size: 11px; line-height: 1; }
.pill-good { background: var(--surface-3); color: var(--ink); }
.pill-accent { background: var(--ink); color: var(--bg); }
.pill-info { border-color: var(--ink); color: var(--ink); }
.pill-warn { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.pill-bad { border-color: var(--bad-line); color: var(--bad); }
.pill-muted { border-color: var(--line-2); color: var(--ink-2); }

.card { background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-h p { margin-top: 2px; }
.card-b { padding: 14px 18px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 12px; }
.empty-i { width: 42px; height: 42px; border-radius: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); margin-bottom: 4px; }
.empty p { max-width: 380px; font-size: 13px; }

.seg { display: inline-flex; padding: 0; border: var(--b) solid var(--ink); gap: 0; max-width: 100%; overflow-x: auto; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; font-weight: 600; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button.on .count { background: var(--accent); color: var(--accent-ink); }
.count { font-size: 11.5px; padding: 0 6px; border-radius: 0; background: var(--surface-3); color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 0; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.static { cursor: default; height: 24px; background: var(--surface-2); border-color: transparent; }

.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.switch button { width: 38px; height: 22px; border-radius: 0; border: 0; background: var(--surface-3); position: relative; padding: 0; transition: background .15s; }
.switch button i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 0; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch button.on { background: var(--ink); }
.switch button.on i { background: var(--accent); }
.switch button.on i { transform: translateX(16px); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-l { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.field-h { font-size: 12px; color: var(--ink-3); }
.form { display: flex; flex-direction: column; gap: 14px; }
.emoji-in { width: 64px; text-align: center; font-size: 18px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list p { margin-top: 1px; }
.time { font-family: var(--mono); font-weight: 500; min-width: 84px; font-size: 13px; }
.ptag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }

/* ---------------------------------------------------------------- kpis */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; min-width: 0; }
.kpi-l { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.kpi-v { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-n { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-warn { border-top: 3px solid var(--accent); }

/* ---------------------------------------------------------------- content */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 220px; position: relative; }
.search .ic { position: absolute; left: 10px; color: var(--ink-3); }
.search input { padding-left: 32px; }
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.post, .mini { border: 1px solid var(--line); background: var(--surface); padding: 0; text-align: left; overflow: hidden; display: flex; flex-direction: column; transition: border-color .12s; }
.post:hover, .mini:hover { border-color: var(--ink); }
.post-b, .mini-b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: flex-start; }
.post-b > .row { align-self: stretch; }
.post-b b, .mini-b b { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.mini-b b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-3); }
.thumb-ph.big { aspect-ratio: 9 / 16; display: flex; flex-direction: column; gap: 8px; justify-content: center; align-items: center; background: var(--surface-2); border-radius: var(--r); }
.thumb-k { position: absolute; left: 0; top: 0; display: inline-flex; gap: 4px; align-items: center; padding: 4px 8px; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: #F4F1EA; background: #121212; }
.thumb-n { position: absolute; right: 0; top: 0; padding: 4px 8px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: #121212; background: #FF4A1C; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.mini { scroll-snap-align: start; }

/* ---------------------------------------------------------------- overlay / drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(10,10,10,.42); z-index: 50; display: flex; justify-content: flex-end; animation: fade .15s; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.drawer { width: min(560px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg); overflow-y: auto; position: relative; animation: slide .2s ease-out; }
.drawer.wide { width: min(920px, 100%); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-x { position: absolute; right: 12px; top: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 0; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 0; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; gap: 12px; }
.modal-h h3 { font-size: 16px; }
.modal-b { padding: 14px 18px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px 16px; border-top: 1px solid var(--line); }

.detail { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 22px; padding: 22px; }
.detail-media video, .detail-media .slides img { width: 100%; border-radius: var(--r); background: #000; display: block; }
.detail-media video { aspect-ratio: 9 / 16; }
.detail-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: var(--r); background: var(--surface-2); }
.copybox { display: flex; flex-direction: column; gap: 6px; }
.copybox pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px; padding: 10px 12px; border-radius: var(--r-s); background: var(--surface-2); max-height: 220px; overflow: auto; }
.titles { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.slides { position: relative; }
.sl-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 0; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.9); color: #111; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.sl-nav.l { left: 8px; } .sl-nav.r { right: 8px; }
.sl-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.sl-dots i { width: 6px; height: 6px; border-radius: 0; background: rgba(255,255,255,.5); cursor: pointer; }
.sl-dots i.on { background: #fff; }
.sl-n { position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 0; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 8px; align-items: center; padding: 11px 15px; background: var(--ink); color: var(--bg); border-left: 3px solid var(--accent); font-weight: 500; animation: pop .15s; }
.toast .ic { color: var(--accent); }

/* ---------------------------------------------------------------- create */
.steps { display: flex; flex-direction: column; gap: 22px; }
.steps h4 { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--ink-2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .2em; }
.stepn { width: 22px; height: 22px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-size: 11px; letter-spacing: 0; }
.pick-pages { display: flex; flex-wrap: wrap; gap: 10px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; }
.pick span { display: flex; flex-direction: column; }
.pick.on, .fmt.on, .idea.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), inset 4px 0 0 var(--accent); }
.avatar { width: 34px; height: 34px; border-radius: 0; display: grid; place-items: center; font-size: 17px; flex: none; }
.avatar.sm { width: 24px; height: 24px; border-radius: 0; font-size: 13px; }
.avatar.lg { width: 44px; height: 44px; border-radius: 0; font-size: 22px; }
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fmt { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; }
.fmt b, .pick b, .idea b { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: 15px; }
.fmt-i { width: 36px; height: 36px; border-radius: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); margin-bottom: 2px; }
.fmt.on .fmt-i { background: var(--ink); color: var(--bg); }
.fmt-m { display: flex; justify-content: space-between; color: var(--ink-2); font-family: var(--mono); font-size: 11px; margin-top: auto; padding-top: 6px; }
.fmt-m span { display: inline-flex; gap: 4px; align-items: center; }
.ideas { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.idea { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface); }
.idea > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.idea-c { width: 24px; height: 24px; border-radius: 0; display: grid; place-items: center; flex: none; background: var(--surface-2); font-size: 12px; font-weight: 600; }
.idea.on .idea-c { background: var(--ink); color: var(--bg); }

/* ---------------------------------------------------------------- plan */
.hours { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.hour { position: relative; }
.hour-b { width: 100%; height: 74px; border: 1px dashed var(--line-2); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); padding: 4px 2px; }
.hour-b:hover { background: var(--surface-2); }
.hour-h { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.hour-m { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hour-off { font-size: 16px; line-height: 15px; }
.hour.on .hour-b { border: var(--b) solid var(--ink); color: var(--bg); background: var(--ink); }
.hour-a { position: absolute; top: -7px; right: -5px; width: 22px; height: 22px; border-radius: 0; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--ink-3); padding: 0; }
.hour-a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.tl > span:nth-child(3) { flex: 1; min-width: 0; }
.tl:first-child { border-top: 0; }
.tl-t { min-width: 0; white-space: nowrap; font-family: var(--mono); font-weight: 500; font-size: 13px; }
.tl-d { width: 9px; height: 9px; border-radius: 0; }

/* ---------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .sw { width: 10px; height: 10px; border-radius: 0; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.tip { position: absolute; width: 220px; padding: 9px 11px; border-radius: 0; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); pointer-events: none; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; z-index: 5; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-l { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 8px; }
.hbar-l b { font-variant-numeric: tabular-nums; }
.hbar-t { height: 8px; border-radius: 0; background: var(--surface-2); overflow: hidden; }
.hbar-t div { height: 100%; background: var(--ink); min-width: 4px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-family: var(--mono); font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); font-size: 10.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.table th.on { color: var(--ink); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-cap { min-width: 240px; max-width: 420px; }
.t-cap small { display: block; margin-top: 2px; }

/* ---------------------------------------------------------------- factory / pages */
.machines, .pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.machine .card-b, .page-card .card-b { display: flex; flex-direction: column; gap: 12px; }
.now { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13px; border-left: 3px solid var(--accent); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatches button.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); padding: 32px; display: flex; flex-direction: column; gap: 16px; }

.linkbtn { border: 0; background: none; color: var(--ink-2); font-size: 13px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .hours { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .side { display: none; }
  .main { margin-left: 0; padding: 14px 16px calc(88px + env(safe-area-inset-bottom)); gap: 14px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .topbar .logo { padding: 0; }
  .topbar .wm small { display: none; }
  .pg-select { width: auto; max-width: 52%; padding: 6px 10px; font-size: 13px; font-weight: 550; border-radius: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border: 0; background: none; color: var(--ink-3); font-size: 10.5px; font-weight: 600; }
  .tabbar .on { color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }
  .sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; }
  .sheet { width: 100%; background: var(--surface); border-radius: 0; padding: 10px 10px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(30px); opacity: 0; } }
  .sheet a, .sheet button { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border: 0; background: none; color: var(--ink); font-weight: 550; font-size: 15px; border-radius: 0; text-align: left; }
  .sheet a:active, .sheet button:active { background: var(--surface-2); }
  h1 { font-size: 21px; }
  .kpi-v { font-size: 24px; }
  .kpi { padding: 12px; }
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .search { margin-left: 0; width: 100%; min-width: 0; }
  .toolbar .seg { width: 100%; }
  .detail { grid-template-columns: 1fr; padding: 16px; padding-top: 54px; }
  .detail-media { max-width: 360px; width: 100%; margin: 0 auto; }
  .drawer, .drawer.wide { width: 100%; }
  .hours { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .formats { grid-template-columns: 1fr; }
  .fmt { display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; row-gap: 2px; padding: 12px; }
  .fmt-i { grid-row: span 3; margin: 0; }
  .fmt-m { justify-content: flex-start; gap: 14px; padding-top: 2px; }
  .t-cap { min-width: 170px; }
  .machines, .pages-grid { grid-template-columns: 1fr; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .head-a { width: 100%; }
}
@media (max-width: 380px) { .posts { grid-template-columns: 1fr 1fr; } .strip { grid-auto-columns: 132px; } }
