/* The look of the interface: Hebrew, right to left, for a desktop browser (D-032). */

/* First, before any rule that sets a display: the hidden attribute loses to it otherwise. */
[hidden] { display: none !important; }

/* Heebo, under the SIL Open Font License (public/fonts/OFL.txt), served by the app itself: the
   interface and the export image use the same letters, and nothing loads from outside. */
@font-face {
  font-family: "Heebo";
  src: url("/fonts/Heebo.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #d9dee4;
  --accent: #0f6e6e;
  --accent-strong: #0b5656;
  --accent-soft: #e3f1f1;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warning: #9a6700;
  --warning-bg: #fff8e6;
  --warning-border: #f0d49b;
  --info-bg: #eef4fb;
  --info-border: #c5d8ef;
  --radius: 10px;
  font-family: "Heebo", system-ui, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-size: 16px; line-height: 1.5; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

/* ---------------- cards and layout ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.narrow { max-width: 560px; }
.wide { max-width: 720px; }
.sub { color: var(--muted); margin-bottom: 18px; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }

/* ---------------- forms ---------------- */

.field { margin: 14px 0 0; }
label { display: block; font-weight: 600; margin: 0 0 6px; }
.field-hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="time"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
input[dir="ltr"] { text-align: left; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.primary {
  padding: 10px 22px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  cursor: pointer;
}
.primary:hover { background: var(--accent-strong); }
.primary:disabled { opacity: 0.6; cursor: default; }
.wide-button { width: 100%; margin-top: 22px; padding: 11px; }

.quiet {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.quiet:hover { background: var(--bg); }
.quiet:disabled { opacity: 0.6; cursor: default; }
.quiet-link { color: var(--muted); }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.error { color: var(--danger); margin: 12px 0 0; }
.error:empty { margin: 0; }
.error p { margin: 0 0 4px; }
.error-links { font-weight: 600; }

/* ---------------- the account screens (screens.md 1, 1a, 1b) ---------------- */

.auth-card { width: 100%; max-width: 400px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; font-size: 14px; }

.code-panel .local-note {
  padding: 10px 12px;
  border: 1px solid var(--info-border);
  border-radius: 8px;
  background: var(--info-bg);
  font-size: 14px;
}
.code-panel label { margin-top: 14px; }
input.code-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 28px;
  letter-spacing: 0.4em;
  text-align: center;
}
.countdown { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.countdown.expired { color: var(--danger); font-weight: 600; }
.resend-row { margin-top: 6px; font-size: 14px; }
.notice-line { color: var(--accent); font-size: 14px; margin: 4px 0 0; }
.notice-line:empty { margin: 0; }

/* ---------------- the frame ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 56px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); font-size: 14px; }

.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

.switcher { position: relative; }
.switcher-button {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
}
.switcher-button:hover, .switcher-button[aria-expanded="true"] { border-color: var(--border); background: var(--bg); }
.switcher-button .business-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-button .caret { color: var(--muted); font-size: 13px; }
.switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.switcher-menu .menu-title { padding: 6px 10px; color: var(--muted); font-size: 13px; }
.switcher-menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.switcher-menu a:hover { background: var(--bg); }
.switcher-menu a.current { font-weight: 700; background: var(--accent-soft); }
.switcher-menu a.new-business { color: var(--accent); }
.switcher-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------------- shared bits ---------------- */

h3 { font-size: 15px; margin: 22px 0 8px; }
.empty { color: var(--muted); }
.note { color: var(--muted); font-size: 14px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.save-status { margin: 0; color: var(--accent); font-size: 14px; }
.save-status.error { color: var(--danger); }
.inline { display: flex; align-items: center; gap: 8px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
label.check input { width: 18px; height: 18px; }

button.icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
button.icon:hover:not(:disabled) { background: var(--bg); }
button.icon:disabled { opacity: 0.35; cursor: default; }
button.icon.danger { color: var(--danger); }

.reminder {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: 8px;
  background: var(--warning-bg);
}
.reminder p { margin: 4px 0; }

/* ---------------- grids of inputs (the template, the staffing) ---------------- */

.grid-table { border-collapse: collapse; }
.grid-table th, .grid-table td { padding: 6px 8px; text-align: right; vertical-align: middle; }
.grid-table thead th { font-size: 13px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.grid-table td.num { color: var(--muted); }
.grid-table input[type="text"] { width: 200px; }
.grid-table input[type="time"] { width: 120px; }
input.count { width: 72px; text-align: center; }
.end-cell { white-space: nowrap; }
.next-day { color: var(--warning); font-size: 13px; margin-inline-start: 6px; }
.row-tools { display: flex; gap: 4px; }
.editor-tools { display: flex; gap: 10px; margin-top: 12px; }

.staffing-table th.off-day, .staffing-table td.off-day { background: var(--bg); color: var(--muted); }
.staffing-table td.off-day input { opacity: 0.5; }
.staffing-table .row-head { display: flex; flex-direction: column; min-width: 110px; }
.staffing-table .row-head .times { color: var(--muted); font-size: 12px; font-weight: 400; }
.staffing-table input.zero { color: var(--muted); background: var(--bg); }

.day-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.day-toggle {
  min-width: 78px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.day-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

.rest-editor .inline { margin: 10px 0 4px; }

/* ---------------- the setup wizard (screens.md 2) ---------------- */

.wizard { max-width: 980px; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; flex-wrap: wrap; }
.steps li { padding: 4px 12px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 14px; }
.steps li.current { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.steps li.done { background: var(--accent-soft); color: var(--accent-strong); }
.wizard-footer { display: flex; justify-content: space-between; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------------- pages, chips, dialogs ---------------- */

.page { display: grid; gap: 16px; max-width: 1100px; }
.page-head { display: flex; align-items: center; gap: 14px; }
.page-head h1 { margin: 0; }
.page-head .primary { margin-inline-start: auto; }
.back-link { font-size: 14px; }
.section-title { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge.muted { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.welcome { padding: 14px 16px; border: 1px solid var(--info-border); border-radius: var(--radius); background: var(--info-bg); }
.welcome p { margin: 4px 0 8px; }

.chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.chip.big { padding: 6px 16px; font-size: 16px; }

.dialog { width: min(520px, calc(100vw - 32px)); padding: 24px 28px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 48px rgba(16, 24, 40, 0.2); }
.dialog.wide-dialog { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(16, 24, 40, 0.35); }
.dialog-body { margin: 8px 0 20px; }
.dialog-actions { display: flex; gap: 10px; }
.primary.danger { background: var(--danger); }
.danger-text { color: var(--danger); }
.plain-list { margin: 6px 0; padding-inline-start: 20px; }

/* ---------------- employees (screens.md 9) ---------------- */

.employee-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.employee-row {
  display: grid;
  grid-template-columns: 180px 230px 1fr 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.employee-row:hover { border-color: var(--accent); color: var(--text); }
.employee-list.inactive .employee-row { background: transparent; }
.employee-list.inactive .chip { opacity: 0.6; }
.employee-row .chip { justify-self: start; }
.employee-row .meta { color: var(--muted); font-size: 14px; }
.employee-row .notes { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.employee-card h2.spaced { margin-top: 26px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.swatch { width: 30px; height: 30px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: 0 24px; }
.limits input.count { width: 100px; }

.shortcuts { display: grid; gap: 8px; margin: 10px 0 14px; }
.shortcut-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shortcut-label { min-width: 120px; color: var(--muted); font-size: 14px; }
.quiet.small { padding: 4px 10px; font-size: 14px; }
.link-button.small { font-size: 14px; margin-inline-start: 8px; }

.constraints-table td { padding: 4px; }
.constraints-table th.off-day, .constraints-table td.off-day { background: var(--bg); }
.constraints-table .row-head { display: flex; flex-direction: column; min-width: 110px; }
.constraints-table .row-head .times { color: var(--muted); font-size: 12px; font-weight: 400; }
button.cell {
  width: 64px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}
button.cell.allowed { background: #eef8f1; color: #1e7b3c; border-color: #cfe9d7; }
button.cell.forbidden { background: #fbe9e7; color: var(--danger); border-color: #f2c4bd; font-weight: 700; }

.danger-zone { display: flex; gap: 10px; }

/* ---------------- the week navigator (screens.md, the frame) ---------------- */

.week-slot { display: flex; align-items: center; }
.week-nav { display: flex; align-items: center; gap: 4px; position: relative; }
.week-nav .nav-arrow { font-size: 18px; line-height: 1; }
.week-label {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.week-label:hover { background: var(--bg); }
.week-picker { position: absolute; inset-inline-start: 34px; top: 100%; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.week-today { margin-inline-start: 6px; font-size: 14px; }

/* ---------------- the week (screens.md 3) ---------------- */

.week-page { display: grid; gap: 14px; }
.week-header { display: grid; gap: 12px; }
.week-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.week-title h1 { margin: 0; }
.week-tools { display: flex; gap: 8px; margin-inline-start: auto; }
.badge.status-none { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge.status-draft { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge.status-approved { background: #e7f6ec; color: #1e7b3c; border: 1px solid #bfe3cb; }
.badge.status-approved-draft { background: #e7f6ec; color: #1e7b3c; border: 1px dashed #1e7b3c; }
.badge.holiday { background: #f3ecfb; color: #6b3fa0; border: 1px solid #dccbf0; }
.week-notice p { margin: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 700; }

.create-week h2 { margin-bottom: 8px; }
.create-week label.check { font-weight: 400; margin-top: 14px; }

/* ---------------- availability (screens.md 4) ---------------- */

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-mark { font-weight: 700; color: var(--text); }
.legend-item.hint { margin-inline-start: auto; }

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.availability { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.availability th, .availability td { border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); padding: 0; text-align: center; }
.availability thead th { background: #fafbfc; font-size: 13px; }
.availability .corner { padding: 8px 12px; text-align: right; color: var(--muted); font-weight: 600; min-width: 130px; border-inline-start: 0; }
.availability .day-head { padding: 6px 4px; }
.availability .day-head .day-name { display: block; font-weight: 700; color: var(--text); }
.availability .day-head .day-date { display: block; color: var(--muted); }
.availability .day-head.holiday { background: #f3ecfb; }
.availability .holiday-name, .structure-table .holiday-name { display: block; color: #6b3fa0; font-size: 12px; }
.availability .shift-head.closed, .availability td.closed { color: var(--muted); background: var(--bg); min-width: 48px; }
.head-button { width: 100%; padding: 6px 8px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: 13px; }
.head-button:hover { background: var(--accent-soft); }
.availability .employee-head { text-align: right; border-inline-start: 0; background: #fafbfc; }
.availability .employee-head .head-button { text-align: right; }
.avail-cell {
  width: 100%;
  min-width: 54px;
  height: 38px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 16px;
}
.avail-cell .lock { font-size: 11px; margin-inline-start: 2px; }
.availability td.cell-yes { background: #f3faf5; color: #1e7b3c; }
.availability td.cell-no { background: #fdf0ee; color: var(--danger); font-weight: 700; }
.availability td.cell-locked { background: #ece9e9; color: #6b5f5f; }
.availability td.cell-unlocked { background: #eef6ff; color: #1d5fa8; }
.availability td:hover { filter: brightness(0.96); }
.availability tfoot th, .availability tfoot td { border-bottom: 0; background: #fafbfc; font-size: 13px; padding: 8px 4px; }
.availability tfoot td.short { color: var(--danger); font-weight: 700; background: var(--danger-soft); }

.popover {
  position: absolute;
  z-index: 40;
  min-width: 160px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
}
.popover .menu-title { padding: 4px 10px 6px; color: var(--muted); font-size: 13px; }
.popover button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; text-align: right; cursor: pointer; }
.popover button:hover, .popover button:focus { background: var(--bg); outline: none; }

/* ---------------- the week's structure (screens.md 6) ---------------- */

.structure-table { width: 100%; }
.structure-table tr + tr th, .structure-table tr + tr td { border-top: 1px solid var(--border); }
.structure-table .row-head { min-width: 120px; vertical-align: top; padding-top: 12px; }
.structure-shifts { display: grid; gap: 6px; }
.structure-shift { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; }
.structure-shift.one-off { border-style: dashed; border-color: var(--accent); }
.structure-shift .name { font-weight: 600; min-width: 70px; }
.structure-shift .times { color: var(--muted); font-size: 13px; min-width: 140px; }
.structure-shift input.count { width: 64px; padding: 4px 6px; }
.add-shift { display: flex; align-items: center; gap: 6px; }
.add-shift input[type="text"] { width: 110px; padding: 5px 8px; }
.add-shift input[type="time"] { width: 105px; padding: 5px 6px; }
.add-shift input.count { width: 60px; padding: 5px 6px; }
.day-action { width: 110px; vertical-align: top; padding-top: 10px; }

/* ---------------- notices ---------------- */

.notice { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; }
.notice > :first-child { flex: 1; }
.notice.error { background: var(--danger-soft); border-color: #f2c4bd; color: var(--danger); }
.notice.success { background: #e7f6ec; border-color: #bfe3cb; color: #1e7b3c; }
.notice.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--text); }
.notice .icon { flex: none; width: 26px; height: 26px; }
.pane-tools { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 14px; }

/* ---------------- the board (screens.md 5) ---------------- */

.board-page { display: grid; gap: 12px; }
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.board-toolbar .spacer { flex: 1; }
.saved { color: var(--muted); font-size: 13px; }
.banner { padding: 10px 14px; border-radius: var(--radius); background: #e7f6ec; border: 1px dashed #1e7b3c; color: #1e5f33; font-weight: 600; }
.banner.quiet-banner { background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 400; }
.shortage-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 14px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.shortage-strip .link-button { color: var(--danger); }
.shortage-strip.complete { background: #e7f6ec; color: #1e7b3c; }

.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; align-items: start; }
.board-grid { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.board { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
.board th, .board td { border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); }
.board thead th { background: #fafbfc; padding: 8px 4px; font-size: 13px; text-align: center; }
.board .corner { width: 104px; border-inline-start: 0; }
.board .day-head .day-name { display: block; font-weight: 700; font-size: 14px; }
.board .day-head .day-date { display: block; color: var(--muted); }
.board .day-head.holiday { background: #f3ecfb; }
.board .holiday-name { display: block; color: #6b3fa0; font-size: 12px; }
.board .row-head { padding: 10px; text-align: right; background: #fafbfc; border-inline-start: 0; vertical-align: top; }
.board .row-head .name { display: block; font-weight: 700; }
.board .row-head .times { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.board .row-head.one-off .name { color: var(--accent); }
.board td { vertical-align: top; padding: 6px; height: 74px; }
.board td.no-shift { background: repeating-linear-gradient(-45deg, #f7f8fa, #f7f8fa 6px, #eef0f3 6px, #eef0f3 12px); }
.board td.short { background: #fff4f2; }
.slot-cell .chips { display: flex; flex-direction: column; gap: 4px; }
.board-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 14px;
  -webkit-user-select: none; user-select: none;
  cursor: grab;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.12);
}
.board-chip .chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-chip .chip-remove {
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px;
  background: rgba(255, 255, 255, 0.35); color: inherit; font-size: 11px; cursor: pointer; opacity: 0;
}
.board-chip:hover .chip-remove, .board-chip:focus-within .chip-remove { opacity: 1; }
.board-chip .mark {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-size: 12px; font-weight: 800; background: #fff;
}
.board-chip.exception { outline: 3px solid #f0b429; outline-offset: -1px; }
.board-chip.exception .mark { color: #9a6700; }
.board-chip.problem { outline: 3px solid var(--danger); outline-offset: -1px; }
.board-chip.problem .mark { color: var(--danger); }
.empty-slot { min-height: 28px; border: 2px dashed #c9cfd6; border-radius: 7px; }
.slot-cell .over { margin-top: 4px; color: var(--warning); font-size: 12px; font-weight: 600; }
.slot-cell .reason {
  display: block; width: 100%; margin-top: 5px; padding: 3px 4px; border: 0; border-radius: 5px;
  background: transparent; color: var(--danger); font-size: 12px; text-align: right; cursor: pointer;
}
.slot-cell .reason:hover { background: rgba(180, 35, 24, 0.08); }
.slot-cell .reason strong { margin-inline-end: 4px; }
.slot-cell.flash { animation: flash 1.5s ease-out; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 3px var(--danger); } 100% { box-shadow: inset 0 0 0 0 transparent; } }

/* while dragging (D-025): every cell shows the dragged employee's state there */
body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.slot-cell.drop-allowed { background: #e8f7ed; }
.slot-cell.drop-confirm { background: #fff3d6; }
.slot-cell.drop-blocked { background: #fbe1dd; }
.slot-cell.drop-hover.drop-allowed { box-shadow: inset 0 0 0 3px #1e7b3c; }
.slot-cell.drop-hover.drop-confirm { box-shadow: inset 0 0 0 3px #c98a00; }
.slot-cell.drop-hover.drop-blocked { box-shadow: inset 0 0 0 3px var(--danger); }
.drag-source { opacity: 0.4; }
.drag-ghost { position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none; min-width: 110px; }
.drag-ghost::after { content: attr(data-hint); display: block; margin-top: 4px; padding: 2px 6px; border-radius: 4px; background: rgba(31, 41, 51, 0.85); color: #fff; font-size: 12px; white-space: nowrap; }
.drag-ghost[data-hint=""]::after, .drag-ghost:not([data-hint])::after { display: none; }

.side-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; position: sticky; top: 70px; }
.side-list h2 { font-size: 15px; margin-bottom: 10px; }
.side-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.side-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.side-chip { padding: 3px 10px; border-radius: 7px; font-weight: 600; font-size: 14px; -webkit-user-select: none; user-select: none; }
.side-chip[data-drag] { cursor: grab; }
.side-list .load { color: var(--muted); font-size: 13px; margin-inline-start: auto; }
.side-list .warn { flex-basis: 100%; color: var(--warning); font-size: 12px; }
.side-list .warn.problem { color: var(--danger); }
.side-list li.inactive .side-chip { opacity: 0.6; }
.side-list .note { margin-top: 12px; font-size: 12px; }

.popover.wide { min-width: 280px; max-width: 360px; }
.popover button { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.popover .item-text { font-weight: 600; }
.popover .item-detail { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.popover .item-line { padding: 8px 10px; color: var(--muted); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.plain-list.problems li { color: var(--danger); }

/* ---------------- export (screens.md 7) ---------------- */

.export-page { display: grid; gap: 14px; }
.export-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.export-frame { padding: 20px; background: #e9ecef; border-radius: var(--radius); display: grid; justify-items: center; }
canvas.export-preview { width: min(540px, 100%); height: auto; border-radius: 6px; box-shadow: 0 4px 18px rgba(16, 24, 40, 0.18); background: #fff; }

/* ---------------- weeks (screens.md 8) ---------------- */

.weeks-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.weeks-table th, .weeks-table td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--border); }
.weeks-table thead th { color: var(--muted); font-size: 13px; font-weight: 600; }
.weeks-table td.missing { color: var(--danger); font-weight: 600; }
.weeks-table td.muted, .muted { color: var(--muted); }

/* ---------------- settings (screens.md 10) ---------------- */

.settings { display: grid; gap: 18px; max-width: 980px; }
.settings > h1 { margin-bottom: 0; }
.settings-card h2 { margin-bottom: 4px; }
.password-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }

/* ---------------- a newer build while a dialog is open (public/app/pwa.js) ---------------- */

.update-strip {
  position: fixed;
  inset-inline: 16px;
  bottom: 16px;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 640px;
  margin-inline: auto;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(16, 24, 40, 0.16);
}

/* ---------------- a narrow screen: the installed app on a phone (D-050) ---------------- */

/* The interface is built for a desktop (D-032), and nothing above this changes. On a phone the frame
   wraps instead of pushing every page sideways: the business and the way out on the first row, the
   week navigator and the links under them, the email left out. A week's board is still wider than a
   phone and scrolls sideways; a phone view of its own is on the "After V1" list. */
@media (max-width: 760px) {
  .topbar { position: static; flex-wrap: wrap; height: auto; gap: 8px 12px; padding: 8px 16px; }
  .topbar > .switcher, .topbar > .brand { order: 1; min-width: 0; }
  .topbar > .spacer { order: 2; }
  .topbar > button { order: 3; }
  .topbar > .week-slot { order: 4; flex-basis: 100%; }
  .topbar > .week-slot:empty { display: none; }
  .topbar > .nav { order: 5; flex-basis: 100%; overflow-x: auto; }
  .topbar > .user { display: none; }
  .switcher-button { max-width: 100%; }
  main { padding: 16px; }
  .card { padding: 20px 16px; }
  /* a page's grid track may be narrower than its widest table: the table scrolls in its own box */
  .page, .week-page, .settings, .board-page { grid-template-columns: minmax(0, 1fr); }
  .page-head, .color-row { flex-wrap: wrap; }
  /* the week keeps its seven columns and scrolls inside its own box; the side list goes under it */
  .board-layout { grid-template-columns: minmax(0, 1fr); }
  .side-list { position: static; }
  table.board { min-width: 720px; }
  /* rows and field groups become one column */
  .employee-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .two-columns, .limits, .password-fields { grid-template-columns: minmax(0, 1fr); }
  /* the template's tables scroll inside the card rather than pushing the page */
  table.grid-table { display: block; max-width: 100%; overflow-x: auto; }
}
