:root {
  --bg: #161512;
  --bg-sidebar: #1a1814;
  --paper: #22201c;
  --inset: #2a2722;
  --ink: #f2ece3;
  --muted: #c9c0b4;
  --faint: #9e9589;
  --line: #3d3932;
  --line-strong: #524c43;
  --olive: #c5cbb8;
  --olive-fill: #c5cbb8;
  --olive-on: #161512;
  --olive-soft: #2e3328;
  --walnut: #d0a882;
  --brick: #e0a8a0;
  --brick-soft: #3d2c29;
  --brick-line: #6a4c46;
  --ochre: #ddc48a;
  --ochre-soft: #3a3426;
  --slate: #c5cdd2;
  --slate-soft: #2c3236;
  --sage: #b4cfc2;
  --sage-soft: #26332c;
  --nav-active-bg: #f2ece3;
  --nav-active-fg: #1a1814;
  --nav-hover: #2a2722;
  --count-bg: #3d3932;
  --count-on: #ddd6ca;
  --bar: #3d3932;
  --confirmee-bg: #322e28;
  --confirmee-fg: #d4cbbd;
  --livree-bg: #2a2825;
  --livree-fg: #9e9589;
  --today-col-bg: #262922;
  --today-col-line: #4a5240;
  --topbar-bg: color-mix(in srgb, var(--bg) 86%, #000);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 18px 36px -22px rgba(0, 0, 0, 0.65);
  --focus: #c5cbb8;
  --search-ring: rgba(197, 203, 184, 0.22);
  --backdrop: rgba(8, 7, 6, 0.58);
  --toast-bg: #f2ece3;
  --toast-fg: #161512;
  --radius: 8px;
  --sidebar-w: 248px;
  --sans: "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --serif: Palatino, "Palatino Linotype", "Book Antiqua", "URW Palladio L", "Georgia", serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #f1ece4;
  --bg-sidebar: #f6f2ea;
  --paper: #fcfaf6;
  --inset: #f7f3ec;
  --ink: #1e1b16;
  --muted: #6a6358;
  --faint: #8f877b;
  --line: #ddd5c8;
  --line-strong: #cfc6b6;
  --olive: #4f5c40;
  --olive-fill: #4f5c40;
  --olive-on: #f4efe6;
  --olive-soft: #e7ebe0;
  --walnut: #7a4e32;
  --brick: #8a3d32;
  --brick-soft: #f3e4df;
  --brick-line: #e4c8c0;
  --ochre: #8a6a32;
  --ochre-soft: #f3ebd8;
  --slate: #3f4a52;
  --slate-soft: #e4e8ea;
  --sage: #3d5a4c;
  --sage-soft: #dfeae3;
  --nav-active-bg: #2c2a26;
  --nav-active-fg: #f4efe6;
  --nav-hover: #ece6db;
  --count-bg: #e3ddd2;
  --count-on: #4a4740;
  --bar: #d8d0c2;
  --confirmee-bg: #ece6db;
  --confirmee-fg: #5a5146;
  --livree-bg: #eceae6;
  --livree-fg: #8f877b;
  --today-col-bg: #f8faf4;
  --today-col-line: #c5cbb8;
  --topbar-bg: color-mix(in srgb, var(--bg) 82%, white);
  --shadow: 0 1px 0 rgba(30, 27, 22, 0.04), 0 12px 28px -18px rgba(30, 27, 22, 0.28);
  --focus: #4f5c40;
  --search-ring: rgba(79, 92, 64, 0.12);
  --backdrop: rgba(30, 27, 22, 0.35);
  --toast-bg: #1e1b16;
  --toast-fg: #fcfaf6;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
}
.skip:focus { top: 12px; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* —— Sidebar —— */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  padding: 1.35rem 1rem 1rem;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0 0.35rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.mark {
  margin: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #2c2a26;
  color: #e8e0d4;
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 1rem;
  flex: 1;
}

.nav-label {
  margin: 1.1rem 0.5rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav-label:first-child { margin-top: 0.35rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  padding: 0.48rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--nav-hover); color: var(--ink); }

.nav-item.is-active {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
}

.nav-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  background: var(--count-bg);
  color: var(--ink);
  padding: 0.08rem 0.4rem;
  border-radius: 99px;
}

.nav-item.is-active .nav-count {
  background: var(--count-on);
  color: var(--nav-active-fg);
}

.sidebar-foot {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.session {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
}

.session strong { display: block; font-weight: 600; }
.session span span { color: var(--muted); font-size: 0.75rem; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--olive-soft);
  color: var(--olive);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.demo-link {
  display: inline-block;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.15rem 0.35rem;
}

.demo-link:hover { color: var(--ink); text-decoration: underline; }

/* —— Shell / topbar —— */
.shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-title { min-width: 0; flex: 1; }

.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: 0;
}

.topbar-title p {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.icon-btn {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  place-items: center;
  flex-shrink: 0;
}

.icon-btn svg { width: 18px; height: 18px; }

.menu-btn { display: none; }

.theme-btn .icon-moon { display: none; }
html[data-theme="light"] .theme-btn .icon-sun { display: none; }
html[data-theme="light"] .theme-btn .icon-moon { display: block; }

.search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.7rem;
  min-width: 220px;
  max-width: 280px;
}

.search svg { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }

.search input {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  padding: 0.48rem 0;
  width: 100%;
  color: var(--ink);
  outline: none;
}

.search:focus-within { border-color: var(--olive); box-shadow: 0 0 0 3px var(--search-ring); }

.chip-live {
  margin: 0;
  font-size: 0.72rem;
  color: var(--olive);
  background: var(--olive-soft);
  padding: 0.32rem 0.6rem;
  border-radius: 99px;
  white-space: nowrap;
}

main { padding: 1.25rem 1.6rem 3rem; }

.view[hidden] { display: none !important; }

.view.is-visible,
.view:not([hidden]) { display: block; }

.view[data-panel="vue"].is-visible {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
}

.section-head { margin-bottom: 1rem; }

.lead {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 42rem;
}

.muted { color: var(--muted); }

/* —— Today / week —— */
.today, .week, .board-main, .panel, .plan-grid article, .clients li,
.paper-table, .plan-detail, .paper-empty {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.today, .week { padding: 1.15rem 1.2rem 1.25rem; }

.today-head p, .week-head p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.today-grid {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.today-grid li {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
}

.today-grid button {
  width: 100%;
  height: 100%;
  text-align: left;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.today-grid button:hover { border-color: var(--line-strong); }

.today-grid li.warn button {
  background: var(--brick-soft);
  border-color: var(--brick-line);
}

.k {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.v {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.v span, .v small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.h {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.today-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.today-list li { margin: 0; padding: 0; }

.today-list button {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.today-list button:hover span { color: var(--olive); }

.today-list time {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  font-size: 0.8rem;
}

.kpis {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.kpis .v { font-size: 1.45rem; }

.kpi-link {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.kpi-link:hover .v { color: var(--olive); }

.delta {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.delta.up { color: var(--olive); }
.delta.down { color: var(--brick); }

.bars-wrap { margin-top: 1.15rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }

.bars-label {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  align-items: end;
  height: 92px;
}

.bars li {
  height: 100%;
  display: flex;
  align-items: end;
}

.bars span,
.bars button {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  height: var(--h);
  min-height: 4px;
  background: var(--bar);
  border: 0;
  border-radius: 3px 3px 0 0;
  font: inherit;
  font-size: 0.62rem;
  color: var(--muted);
  padding-bottom: 0.15rem;
  gap: 0.1rem;
  cursor: pointer;
}

.bars button:hover { filter: brightness(1.08); }

.bars .is-today button { background: var(--olive-fill); color: var(--olive-on); }
.bars .is-off span { background: transparent; color: var(--faint); min-height: 0; height: auto; cursor: default; }

.bars b { font-weight: 600; }

/* —— Board —— */
.board {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 1rem;
  align-items: start;
}

.board[hidden] { display: none !important; }

.board-main { padding: 0.9rem 0 0.4rem; min-width: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1rem;
  padding: 0.15rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.toolbar h2 { margin-right: auto; }

.filters { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.filter {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.58rem;
  border-radius: 99px;
  cursor: pointer;
}

.filter:hover { border-color: var(--line-strong); color: var(--ink); }

.filter.is-on {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-bg);
  color: var(--nav-active-fg);
}

.search-hint {
  margin: 0;
  padding: 0.55rem 1.1rem 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }

.paper-table { padding: 0.2rem 0 0.4rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0.7rem 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 0.62rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--inset); }
tbody tr.is-selected td { background: var(--olive-soft); }

.ref {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.client-cell { font-weight: 600; }
.piece { color: var(--muted); }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.due { font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.is-late { color: var(--brick); font-weight: 600; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem 0.18rem 0.4rem;
  border-radius: 99px;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.devis { background: var(--slate-soft); color: var(--slate); }
.status.confirmee { background: var(--confirmee-bg); color: var(--confirmee-fg); }
.status.fabrication { background: var(--ochre-soft); color: var(--ochre); }
.status.finition { background: var(--sage-soft); color: var(--sage); }
.status.prete { background: var(--olive-soft); color: var(--olive); }
.status.livree { background: var(--livree-bg); color: var(--livree-fg); }
.status.retard { background: var(--brick-soft); color: var(--brick); }

.empty {
  margin: 0;
  padding: 1.4rem 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.paper-empty { margin-top: 0.75rem; }

.plain tbody tr { cursor: default; }
.plain tbody tr:hover td { background: transparent; }

.st {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
}

.st.ok { background: var(--olive-soft); color: var(--olive); }
.st.low { background: var(--brick-soft); color: var(--brick); }

/* —— Buttons / forms —— */
.btn {
  font: inherit;
  font-size: 0.84rem;
  padding: 0.42rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.btn:hover { border-color: var(--line-strong); }

.btn-primary {
  background: var(--olive-fill);
  border-color: var(--olive-fill);
  color: var(--olive-on);
  font-weight: 600;
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-ghost {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--olive); color: var(--olive); }

.status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.status-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  flex: 1;
  min-width: 10rem;
}

.status-form select,
.modal input,
.modal select {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.42rem 0.55rem;
  width: 100%;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.qty button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: var(--inset);
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.qty button:hover { border-color: var(--olive); }
.qty span { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }

/* —— Detail panel —— */
.panel {
  padding: 1.15rem 1.15rem 1.2rem;
  position: sticky;
  top: 4.6rem;
}

.panel-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.panel h2 { margin: 0.25rem 0 0.4rem; font-size: 1.2rem; }

.meta {
  display: grid;
  gap: 0.55rem;
  margin: 0.9rem 0 0;
}

.meta div {
  display: grid;
  grid-template-columns: 6.2rem 1fr;
  gap: 0.4rem;
  font-size: 0.86rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.meta dt { color: var(--faint); margin: 0; }
.meta dd { margin: 0; }

.notes {
  margin: 0.9rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.timeline {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 0.7rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 0.35rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.timeline li:last-child { padding-bottom: 0; }
.timeline strong { color: var(--ink); font-weight: 600; }

.activity {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.activity[hidden] { display: none; }

.activity h3 {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.activity ol { list-style: none; margin: 0; padding: 0; }

.activity li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.55rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.activity time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 0.75rem; }

/* —— Planning / clients —— */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.55rem;
}

.plan-grid article {
  padding: 0;
  box-shadow: none;
}

.plan-day {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 0.75rem 0.7rem 0.85rem;
  cursor: pointer;
  border-radius: inherit;
}

.plan-day:hover { background: var(--inset); }

.plan-grid article.is-selected {
  border-color: var(--olive);
  box-shadow: 0 0 0 1px var(--olive);
}

.plan-grid h3 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.plan-grid h3 span {
  display: block;
  color: var(--faint);
  font-weight: 500;
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.plan-grid ul { list-style: none; margin: 0.65rem 0 0; padding: 0; }

.plan-grid li {
  font-size: 0.78rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.plan-grid li em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.72rem;
}

.plan-grid .is-today-col { border-color: var(--today-col-line); background: var(--today-col-bg); }

.plan-detail {
  margin-top: 0.85rem;
  padding: 1rem 1.1rem 1.15rem;
}

.plan-detail h3 {
  margin: 0 0 0.65rem;
  font-family: var(--serif);
  font-size: 1.02rem;
}

.plan-orders {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plan-orders li { margin: 0; padding: 0; }

.plan-orders button {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.plan-orders button:hover { color: var(--olive); }

.clients { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }

.clients li {
  padding: 0;
  box-shadow: none;
}

.client-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: inherit;
}

.client-btn:hover { background: var(--inset); }

.clients strong { font-size: 0.95rem; }
.clients .where { color: var(--muted); font-size: 0.82rem; grid-column: 1; }
.clients .tag { color: var(--faint); font-size: 0.75rem; }

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 12;
}

body.nav-open .backdrop { display: block; }

/* —— Modal —— */
.modal-root[hidden] { display: none; }

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 1.3rem;
}

.modal h2 { margin-bottom: 0.25rem; }

.modal form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* —— Toast —— */
.toasts {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 40;
  display: grid;
  gap: 0.45rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  background: var(--toast-bg);
  color: var(--toast-fg);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.84rem;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .view[data-panel="vue"].is-visible,
  .board { grid-template-columns: 1fr; }
  .panel { position: static; }
  .plan-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 15;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 32px rgba(30, 27, 22, 0.18);
  }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: grid; }
  .chip-live { display: none; }
  .search { min-width: 0; max-width: none; flex: 1; }
  .topbar { padding: 0.8rem 1rem; }
  main { padding: 1rem 1rem 2.5rem; }
  .today-grid, .kpis { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .plan-orders button { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (max-width: 520px) {
  .today-grid, .kpis { grid-template-columns: 1fr; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .toast { animation: none; }
}
