/* ELMOS — premium koffiezaak-dashboard */
:root {
  --cream: #F6F1E9;
  --cream-2: #FBF8F3;
  --beige: #E8DCCB;
  --beige-2: #D9C7AE;
  --sand: #C9B08F;
  --caramel: #A97C50;
  --brown: #5A3E2B;
  --espresso: #2B1D14;
  --black: #120C08;
  --white: #FFFFFF;
  --line: #E4D8C6;
  --muted: #8A7663;
  --ok: #4E7A57;
  --ok-bg: #E7F0E6;
  --warn: #A8741A;
  --warn-bg: #F8EDD5;
  --err: #A33F2F;
  --err-bg: #F6E1DC;
  --keuken: #EADBC8;
  --barista: #D9C3A5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(43, 29, 20, .04), 0 8px 24px rgba(43, 29, 20, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); color: var(--espresso); background: var(--cream);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--brown); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ----------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--espresso), var(--black));
  color: var(--beige); padding: 26px 16px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); color: var(--espresso); font-family: var(--serif); font-size: 22px; font-weight: 700;
}
.brand-name { font-family: var(--serif); font-size: 24px; letter-spacing: 4px; color: var(--white); }
.brand-sub { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--sand); }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--beige); text-decoration: none; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(232, 220, 203, .08); color: var(--white); }
.nav a.active { background: var(--cream); color: var(--espresso); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--sand); border-top: 1px solid rgba(232,220,203,.12); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 22px 34px 8px;
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .eyebrow { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--caramel); font-weight: 600; }
.menu-btn { display: none; }
.content { padding: 16px 34px 60px; display: flex; flex-direction: column; gap: 20px; }

/* ----------------------------------------------------------- cards */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.hero {
  background: radial-gradient(120% 140% at 0% 0%, #3A281C 0%, var(--espresso) 45%, var(--black) 100%);
  color: var(--cream); border-radius: 20px; padding: 28px 30px; display: flex; gap: 20px;
  align-items: center; justify-content: space-between; flex-wrap: wrap; box-shadow: var(--shadow);
}
.hero h1 { color: var(--white); font-size: 32px; }
.hero p { margin: 6px 0 0; color: var(--beige-2); }
.hero .btn.ghost { color: var(--cream); border-color: rgba(246,241,233,.3); }
.hero .btn.ghost:hover { background: rgba(246,241,233,.08); }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--serif); font-size: 34px; line-height: 1.1; }
.kpi .sub { font-size: 13px; color: var(--muted); }

/* ----------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px;
  padding: 9px 18px; border: 1px solid var(--espresso); background: var(--espresso); color: var(--white);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .05s, background .15s, opacity .15s;
}
.btn:hover { background: var(--black); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--espresso); border-color: var(--beige-2); }
.btn.ghost:hover { background: var(--cream); }
.btn.light { background: var(--cream); color: var(--espresso); border-color: var(--cream); }
.btn.light:hover { background: var(--beige); }
.btn.danger { background: transparent; color: var(--err); border-color: #E3B7AE; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brown); }
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--espresso); background: var(--cream-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(169,124,80,.15); background: var(--white); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--espresso); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ----------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; background: var(--cream); color: var(--brown); border: 1px solid var(--line);
}
.badge.concept { background: var(--warn-bg); color: var(--warn); border-color: #EBD6AA; }
.badge.goedgekeurd { background: var(--ok-bg); color: var(--ok); border-color: #C9DEC8; }
.badge.gearchiveerd { background: #EEE9E3; color: var(--muted); }
.badge.fout { background: var(--err-bg); color: var(--err); border-color: #EBC5BD; }
.badge.waarschuwing { background: var(--warn-bg); color: var(--warn); border-color: #EBD6AA; }
.badge.info { background: #EEF0F2; color: #5B6570; border-color: #DADFE4; }
.badge.keuken { background: var(--keuken); border-color: var(--keuken); color: var(--brown); }
.badge.barista { background: var(--barista); border-color: var(--barista); color: var(--espresso); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ----------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid #F0E8DC; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--cream-2); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.pos { color: var(--ok); } .neg { color: var(--err); }

/* ----------------------------------------------------------- roster grid */
.roster-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); max-height: 72vh; }
table.roster { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
table.roster th, table.roster td { border-right: 1px solid #F0E8DC; border-bottom: 1px solid #F0E8DC; }
table.roster thead th {
  position: sticky; top: 0; z-index: 3; background: var(--espresso); color: var(--cream); font-weight: 500;
  padding: 8px 6px; min-width: 108px; text-align: center; cursor: pointer; user-select: none;
}
table.roster thead th .wd { display: block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sand); }
table.roster thead th .dt { font-family: var(--serif); font-size: 16px; }
table.roster thead th.busy1 { background: #4A3324; }
table.roster thead th.busy2 { background: var(--caramel); }
table.roster thead th.today { box-shadow: inset 0 -3px 0 var(--cream); }
table.roster .name-col {
  position: sticky; left: 0; z-index: 2; background: var(--white); min-width: 150px; text-align: left; padding: 8px 12px;
}
table.roster thead .name-col { z-index: 4; background: var(--black); cursor: default; text-align: left; }
table.roster .name-col b { display: block; font-size: 14px; }
table.roster .name-col span { font-size: 11.5px; color: var(--muted); }
table.roster td.cell { padding: 4px; height: 52px; vertical-align: middle; cursor: pointer; position: relative; }
table.roster td.cell:hover { background: var(--cream-2); }
table.roster td.cell.empty:hover::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--sand); font-size: 20px; }
table.roster td.cell.weekend { background: #FCFAF6; }
.shift {
  border-radius: 8px; padding: 5px 7px; line-height: 1.25; border-left: 3px solid var(--brown);
}
.shift.keuken { background: var(--keuken); }
.shift.barista { background: var(--barista); border-left-color: var(--espresso); }
.shift .tm { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; letter-spacing: -.1px; }
.shift .br { font-size: 10.5px; color: var(--brown); white-space: nowrap; }
.shift .rl { font-size: 11px; color: var(--brown); display: flex; justify-content: space-between; gap: 4px; }
.shift.locked .rl::after { content: "●"; color: var(--caramel); font-size: 9px; }
.shift.bad { outline: 2px solid var(--err); }
.absent { font-size: 11.5px; color: var(--muted); font-style: italic; text-align: center; background: repeating-linear-gradient(135deg, #F6F1E9, #F6F1E9 6px, #FBF8F3 6px, #FBF8F3 12px); border-radius: 8px; padding: 8px 4px; }
table.roster tfoot td { position: sticky; bottom: 0; background: var(--cream); padding: 6px; text-align: center; font-size: 11.5px; z-index: 1; }
table.roster tfoot .name-col { background: var(--cream); z-index: 2; font-weight: 600; }
.cov { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.cov span { border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.cov .ok { background: var(--ok-bg); color: var(--ok); }
.cov .onder { background: var(--err-bg); color: var(--err); }
.cov .over { background: var(--warn-bg); color: var(--warn); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }

/* day view */
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.day-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.day-card h3 { display: flex; justify-content: space-between; align-items: center; }
.day-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #EFE6D9; font-size: 13.5px; }
.day-row:last-child { border-bottom: 0; }

/* ----------------------------------------------------------- issues */
.issues { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow: auto; }
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--cream-2); border: 1px solid #F0E8DC; font-size: 13.5px; }
.issue .badge { flex: none; }
.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-state h3 { color: var(--espresso); margin-bottom: 6px; }

/* coverage mini */
.cov-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cov-day { background: var(--cream-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; }
.cov-day .wd { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.cov-day .dt { font-family: var(--serif); font-size: 20px; }
.cov-day .cov { flex-direction: column; margin-top: 6px; }
.cov-day.busy { border-color: var(--caramel); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 56px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 10px; background: var(--cream); border-radius: 99px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--brown), var(--caramel)); border-radius: 99px; }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--espresso); }

/* ----------------------------------------------------------- chat */
.chat { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; height: calc(100vh - 170px); min-height: 480px; padding: 0; overflow: hidden; }
.chat-log { overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; background: var(--cream-2); }
.msg { max-width: 82%; padding: 12px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--espresso); color: var(--cream); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--white); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; opacity: .6; margin-top: 4px; }
.chat-input { min-width: 0; display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--white); align-items: flex-end; flex-wrap: wrap; }
.chat-input textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; border-radius: 14px; min-width: 200px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--brown); }
.chip:hover { background: var(--cream); }
.proposal { border: 1px solid var(--beige-2); border-radius: 14px; background: var(--cream); padding: 14px; margin-top: 10px; }
.proposal h4 { margin: 0 0 6px; font-family: var(--serif); font-size: 16px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; font-size: 12.5px; }
.diff ul { margin: 4px 0 0; padding-left: 16px; max-height: 160px; overflow: auto; }
.diff .add { color: var(--ok); } .diff .rem { color: var(--err); }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sand); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ----------------------------------------------------------- modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(18,12,8,.45); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--white); border-radius: 20px; width: min(620px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(18,12,8,.35); }
.modal-head { padding: 20px 24px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-body { padding: 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 0 24px 22px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--espresso); color: var(--cream); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; max-width: 380px; animation: up .2s ease-out; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { border: 1px solid var(--line); background: var(--cream-2); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.presets button.on { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.cand { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--beige); border-top-color: var(--brown); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-emp { display: flex; flex-direction: column; gap: 4px; }
.list-emp button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font: inherit; cursor: pointer; display: flex; justify-content: space-between; color: var(--espresso); }
.list-emp button:hover { background: var(--cream); }
.list-emp button.on { background: var(--espresso); color: var(--cream); }
.avail-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #F0E8DC; }
.avail-row .times { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.avail-row .times input { width: 110px; }
.section-note { background: var(--cream); border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px; font-size: 13.5px; color: var(--brown); }

/* ----------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-21 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(18,12,8,.4); z-index: 25; }
  .menu-btn { display: inline-flex; background: var(--white); border: 1px solid var(--line); border-radius: 12px; width: 42px; height: 42px; align-items: center; justify-content: center; cursor: pointer; }
  .topbar { padding: 16px 16px 4px; }
  .content { padding: 12px 16px 40px; gap: 16px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .hero { padding: 22px; } .hero h1 { font-size: 26px; }
  .cov-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chat { height: calc(100vh - 140px); }
  .msg { max-width: 92%; }
  .diff { grid-template-columns: 1fr; }
  .avail-row { grid-template-columns: 1fr; }
  .chat-input .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .chat-input .chip { white-space: nowrap; flex: none; }
  table.roster .name-col { min-width: 104px; padding: 6px 8px; }
  table.roster .name-col b { font-size: 13px; }
  #availGrid { grid-template-columns: 1fr !important; }
  .list-emp { flex-direction: row; overflow-x: auto; }
  .list-emp button { white-space: nowrap; gap: 8px; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 26px; }
  .card { padding: 16px; }
  .topbar .actions { display: none; }
}

/* ----------------------------------------------------------- print */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; } .content { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .roster-wrap { max-height: none; overflow: visible; border: 0; }
  table.roster thead th { position: static; }
  body { background: white; }
}

/* ----------------------------------------------------------- uren & haalbaarheid */
.hours-compare { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.hc-main { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.hc-num { font-family: var(--serif); font-size: 20px; }
.hc-diff { font-weight: 700; font-size: 15px; }
.infeasible { background: var(--err-bg); border: 1px solid #EBC5BD; color: #6E2A1F; border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 13.5px; }
.infeasible ul { margin: 6px 0; padding-left: 18px; }
.rules-table td { vertical-align: middle; }
.rules-table input { width: 100%; min-width: 70px; }
.rules-table label.field { gap: 0; }

/* ----------------------------------------------------------- tijdlijn */
.tl-days { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tl-days button { border: 1px solid var(--line); background: var(--cream-2); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; position: relative; }
.tl-days button.on { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.tl-days button.bad::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--err); }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tl { overflow-x: auto; }
.tl > * { min-width: 760px; }
.tl-section { border-top: 1px solid var(--line); padding: 8px 0 10px; }
.tl-title { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; color: var(--brown); margin-bottom: 4px; }
.tl-peak-wrap { position: relative; }
.tl-peak { position: absolute; top: 0; bottom: 0; background: rgba(169,124,80,.12); border-left: 1px dashed var(--caramel); border-right: 1px dashed var(--caramel); pointer-events: none; }
.tl-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; min-height: 30px; }
.tl-name { font-size: 13px; font-weight: 600; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 26px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 11.5 - 1px), #F0E8DC calc(100% / 11.5 - 1px), #F0E8DC calc(100% / 11.5)); }
.tl-axis .tl-track { background: none; height: 18px; }
.tl-axis span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 7px; border-left: 3px solid var(--brown); overflow: hidden; cursor: pointer; z-index: 1; }
.tl-bar.keuken { background: var(--keuken); }
.tl-bar.barista { background: var(--barista); border-left-color: var(--espresso); }
.tl-bar span { position: relative; z-index: 2; font-size: 11.5px; font-weight: 600; padding: 0 6px; line-height: 20px; white-space: nowrap; }
.tl-break, i.hatch { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(43,29,20,.35) 0 3px, rgba(255,255,255,.55) 3px 6px); }
i.hatch { position: static; display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
.tl-strip { display: grid; grid-template-columns: repeat(46, minmax(0, 1fr)); gap: 1px; height: 30px; }
.tl-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 3px; font-size: 10.5px; line-height: 1; cursor: default; }
.tl-slot span { font-weight: 700; }
.tl-slot i { font-style: normal; font-size: 8.5px; opacity: .65; }
.tl-slot.ok { background: var(--ok-bg); color: var(--ok); }
.tl-slot.onder { background: var(--err); color: #fff; }
.tl-slot.over { background: var(--warn-bg); color: var(--warn); }

table.scen th { text-transform: none; letter-spacing: 0; font-size: 12.5px; white-space: normal; }
table.scen td.pos strong { color: var(--ok); }

.valid-banner { background: var(--ok-bg); border: 1px solid #C9DEC8; color: #2F5537; border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; }
.valid-banner ul, .infeasible ul { margin: 6px 0; padding-left: 18px; }

/* ================================================================
   Mobiel, tablet & installeerbare app (PWA)
   Zelfde ontwerp; alleen betere maatvoering voor telefoons/tablets.
   ================================================================ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
.grid > *, .content > * { min-width: 0; }

/* veilige randen (notch, home-indicator) — op computers is dit 0 */
.topbar {
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
  padding-right: calc(34px + env(safe-area-inset-right, 0px));
}
.content {
  padding-right: calc(34px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}
.sidebar {
  padding-top: calc(26px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  overflow-y: auto; overscroll-behavior: contain;
}
.toasts {
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

/* schermhoogte die meebeweegt met de adresbalk van mobiele browsers */
@supports (height: 100dvh) {
  .sidebar { height: 100dvh; }
  .app { min-height: 100dvh; }
  .chat { height: calc(100dvh - 170px); }
  .modal { max-height: calc(100dvh - 32px); }
}

@media (max-width: 1200px) {
  .g-21 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    padding: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 4px calc(16px + env(safe-area-inset-left, 0px));
  }
  .content {
    padding: 12px calc(16px + env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
  }
  .sidebar { width: min(290px, 86vw); }
  .roster-wrap { max-height: none; }
  .chat-input { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .rules-table input { min-width: 92px; }
  .tl > * { min-width: 700px; }  /* naamkolom blijft 130px: de piekband in app.js rekent daarmee */
  .tl-name { position: sticky; left: 0; z-index: 3; background: var(--white); }
  .tl-days { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .tl-days button { flex: none; }
  .presets { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .presets button { flex: none; white-space: nowrap; }
  @supports (height: 100dvh) { .chat { height: calc(100dvh - 140px); } }
}

@media (max-width: 560px) {
  /* knoppen bovenaan blijven bereikbaar: onder de titel in plaats van verborgen */
  .topbar { flex-wrap: wrap; }
  .topbar .actions { display: flex; order: 3; width: 100%; }
  .topbar .actions .btn { flex: 1 1 auto; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 23px; }
  .cov-week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 74px 1fr 48px; }
  .msg { max-width: 96%; }
  .chat-log { padding: 14px; }
  .chat-input textarea { min-width: 0; flex-basis: 100%; }
  .cand { flex-wrap: wrap; }
  /* vensters: vrijwel schermvullend, kop en knoppen vast, inhoud scrollt */
  .modal-back { padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px)); place-items: end center; }
  .modal { width: 100% !important; max-height: calc(100vh - 16px); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; }
  .modal-head { padding: 16px 16px 0; flex: none; }
  .modal-head h2 { font-size: 19px; }
  .modal-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
  .modal-foot { padding: 10px 16px 16px; flex: none; border-top: 1px solid var(--line); }
  .modal-foot .btn { flex: 1 1 auto; }
  .toasts { left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: none; }
  @supports (height: 100dvh) {
    .modal { max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
  }
}

/* aanraakschermen: grotere tikvlakken (min. 44 px) en geen inzoomen op invoervelden */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 44px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .btn, .btn.sm { min-height: 44px; }
  .btn.sm { padding: 8px 14px; }
  .chip, .presets button, .tl-days button, .list-emp button { min-height: 44px; }
  .chip { display: inline-flex; align-items: center; }
  .check { min-height: 44px; }
  .card-head a, a.small { display: inline-flex; align-items: center; min-height: 44px; }
  .nav a { min-height: 46px; }
  .x { min-width: 44px; min-height: 44px; }
  .menu-btn { width: 44px; height: 44px; }
  a, button, .btn, td.cell, .tl-bar { -webkit-tap-highlight-color: rgba(169, 124, 80, .18); touch-action: manipulation; }
  table.roster td.cell.empty:hover::after { content: none; }
}

/* geïnstalleerde app (beginscherm) */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}

/* ----------------------------------------------------------- inloggen */
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; background: var(--cream);
  padding: calc(24px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}
@supports (height: 100dvh) { .auth-screen { min-height: 100dvh; } }
.auth-card {
  width: min(400px, 100%); background: var(--white); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 30px 26px; display: flex; flex-direction: column; gap: 14px;
}
.auth-card h1, .auth-card h2 { font-size: 24px; }
.auth-card .btn { width: 100%; min-height: 46px; }
.auth-card .error { background: var(--err-bg); color: var(--err); border: 1px solid #EBC5BD; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.auth-card .hint { font-size: 13px; color: var(--muted); }
.auth-card input { font-size: 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-brand .brand-mark { background: var(--espresso); color: var(--cream); }
.auth-brand .brand-name { color: var(--espresso); }
.auth-brand .brand-sub { color: var(--caramel); }
.user-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px;
  padding: 8px 10px; border-radius: 10px; background: rgba(232, 220, 203, .08); color: var(--beige); font-size: 12.5px;
}
.user-chip .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who b { color: var(--white); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { color: var(--sand); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.user-chip button {
  flex: none; background: transparent; color: var(--beige); border: 1px solid rgba(232, 220, 203, .3);
  border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.user-chip button:hover { background: rgba(232, 220, 203, .12); color: var(--white); }
@media (pointer: coarse) { .user-chip button { min-height: 40px; padding: 6px 12px; } }

@media print {
  .user-chip, .auth-screen { display: none !important; }
}
