.app-shell { display: flex; flex-direction: column; height: 100vh; background: var(--bg); position: relative; }

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: var(--header-h); min-height: var(--header-h); max-height: var(--header-h);
  padding: 0 var(--space-4); background: var(--panel);
  border-bottom: 1px solid var(--border); z-index: 40; flex-shrink: 0;
}
.brand { min-width: 180px; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.brand h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); line-height: 1.2; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.2; }
.header-center, .header-right { display: flex; align-items: center; gap: var(--space-2); }
.year-nav { display: inline-flex; align-items: center; gap: 2px; }
.year-nav .input { width: 84px; text-align: center; font-weight: 600; padding: 5px 6px; }

/* Buttons */
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: var(--radius-sm); padding: 5px 10px; font-size: 12px; cursor: pointer;
  font-family: inherit; font-weight: 550; line-height: 1.2;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--hover); }
.btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { color: var(--danger); border-color: #f0c9c5; background: #fff; }
.btn-danger:hover { background: #fdf4f3; }
.btn-icon {
  width: 28px; height: 28px; padding: 0; color: var(--muted);
}
.btn-icon:hover { color: var(--text); }
.voice-toggle.live { box-shadow: 0 0 0 2px var(--primary-soft); }
.btn-today { border-color: #c5d8e0; color: var(--primary); font-weight: 600; }
.btn-today:hover { background: var(--primary-soft); }

.seg {
  display: inline-flex; background: #eef1f4; border-radius: var(--radius-sm); padding: 2px;
}
.seg .btn {
  border: 0; background: transparent; border-radius: 4px; padding: 5px 10px; color: var(--muted); font-weight: 550;
}
.seg .btn:hover { background: rgba(255,255,255,0.6); color: var(--text); }
.seg .btn.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(28,36,48,0.08); }

.save-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.save-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.save-ok { color: var(--success); }
.save-ok .dot { background: var(--success); }
.save-busy { color: var(--muted); }
.save-busy .dot { background: var(--primary); animation: spin-dot 0.9s linear infinite; }
.save-err { color: var(--danger); font-weight: 600; }
.save-err .dot { background: var(--danger); }

@keyframes spin-dot { 0% { opacity: 0.35; } 50% { opacity: 1; } 100% { opacity: 0.35; } }

/* Body / sidebar */
.app-body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  z-index: 20; min-height: 0; overflow: hidden;
}
.sidebar-scroll {
  flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto;
  padding: var(--space-3) var(--space-3) var(--space-4);
  overscroll-behavior: contain;
}
.sidebar-foot { flex: 0 0 auto; padding: var(--space-3); border-top: 1px solid var(--border); }
.overlay { position: fixed; inset: 0; background: rgba(28,36,48,0.28); z-index: 30; }
.history-overlay { z-index: 54; }

.group-label {
  font-size: 11px; letter-spacing: 0.08em; font-weight: 650; color: var(--muted);
  margin: var(--space-4) 4px var(--space-2); text-transform: uppercase;
}
.group-label:first-child { margin-top: 0; }

.acc { border: 0; border-radius: 0; margin: 0; overflow: visible; }
.acc + .acc { border-top: 1px solid var(--border); }
.acc-h {
  width: 100%; display: flex; justify-content: flex-start; align-items: center; gap: var(--space-2);
  padding: 8px 6px; background: transparent; border: 0; cursor: pointer;
  font: inherit; font-weight: 550; font-size: 13px; color: var(--text); border-radius: var(--radius-sm);
}
.acc-h .icon { color: var(--muted); }
.acc.open .acc-h .icon:not(.acc-chevron) { color: var(--primary); }
.acc-h:hover { background: var(--hover); }
.acc.open .acc-h { color: var(--primary); background: var(--primary-soft); }
.acc-h .acc-chevron { margin-left: auto; color: var(--muted); transition: transform var(--ease); }
.acc.open .acc-h .acc-chevron { transform: rotate(180deg); color: var(--primary); }
.acc-b { display: none; padding: 4px 6px 12px; }
.acc.open .acc-b { display: block; }

.hint { font-size: 12px; color: var(--muted); margin: 0 0 var(--space-2); line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: var(--space-2); }
.field input, .field select, .input {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; background: var(--panel); color: var(--text);
}
.input:focus, .field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.stack { display: flex; flex-direction: column; gap: var(--space-2); }

/* Main calendar */
.main { flex: 1; min-width: 0; overflow: auto; padding: 0 var(--space-4) 96px; }
.main-sticky {
  position: sticky; top: 0; z-index: 12;
  background: var(--bg);
  padding: var(--space-4) 0 var(--space-2);
  margin: 0 0 var(--space-3);
}
.toolbar-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  flex-wrap: wrap; margin-bottom: 0;
}
.main-sticky .week-view-header { margin-top: var(--space-2); }
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; align-items: center; }
.day-scope {
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  padding: 2px; margin-right: 4px;
  border: 1px solid var(--border); border-radius: 999px; background: #f4f6f8;
}
.day-scope .chip-f { margin: 0; }
.day-scope .chip-f.on { background: #fff; box-shadow: 0 0 0 1px var(--primary-soft); }
.chip-f {
  font-size: 12px; border: 1px solid transparent; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; cursor: pointer; font-family: inherit;
  transition: background var(--ease), color var(--ease);
}
.chip-f:hover { background: #eceff3; color: var(--text); }
.chip-f.on { background: var(--primary-soft); color: var(--primary); }
.filters-clear-btn {
  margin-left: 4px; padding: 3px 10px; font-size: 12px; white-space: nowrap;
}
.filters-clear-btn:disabled { opacity: 0.4; cursor: default; }
.filters-clear-btn:not(:disabled) { color: var(--danger); border-color: #f0c9c5; }
.filters-clear-btn:not(:disabled):hover { background: #fdf4f3; }
.scenario-dd {
  position: relative; width: 100%; z-index: 25;
  margin: 0 0 var(--space-2);
}
.scenario-dd-btn {
  width: 100%; max-width: none; gap: 6px;
  padding: 7px 10px; font-size: 13px; justify-content: flex-start;
}
.scenario-dd-btn.active {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary);
}
.scenario-dd-label {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; text-align: left;
}
.scenario-dd-auto {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--muted); text-transform: uppercase;
}
.scenario-dd-btn.active .scenario-dd-auto { color: var(--primary); }
.scenario-dd-chevron {
  color: var(--muted); transition: transform var(--ease); flex: 0 0 auto;
  margin-left: auto;
}
.scenario-dd-chevron.open { transform: rotate(180deg); color: var(--primary); }
.scenario-dd-menu {
  position: relative; margin-top: 6px; width: 100%;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(28,36,48,0.12);
  display: flex; flex-direction: column; overflow: hidden;
}
.scenario-dd-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}
.scenario-dd-head strong {
  font-size: 13px; font-weight: 650; color: var(--text);
}
.scenario-dd-head span {
  font-size: 11px; color: var(--muted); font-weight: 550;
}
.scenario-dd-list {
  max-height: 180px; overflow: auto; padding: 6px;
  border-bottom: 1px solid var(--border);
}
.scenario-dd-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  border: 0; background: none; text-align: left;
  padding: 7px 8px; border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; font-weight: 550; color: var(--text);
  cursor: pointer;
}
.scenario-dd-item:hover { background: var(--hover); }
.scenario-dd-item.active {
  background: var(--primary-soft); color: var(--primary);
}
.scenario-dd-item-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scenario-dd-item em {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 650;
  color: var(--primary);
}
.scenario-dd-actions {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
}
.scenario-dd-actions .btn { width: 100%; justify-content: center; }
.vtr-bar {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto;
  justify-content: flex-end;
}
.vtr-bar-settings,
.vtr-bar-clear { flex: 0 0 auto; padding: 3px 9px; font-size: 12px; }
.vtr-bar-clear { color: var(--danger); }
.vtr-bar-picks {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  overflow-x: auto; padding: 2px 0;
}
.vtr-bar .vtr-item { flex: 0 0 auto; min-width: 0; }
.vtr-bar .vtr-count { font-size: 11px; line-height: 1.1; }
.vtr-bar .template {
  flex-direction: row; align-items: center; gap: 4px; min-height: 0;
  padding: 2px 6px;
}
.vtr-bar .chip {
  font-size: 11px; min-width: 40px; padding: 2px 6px;
}
.vtr-bar .template.vtr-picked,
.vtr-bar .template.brush-on {
  outline: none;
  background: transparent;
}
.vtr-bar .template.vtr-picked .chip {
  box-shadow: 0 1px 2px rgba(28, 36, 48, 0.06), 0 4px 10px rgba(26, 111, 138, 0.22);
  transform: translateY(-1px);
}
.vtr-bar .template.brush-on .chip {
  box-shadow: 0 0 0 2px var(--primary), 0 3px 8px rgba(26, 111, 138, 0.18);
  transform: translateY(-1px);
}
.vtr-bar .vtr-item:has(.vtr-picked) .vtr-count,
.vtr-bar .vtr-item:has(.brush-on) .vtr-count {
  color: var(--primary);
  font-weight: 650;
}
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; border: 1px solid transparent; }

.year-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  width: 100%;
}
@media (min-width: 1180px) {
  .year-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1680px) {
  .year-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.month-card {
  background: #fff; border: 1px solid #cbd5e1; border-radius: var(--radius);
  padding: var(--space-4); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}
.month-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid #e2e8f0;
}
.month-title {
  font-weight: 700; font-size: 16px; color: #0f172a; letter-spacing: 0.04em;
  text-transform: uppercase; margin: 0; padding: 0; border: 0; text-align: left; line-height: 1.2;
}
.month-year { font-size: 13px; color: #475569; font-weight: 600; }
.month-sub { font-size: 12px; color: #475569; margin: 0; font-weight: 550; white-space: nowrap; }

.days-grid {
  display: grid;
  grid-template-columns: 28px repeat(7, minmax(0, 1fr));
  gap: 0;
  border: 1px solid #cbd5e1;
  background: #cbd5e1;
}
.day-h {
  text-align: center; font-size: 11px; font-weight: 700; color: #334155;
  padding: 8px 4px; letter-spacing: 0.06em; background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
}
.day-h.weekend { background: #f1f5f9; color: #334155; }
.day-h-btn {
  border: 0; border-right: 1px solid #cbd5e1; width: 100%; font: inherit;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
}
.day-h-btn:hover { background: #e2e8f0; color: var(--text); }
.day-h-btn.filter-on {
  background: var(--primary-soft); color: var(--primary);
}
.day-h-btn.has-filter { color: var(--primary); }
.day-h-btn .day-h-filter { opacity: 0.45; flex: 0 0 auto; }
.day-h-btn:hover .day-h-filter,
.day-h-btn.filter-on .day-h-filter { opacity: 1; }

.col-filter-menu {
  position: fixed; z-index: 80; width: 260px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(28,36,48,0.16);
  display: flex; flex-direction: column; max-height: min(360px, calc(100vh - 24px));
}
.col-filter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px 4px; flex: 0 0 auto;
}
.col-filter-head strong { font-size: 13px; }
.col-filter-actions {
  display: flex; gap: 6px; padding: 0 10px 6px; flex: 0 0 auto;
}
.col-filter-actions .btn { padding: 2px 8px; font-size: 11px; }
.col-filter-list {
  overflow: auto; padding: 0 6px 6px; flex: 1 1 auto;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.col-filter-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.col-filter-item:hover { background: var(--hover); }
.col-filter-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-filter-count { color: var(--muted); font-size: 11px; font-weight: 600; }
.col-filter-foot {
  display: flex; justify-content: flex-end; gap: 8px; padding: 8px 10px; flex: 0 0 auto;
}
.col-filter-empty {
  padding: 12px; text-align: center; color: var(--muted); font-size: 12px;
}
.header-stats-tip {
  position: fixed; z-index: 85; width: 220px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(28,36,48,0.16);
  padding: 10px 12px; pointer-events: none;
  animation: tip-in 120ms ease;
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.header-stats-tip-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.header-stats-tip-head strong { font-size: 13px; }
.header-stats-tip-weeks { font-size: 11px; color: var(--muted); font-weight: 600; }
.header-stats-tip-section { margin-bottom: 8px; }
.header-stats-tip-section .group-label { margin: 0 0 4px; }
.header-stats-tip-section .hint { margin: 0; }
.header-stats-tip-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 0; font-size: 12px;
}
.header-stats-tip-row strong { font-variant-numeric: tabular-nums; color: var(--text); }
.header-stats-tip-hint { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border); }
.week-num {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #64748b; background: #f8fafc;
  border: 0; min-height: 76px; border-radius: 0; padding: 0; font-family: inherit;
  border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1;
}
.week-num.clickable { cursor: pointer; }
.week-num.clickable:hover { background: var(--primary-soft); color: var(--primary); }

/* Day cells */
.day-cell {
  min-height: 76px; background: #fff; border: 0; border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1;
  border-radius: 0; padding: 4px 6px 6px; display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden; transition: background var(--ease), box-shadow var(--ease);
}
.days-grid > .day-cell:nth-child(8n) { border-right: 0; }
.day-cell:hover { background: #f8fafc; }
.day-cell.empty { background: #f8fafc; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; pointer-events: none; }
.day-cell.out { opacity: 0.45; }
.day-cell.day-free { background: #cfe9d6; }
.day-cell.day-free:hover { background: #c3e6cf; }
.day-cell.vtr-lit {
  background: #b7e0c4;
  box-shadow: inset 0 0 0 2px #2f7d4a;
}
.day-cell.vtr-lit.day-free { background: #b7e0c4; }
.day-cell.vtr-lit:hover { background: #a8d8b8; }
.day-cell.today { background: #e8f3f6; box-shadow: inset 0 0 0 2px var(--primary); }
.day-cell.today.day-free { background: #c5e3cf; }
.day-cell.selected { background: #eaf3f7; box-shadow: inset 0 0 0 2px var(--primary); }
.day-cell.copied { box-shadow: inset 0 0 0 2px dashed var(--primary); }
.day-cell.highlight { background: #e8f3f6; }
.day-cell.marked {
  background: #fff4d0;
  box-shadow: inset 0 0 0 2px #d4a017;
}
.day-cell.marked.today,
.day-cell.marked.selected {
  box-shadow: inset 0 0 0 2px var(--primary), inset 0 0 0 5px #d4a017;
}
.day-cell.drag-over, .day-cell.paint-hover {
  background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary);
}
.day-cell.dim { opacity: 0.32; }
.day-cell.override { box-shadow: inset 4px 0 0 var(--primary); padding-left: 10px; }
.day-cell.shadow-diff { background: #f7f3fc; box-shadow: inset 4px 0 0 var(--shadow); padding-left: 10px; }
.day-cell.rsd-edge-ok {
  box-shadow: inset 0 0 0 2px #c4a574;
}
.day-cell.rsd-edge-over {
  box-shadow: inset 0 0 0 2px #b91c1c;
  background: #fde8e8;
}
.day-cell.rsd-edge-over.day-free { background: #f8d4d4; }
.day-flag.rsd-over-flag {
  background: #b91c1c;
  color: #fff;
  font-weight: 600;
}
.day-flag.rsd-ok-flag {
  background: #eedccc;
  color: #5a3c20;
}
.day-cell.override.shadow-diff { box-shadow: inset 4px 0 0 var(--primary), inset 8px 0 0 var(--shadow); padding-left: 12px; }
.day-cell.today.override { box-shadow: inset 0 0 0 2px var(--primary), inset 4px 0 0 var(--primary); }
.day-cell.today.shadow-diff { box-shadow: inset 0 0 0 2px var(--primary), inset 4px 0 0 var(--shadow); }

.day-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; flex-shrink: 0; }
.day-meta-left { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.day-n { font-size: 14px; color: #0f172a; font-weight: 700; line-height: 1.1; }
.day-n.with-month {
  font-size: 13px; font-weight: 700; color: #0f172a; letter-spacing: 0.02em;
  white-space: nowrap; overflow: visible; text-overflow: clip;
}
.day-wd {
  font-size: 11px; font-weight: 700; color: #475569; letter-spacing: 0.06em;
}
.day-cell.week-mode {
  min-height: 0; padding: 4px 6px; gap: 2px; overflow: hidden;
  justify-content: center;
}
.week-line {
  display: grid; grid-template-columns: 4.6rem minmax(0, 1fr);
  align-items: center; gap: 6px; min-width: 0; width: 100%;
}
.day-cell.week-mode .week-line .day-n {
  width: 4.6rem; font-size: 12px; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow: hidden;
}
.week-line .day-body {
  flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 4px; min-width: 0; overflow: hidden;
}
.day-cell.week-mode .badge-block {
  flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start;
  width: auto; max-width: 100%; min-width: 0; gap: 2px 4px; padding: 1px 5px;
  font-size: 11px; overflow: visible;
}
.day-cell.week-mode .shift-kind,
.day-cell.week-mode .shift-time,
.day-cell.week-mode .chip {
  white-space: nowrap; text-align: left; font-size: 11px; letter-spacing: 0;
}
.day-cell.week-mode .day-note { width: auto; max-width: 100%; padding: 1px 4px; font-size: 10px; }
.day-cell.week-mode .day-note-text { -webkit-line-clamp: 1; }
.day-cell.today .day-n { color: var(--primary); font-size: 15px; }
.day-cell.today .day-n.with-month { font-size: 14px; }
.day-cell.today.week-mode .week-line .day-n { font-size: 12px; }
.day-meta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.day-w { font-size: 10px; color: #64748b; font-weight: 700; letter-spacing: 0.04em; }
.today-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--primary); line-height: 1;
}
.hol {
  font-size: 10px; font-weight: 800; color: #334155; text-align: left;
  line-height: 1.15; letter-spacing: 0.04em; text-transform: uppercase;
  background: #e2e8f0; border-radius: 3px; padding: 1px 5px;
}
.day-body { flex: 1; display: flex; flex-direction: column; gap: 6px; justify-content: center; min-height: 0; }
.day-foot { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 0; }
.day-foot:empty { display: none; }
.day-note {
  display: inline-flex; align-items: flex-start; gap: 4px; max-width: 100%;
  border: 0; background: #f1f5f9; color: #475569; border-radius: 4px;
  padding: 2px 5px; font: inherit; font-size: 10px; font-weight: 600;
  cursor: pointer; text-align: left; line-height: 1.25;
  transition: background var(--ease), color var(--ease);
}
.day-note:hover { background: #e2e8f0; color: #0f172a; }
.day-note .icon { margin-top: 1px; flex-shrink: 0; color: #64748b; }
.day-note-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word; white-space: normal;
}
.note-area {
  resize: vertical; min-height: 72px; line-height: 1.4; font-family: inherit;
}
.note-actions { margin-top: var(--space-2); justify-content: space-between; }
.modal-day { width: min(440px, 100%); max-height: min(90vh, 720px); overflow: auto; }
.day-flag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft); border-radius: 3px; padding: 1px 5px;
}
.shadow-flag { color: var(--shadow); background: #ece4f7; }

.days-grid .badge-block {
  min-height: 0; border-radius: 5px; font-size: 13px; font-weight: 650;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  padding: 5px 6px; gap: 4px; border: 1px solid transparent; overflow: hidden;
}
.days-grid .shift-kind {
  font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-align: center; opacity: 0.8;
}
.days-grid .shift-time {
  font-size: 13px; font-weight: 700; text-align: center; white-space: nowrap;
  letter-spacing: -0.01em; color: inherit;
}
.days-grid .vtr-wrap { background: transparent; border: 0; padding: 0; gap: 6px; }
.days-grid .vtr-wrap .shift-time {
  border-radius: 5px; padding: 6px 4px; border: 0; background: transparent;
}
.days-grid .chip {
  align-self: center; min-width: 42px; max-width: 100%;
  text-align: center; border-radius: 4px; font-size: 11px; font-weight: 800;
  padding: 2px 6px; white-space: nowrap; overflow: hidden; letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.days-grid .dag { border-style: solid; border-width: 1px; }
.days-grid .laat { border-style: dashed; }
.days-grid .nacht { border-width: 2px; font-weight: 800; }
.days-grid .badge-block.shadow { font-size: 11px; padding: 4px; }

@media (min-width: 1280px) {
  .day-cell, .week-num { min-height: 84px; }
}
@media (min-width: 1680px) {
  .day-cell, .week-num { min-height: 88px; }
}

/* Badges */
.badge-block {
  min-height: 0; max-height: none; border-radius: 4px; font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  padding: 3px 4px; user-select: none; cursor: grab; overflow: hidden; gap: 2px;
  border: 1px solid transparent;
}
.badge-block:active, .badge-block.dragging { opacity: 0.45; cursor: grabbing; }
.badge-block[draggable="true"] {
  touch-action: none;
  -webkit-user-drag: element;
}
.day-cell {
  -webkit-touch-callout: none;
}
.badge-block.shadow {
  opacity: 0.72; border-style: dashed; font-size: 10px; cursor: default;
  background: var(--shadow-soft); border-color: #d8c8f0; color: var(--shadow);
}
.shift-time { font-size: 11px; font-weight: 650; text-align: center; white-space: nowrap; letter-spacing: -0.01em; }
.badge-label { font-size: 9px; letter-spacing: 0.05em; font-weight: 700; text-align: center; opacity: 0.75; }

.vroeg { background: var(--shift-early-bg); color: var(--shift-early-fg); border-color: var(--shift-early-bd); }
.laat { background: var(--shift-late-bg); color: var(--shift-late-fg); border-color: var(--shift-late-bd); }
.nacht { background: var(--shift-night-bg); color: var(--shift-night-fg); border-color: var(--shift-night-bd); }
.dag, .custom { background: var(--shift-day-bg); color: var(--shift-day-fg); border-color: var(--shift-day-bd); }
.vtr-wrap { background: transparent; border: 0; padding: 0; gap: 3px; }
.vtr-wrap .shift-time { background: transparent; border: 0; border-radius: 4px; padding: 2px 3px; }

.chip {
  align-self: center; width: auto; min-width: 36px; max-width: 100%;
  text-align: center; border-radius: 3px; font-size: 9px; font-weight: 700;
  padding: 1px 5px; white-space: nowrap; overflow: hidden; letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.vtr-ad { background: #ebe3c9; color: #5a4a1c; border-color: #d0c08e; }
.vtr-pv { background: #eed9e6; color: #5c2f4a; border-color: #d4a9c2; }
.vtr-tv { background: #d5e4ef; color: #27485e; border-color: #a7c0d4; }
.vtr-va { background: #f3d9b8; color: #7a3f0c; border-color: #d4a574; }
.vtr-rs { background: #eedccc; color: #5a3c20; border-color: #d4b496; }
.vtr-bc { background: #edd6d4; color: #6b2a26; border-color: #d4a8a4; }
.vtr-tp { background: #d8e0f0; color: #2a385c; border-color: #aab6d0; }
.vtr-default { background: #e8eaee; color: #334155; border-color: #c5cad3; }

.template { border-style: dashed; cursor: pointer; min-height: 36px; }
.template.brush-on { outline: 1.5px solid var(--primary); outline-offset: 1px; background: var(--primary-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.vtr-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vtr-count { font-size: 10px; color: var(--muted); text-align: center; font-weight: 500; }
.vtr-count.on { color: var(--text); }
.day-vtr-clear {
  width: 20px; height: 20px; color: var(--muted); flex: 0 0 auto;
}
.day-vtr-clear:hover { color: var(--danger); background: #fdf4f3; }
.week-line .day-vtr-clear { width: 18px; height: 18px; }

.base-layout {
  display: flex; align-items: flex-start; gap: var(--space-3); margin-top: var(--space-2);
}
.base-shifts {
  display: flex; flex-direction: column; gap: 6px; flex: 0 0 168px; min-width: 0;
}
.base-shifts .group-label { margin: 0 0 2px; }
.base-shifts .template { width: 100%; position: relative; cursor: grab; }
.base-shifts .template:active { cursor: grabbing; }
.base-shift-row { display: flex; align-items: stretch; gap: 4px; }
.base-shift-row .template { flex: 1 1 auto; min-width: 0; }
.base-shift-del { flex: 0 0 auto; align-self: center; }
.shift-adv-tag {
  position: absolute; top: 2px; right: 3px;
  font-size: 8px; font-weight: 700; letter-spacing: 0.04em;
  color: #5a4a1c; background: #ebe3c9; border: 1px solid #d0c08e;
  border-radius: 3px; padding: 0 3px; line-height: 1.4;
}
.badge-block.template.req-adv { padding-right: 28px; }
.base-shift-form {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #f8fafc;
}
.base-shift-times {
  display: flex; align-items: center; gap: 4px;
}
.base-shift-times .input { flex: 1 1 auto; min-width: 0; padding: 4px 6px; }
.base-shift-adv {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text); font-weight: 550; cursor: pointer;
}
.base-layout .base-grid { flex: 1 1 auto; min-width: 0; }
.base-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.base-cell {
  height: 44px; border: 1px dashed var(--border); border-radius: 4px; padding: 2px;
  position: relative; cursor: cell; overflow: hidden; background: #fbfcfd;
}
.base-cell:hover { background: var(--hover); }
.base-cell.paint-ready { border-style: solid; border-color: #94a3b8; cursor: copy; }
.base-n { position: absolute; top: 1px; left: 3px; font-size: 9px; color: var(--muted); }

.year-mark-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  flex-wrap: wrap; margin-bottom: var(--space-3);
}
.year-mark-actions { display: flex; align-items: center; gap: var(--space-2); }
.year-mark-actions .hint { margin: 0; }
.year-mark-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px;
}
.mini-month { min-width: 0; }
.mini-month-title {
  margin: 0 0 4px; font-size: 12px; font-weight: 650; color: var(--text);
}
.mini-days {
  display: grid; grid-template-columns: 16px repeat(7, minmax(0, 1fr)); gap: 2px;
}
.mini-dow {
  text-align: center; font-size: 9px; font-weight: 650; color: var(--muted);
  line-height: 1.2; padding-bottom: 2px;
}
.mini-week-h { font-size: 8px; }
.mini-week {
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 650; color: var(--muted); line-height: 1;
}
.mini-day {
  appearance: none; border: 0; background: #f8fafc; color: var(--text);
  border-radius: 3px; font: inherit; font-size: 11px; font-weight: 600;
  aspect-ratio: 1; min-height: 0; padding: 0; cursor: pointer; line-height: 1;
}
.mini-day:hover { background: var(--hover); }
.mini-day.empty { visibility: hidden; pointer-events: none; }
.mini-day.from-base {
  background-color: #e8eef3;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(71, 85, 105, 0.18),
    rgba(71, 85, 105, 0.18) 1px,
    transparent 1px,
    transparent 4px
  );
}
.mini-day.has-vtr {
  background-color: #cfe9d6;
  background-image: none;
  color: #1f4d2f;
}
.mini-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.mini-day.marked {
  background-color: #ffe8a3;
  background-image: none;
  color: #6b4e00; font-weight: 750;
  box-shadow: inset 0 0 0 1.5px #d4a017;
}
.mini-day.from-base.marked {
  background-color: #ffe8a3;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(120, 90, 10, 0.22),
    rgba(120, 90, 10, 0.22) 1px,
    transparent 1px,
    transparent 4px
  );
}
.mini-day.from-base.has-vtr {
  background-color: #cfe9d6;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(40, 100, 60, 0.18),
    rgba(40, 100, 60, 0.18) 1px,
    transparent 1px,
    transparent 4px
  );
}
.mini-day.marked.today {
  box-shadow: inset 0 0 0 1.5px var(--primary), inset 0 0 0 3px #d4a017;
}

.bulk-vtr {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.bulk-year {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  padding: 6px 8px; background: #f8fafc; border-radius: var(--radius-sm); margin-bottom: 4px;
}
.bulk-year .hint { margin: 0; }
.bulk-year strong { font-size: 16px; color: var(--text); }
.bulk-check {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text);
  margin: 4px 0 var(--space-2);
}
.bulk-summary {
  background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
}
.bulk-summary .hint { margin: 0 0 2px; }
.bulk-count { margin: 4px 0; font-size: 13px; font-weight: 700; color: var(--text); }
.history-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%);
  background: var(--panel); border-left: 1px solid var(--border); z-index: 55;
  display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(28,36,48,0.12);
}
.history-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4); border-bottom: 1px solid var(--border);
}
.history-head .modal-title { margin: 0; }
.history-toolbar { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-2); }
.history-list { flex: 1; overflow: auto; padding: var(--space-3) var(--space-4) var(--space-4); }
.history-group { margin-bottom: var(--space-4); }
.history-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2);
  padding: 8px 0; border-bottom: 1px solid #eef1f4;
}
.history-item.undone { opacity: 0.55; }
.history-item-main { min-width: 0; flex: 1; }
.history-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.history-time { font-size: 12px; font-weight: 700; color: var(--text); }
.history-day-link {
  border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--primary);
  cursor: pointer; text-align: left;
}
.history-day-link:hover { text-decoration: underline; }
.history-desc { font-size: 13px; color: var(--text); line-height: 1.35; word-break: break-word; }
.history-undo { flex-shrink: 0; white-space: nowrap; }
.history-foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
@media (max-width: 900px) {
  .history-drawer { width: 100%; }
}
.trash {
  padding: 8px; text-align: center; border: 1px dashed var(--border); background: #fafbfc;
  color: var(--muted); border-radius: var(--radius-sm); font-size: 12px; font-weight: 550;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.trash.over { background: #fdf4f3; color: var(--danger); border-color: #e8b4af; }
.clip {
  min-height: 52px; max-height: 120px; overflow: auto; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: var(--space-2); background: #fbfcfd;
}
.clip.over { background: var(--primary-soft); border-color: var(--primary); }

.version-list { display: flex; flex-direction: column; gap: 2px; }
.version-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: var(--radius-sm); padding: 6px;
  cursor: pointer; font: inherit; font-size: 13px; color: var(--text);
}
.version-item:hover { background: var(--hover); }
.version-item.active { background: var(--primary-soft); color: var(--primary); }
.version-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; display: inline-block; }
.version-item.active .version-dot { background: currentColor; }
.version-item em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; color: var(--primary); }
.shadow-active { color: var(--shadow) !important; font-weight: 600; }

.month-stats { display: flex; flex-direction: column; gap: var(--space-2); }
.month-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.month-stat-card {
  border: 0; border-radius: var(--radius-sm); padding: 6px 8px; background: #f6f7f9;
  display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--muted);
}
.month-stat-card strong { color: var(--text); font-size: 11px; letter-spacing: 0.04em; }

.week-view { display: flex; flex-direction: column; gap: var(--space-3); }
.week-view-header { background: var(--bg); }
.week-view-header .day-h { border-top: 1px solid #cbd5e1; }
.week-h-label { display: flex; align-items: center; justify-content: center; }
.week-day-h {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 0; padding: 6px 4px; line-height: 1.15;
}
.week-day-name {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: #334155;
}
.week-day-date {
  font-size: 13px; font-weight: 700; color: #0f172a; letter-spacing: 0.02em;
}
.week-day-today {
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--primary); margin-top: 1px;
}
.week-day-h.is-today {
  background: var(--primary-soft);
  box-shadow: inset 0 -2px 0 var(--primary);
}
.week-day-h.is-today .week-day-name,
.week-day-h.is-today .week-day-date { color: var(--primary); }
.week-row-grid .week-num { min-height: 36px; }
.week-row-grid .day-cell { min-height: 36px; overflow: visible; }
.week-current { outline: 1px solid var(--primary); outline-offset: 1px; border-radius: 6px; }
.all-weeks { display: flex; flex-direction: column; }

.brush-float {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 55;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(28,36,48,0.12); padding: 8px 12px;
  display: flex; align-items: center; gap: var(--space-3); min-width: 240px; max-width: 90vw;
}
.brush-float strong { font-size: 13px; display: block; }
.brush-float .hint { margin: 0; }
.brush-float.raised { bottom: 68px; }
.voice-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(20, 24, 32, 0.88);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(90vw, 420px);
  text-align: center;
}
.voice-heard {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}
.voice-heard.interim {
  opacity: 0.72;
  font-style: italic;
  font-weight: 400;
}
.voice-result {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.95;
  color: #b7f0c4;
}
.voice-error {
  font-size: 12px;
  font-weight: 700;
  color: #ffb4b4;
}
.voice-coach {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
  color: #c9d4e4;
}
.voice-help-tips {
  list-style: disc;
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted, #5b6575);
}
.modal-voice-help {
  width: min(520px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  overflow: auto;
}
.voice-help-group { margin-top: 12px; }
.voice-help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.voice-help-list li {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) 1.1fr;
  gap: 10px;
  align-items: start;
  font-size: 13px;
}
.voice-help-list code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-soft, #f3f5f8);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}
@media (max-width: 560px) {
  .voice-help-list li { grid-template-columns: 1fr; gap: 2px; }
}
.diensten-dock {
  z-index: 56; width: max-content; max-width: calc(100vw - 32px); min-width: 0;
}
.diensten-picks { display: flex; align-items: center; min-width: 0; }
.diensten-picks .hint { display: none; }
.diensten-picks .grid-2 { display: flex; gap: 6px; }
.diensten-dock .template {
  flex-direction: row; align-items: center; gap: 6px; min-height: 0;
  padding: 2px 8px; white-space: nowrap;
}
.diensten-brush {
  display: flex; align-items: center; gap: var(--space-3); flex: 0 0 auto;
  padding-left: var(--space-3); border-left: 1px solid var(--border);
}
.diensten-brush strong { font-size: 13px; display: block; }
.diensten-brush .hint { margin: 0; white-space: nowrap; }
.vtr-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.vtr-settings-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.vtr-settings-list { display: flex; flex-direction: column; gap: 4px; }
.vtr-settings-head {
  display: grid; grid-template-columns: 18px 42px 1fr 110px 88px; align-items: center; gap: 8px;
  padding: 0 8px 4px; font-size: 11px; color: var(--muted); font-weight: 600;
}
.vtr-settings-item {
  display: grid; grid-template-columns: 18px 42px 1fr 110px 88px; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm);
}
.vtr-settings-item:hover { background: var(--hover); }
.vtr-settings-label { font-size: 12px; color: var(--text); min-width: 0; }
.vtr-limit-field { display: flex; align-items: center; gap: 4px; min-width: 0; }
.vtr-limit-input {
  width: 64px; padding: 4px 6px; font-size: 12px; text-align: right;
}
.vtr-limit-unit { font-size: 11px; color: var(--muted); white-space: nowrap; }
.vtr-remaining { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; font-weight: 500; }
.vtr-remaining.on { color: var(--text); }
.vtr-remaining.over, .vtr-count.over { color: var(--danger); font-weight: 650; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 50;
  background: var(--panel); color: var(--text); border-radius: var(--radius);
  padding: 8px 12px; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(28,36,48,0.12); border: 1px solid var(--border); font-size: 12px;
}
.fab .btn { background: var(--hover); }

.menu {
  position: fixed; z-index: 60; width: min(248px, calc(100vw - 16px));
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(28,36,48,0.16);
  display: flex; flex-direction: column; overflow: hidden; font-size: 13px;
}
.menu-head {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px 9px;
  background: linear-gradient(180deg, var(--primary-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}
.menu-head-icon {
  color: var(--primary); flex: 0 0 auto; margin-top: 1px;
}
.menu-head-text {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.menu-head-text strong {
  font-size: 13px; font-weight: 650; color: var(--text); letter-spacing: -0.01em;
  line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-head-text span {
  font-size: 11px; color: var(--muted); font-weight: 550;
}
.menu-body { padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.menu-sep {
  height: 1px; background: var(--border); margin: 4px 2px;
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  text-align: left; border: 0; background: none;
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--text); line-height: 1.2;
  transition: background var(--ease), color var(--ease);
}
.menu-item:hover { background: var(--hover); }
.menu-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
.menu-item:disabled { opacity: 0.55; cursor: default; }
.menu-item:disabled:hover { background: none; }
.menu-item.current {
  background: var(--primary-soft); color: var(--primary); font-weight: 650;
}
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: #fdf4f3; }
.menu-item-icon { color: var(--muted); flex: 0 0 auto; }
.menu-item:hover .menu-item-icon { color: var(--text); }
.menu-item.current .menu-item-icon,
.menu-item.has-sub.open .menu-item-icon { color: var(--primary); }
.menu-item.danger .menu-item-icon { color: var(--danger); }
.menu-item-label { flex: 1 1 auto; min-width: 0; }
.menu-item-chevron {
  color: var(--muted); flex: 0 0 auto; margin-left: auto;
  transition: transform var(--ease);
}
.menu-item-chevron.open { transform: rotate(180deg); color: var(--primary); }
.menu-item.has-sub.open {
  background: var(--primary-soft); color: var(--primary);
}
.menu-item-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--border); display: inline-block;
}
.menu-subwrap { display: flex; flex-direction: column; }
.menu-sub {
  margin: 2px 0 4px 0; padding: 4px;
  background: #f7f9fb; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px; overflow: auto;
  display: flex; flex-direction: column; gap: 1px;
}
.menu-sub-item { padding: 6px 8px; font-size: 12px; }
.menu-sub-item.current { background: var(--primary-soft); }
.menu-vtr-item { gap: 7px; }
.menu-vtr-item .chip {
  flex: 0 0 auto; font-size: 10px; padding: 2px 6px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.02em; line-height: 1.2;
}
.menu-vtr-item .menu-item-label {
  font-size: 12px; font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-vtr-remain {
  flex: 0 0 auto; margin-left: auto;
  font-size: 11px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.menu-vtr-remain.on { color: var(--primary); }
.menu-vtr-remain.over { color: var(--danger); font-weight: 650; }
.menu-item-check { color: var(--primary); flex: 0 0 auto; margin-left: auto; }
.menu-sub-item.current .menu-item-label { color: var(--text); }

.modal-bg {
  position: fixed; inset: 0; background: rgba(28,36,48,0.32); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
}
.modal {
  background: var(--panel); border-radius: 12px; padding: var(--space-5);
  width: min(400px, 100%); box-shadow: 0 16px 40px rgba(28,36,48,0.18);
}
.modal h2, .modal-title { margin: 0 0 var(--space-2); font-size: 16px; font-weight: 650; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }
.modal-tool {
  width: min(880px, 100%); max-height: min(90vh, 860px);
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
}
.modal-tool-wide {
  width: min(1080px, 100%); max-height: min(92vh, 920px);
}
.modal-tool-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-2); flex: 0 0 auto;
}
.modal-tool-head .modal-title { display: flex; align-items: center; gap: 8px; margin: 0; }
.modal-tool-body { overflow: auto; padding: 0 var(--space-4) var(--space-4); }
.modal-bg.modal-pass { pointer-events: none; background: transparent; }
.modal-bg.modal-pass .modal { pointer-events: auto; }

.search-pop {
  position: absolute; right: 16px; top: var(--header-h); width: min(360px, calc(100% - 32px));
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  z-index: 45; max-height: 360px; overflow: auto; box-shadow: 0 12px 28px rgba(28,36,48,0.12);
}
.search-head { padding: var(--space-2) var(--space-2) 0; }
.search-count { padding: 8px 12px; margin: 0; }
.search-item { width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.search-item:hover { background: var(--hover); }

.warn {
  font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm);
  background: #faf6f1; color: var(--warning); cursor: pointer; border: 0; width: 100%; text-align: left; font-family: inherit;
}
.warn:hover { background: #f3ebe3; }
.diff {
  font-size: 12px; border: 0; background: var(--shadow-soft); border-radius: var(--radius-sm);
  padding: 8px; margin-bottom: 6px; color: var(--text);
}

.loading-screen { align-items: center; justify-content: center; font-size: 13px; color: var(--muted); height: 100vh; }
.day-cell:focus-visible, .btn:focus-visible, .chip-f:focus-visible, .version-item:focus-visible, .acc-h:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.hamburger { display: none; }

/* Tablet + compact laptop: volle kalenderbreedte, menu als lade */
@media (max-width: 1100px) {
  :root { --sidebar-w: min(300px, 86vw); --header-h: 56px; }
  .hamburger { display: inline-flex; }
  .app-header {
    height: auto; max-height: none; min-height: 56px; flex-wrap: wrap;
    padding: 8px 12px; padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }
  .brand { min-width: 0; }
  .header-center { flex-wrap: wrap; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w); min-width: 0; max-width: 320px;
    transform: translateX(-105%);
    transition: transform 0.2s ease; z-index: 40;
    box-shadow: 8px 0 24px rgba(28,36,48,0.12);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: none; }
  .main {
    padding: 0 var(--space-3) 110px;
    padding-left: max(var(--space-3), env(safe-area-inset-left));
    padding-right: max(var(--space-3), env(safe-area-inset-right));
  }
  .main-sticky { padding: var(--space-3) 0 var(--space-2); }
  .year-grid { grid-template-columns: 1fr; }
  .day-cell, .week-num { min-height: 76px; }
  .week-row-grid, .week-view-header { min-width: 640px; }
  .week-view { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .vtr-bar { justify-content: flex-start; width: 100%; }
  .vtr-bar-picks { -webkit-overflow-scrolling: touch; }
  .fab, .brush-float {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: none; width: auto;
  }
  .diensten-dock { width: auto; }
  .modal-tool, .modal-tool-wide { width: min(960px, calc(100vw - 24px)); }
  .base-layout { flex-direction: column; }
  .base-shifts { flex: 0 0 auto; width: 100%; max-width: 280px; }
  .search-pop {
    right: max(8px, env(safe-area-inset-right));
    width: min(380px, calc(100% - 16px));
  }
  .history-drawer {
    width: min(400px, 92vw);
    padding-top: env(safe-area-inset-top);
  }
}

@media (max-width: 900px) {
  .history-btn-label { display: none; }
  .year-mark-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .header-right .save-status { display: none; }
}

@media (max-width: 640px) {
  .year-mark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-cell, .week-num { min-height: 64px; }
  .week-row-grid, .week-view-header { min-width: 560px; }
}

/* Touch: grotere tikvlakken, minder hover-afhankelijkheid */
@media (hover: none), (pointer: coarse) {
  .btn { min-height: 40px; padding: 8px 12px; }
  .btn-icon { width: 40px; height: 40px; min-height: 40px; }
  .chip-f { min-height: 36px; padding: 6px 12px; }
  .acc-h { min-height: 44px; padding: 10px 8px; }
  .day-cell, .week-num, .base-cell { min-height: 80px; }
  .day-cell.week-mode { min-height: 48px; }
  .day-h-btn { min-height: 40px; }
  .scenario-dd-btn { min-height: 44px; }
  .scenario-dd-item { min-height: 40px; }
  .menu-item { min-height: 40px; padding: 10px 10px; }
  .vtr-bar .template { min-height: 36px; padding: 4px 8px; }
  .badge-block.template { min-height: 40px; }
  .filters-clear-btn { min-height: 36px; }
  .col-filter-item { min-height: 40px; padding: 8px 8px; }
  .version-item { min-height: 40px; }
  .warn { min-height: 40px; padding: 10px; }
  .search-item { min-height: 44px; }
  .mini-day { min-height: 28px; }
}
