/* Falcon: one token file for both appearances. Values from design/README.md; the dark set follows
   Orion's dark palette in spirit. Semantic tokens only: screens never use a raw color. */
:root {
  color-scheme: light dark;
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #F0F0F3;
  --border: #E3E3E8;
  --border-strong: #C8C8CF;
  --text: #1D1D1F;
  --text-2: #5C5C61;
  --accent: #0B5FD9;
  --accent-tint: #E6EFFC;
  --on-accent: #FFFFFF;
  --warning: #B35400;
  --warning-tint: #FFF1E0;
  --critical: #C62828;
  --critical-tint: #FDE8E8;
  --good: #1B7F3B;
  --good-tint: #E3F3E8;
  --utrecht: #DCE6F5;
  --bavaria: #DEEBD8;
  --la: #F4E8D3;
  --berkeley: #F4E8D3;
  --leeds: #EFE3F2;
  --weekend: #F3F3F6;
  --hatch: #DADADF;
  --bar-veil: rgba(255, 255, 255, 0.6);
  --radius: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, system-ui, sans-serif;
  --font-mark: "Montserrat", var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --ease: 180ms ease-out;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --surface: #1C1D21;
    --surface-2: #242529;
    --border: #2F3036;
    --border-strong: #44454C;
    --text: #F2F2F4;
    --text-2: #A9A9B0;
    --accent: #5B9BFF;
    --accent-tint: #1B2C4A;
    --on-accent: #0B1526;
    --warning: #F0A050;
    --warning-tint: #3A2A14;
    --critical: #FF7B7B;
    --critical-tint: #3E1F1F;
    --good: #5CCB7B;
    --good-tint: #1E3A27;
    --utrecht: #2A3B57;
    --bavaria: #27402A;
    --la: #4A3A20;
    --berkeley: #4A3A20;
    --leeds: #3E2A48;
    --weekend: #17181B;
    --hatch: #3A3B41;
    --bar-veil: rgba(17, 18, 20, 0.6);
  }
}
:root[data-theme="dark"] {
  --bg: #111214;
  --surface: #1C1D21;
  --surface-2: #242529;
  --border: #2F3036;
  --border-strong: #44454C;
  --text: #F2F2F4;
  --text-2: #A9A9B0;
  --accent: #5B9BFF;
  --accent-tint: #1B2C4A;
  --on-accent: #0B1526;
  --warning: #F0A050;
  --warning-tint: #3A2A14;
  --critical: #FF7B7B;
  --critical-tint: #3E1F1F;
  --good: #5CCB7B;
  --good-tint: #1E3A27;
  --utrecht: #2A3B57;
  --bavaria: #27402A;
  --la: #4A3A20;
  --berkeley: #4A3A20;
  --leeds: #3E2A48;
  --weekend: #17181B;
  --hatch: #3A3B41;
  --bar-veil: rgba(17, 18, 20, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  :root { --ease: 0ms linear; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  font: 13px/1.5 var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { margin: 0; font-size: 22px; font-weight: 600; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--text-2); }
.fine { font-size: 12px; color: var(--text-2); }
.error { color: var(--critical); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  transition: background-color var(--ease), border-color var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-2); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* --- the shell: sidebar 220, content fluid; the chrome never scrolls, the content does --- */

.shell { display: flex; min-height: 100dvh; }
.sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 20px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-word { font: 700 16px/1 var(--font-mark); letter-spacing: 0.02em; }
.auth-brand .brand-word { font-size: 24px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
}
.nav-item:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-item[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.sidebar-spacer { flex: 1 1 auto; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.user-menu { position: relative; border-top: 1px solid var(--border); padding-top: 8px; }
.user-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.user-menu summary:hover { background: var(--surface-2); }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}
.user-menu-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-menu-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-role { font-size: 11px; color: var(--text-2); }
.user-menu-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 10;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-menu-email { font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }

/* --- controls --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.icon { flex: 0 0 auto; }
.small { font-size: 12px; }
.spacer { flex: 1 1 auto; }

.input, .select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23808088' stroke-width='1.8' stroke-linecap='round'><path d='M4 6l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.select:disabled, .input:read-only:not(textarea), .input[readonly] { color: var(--text); background: var(--surface-2); cursor: default; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.input::placeholder { color: var(--text-2); opacity: 0.8; }
.input-quiet, .select-quiet { background: transparent; border-color: transparent; height: 28px; padding: 0 6px; }
.input-quiet:hover, .select-quiet:hover { border-color: var(--border); background: var(--bg); }
.input-quiet.is-late { color: var(--warning); font-weight: 600; }
.input-days { width: 92px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field-label { font-size: 11px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 11px; color: var(--text-2); }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); gap: 2px; }
.segmented-fill { display: flex; }
.segmented-fill > button { flex: 1 1 0; }
.segmented > button {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}
.segmented > button:hover { color: var(--text); }
.segmented > button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.segmented > button:disabled { cursor: default; }

.icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { border: 0; padding: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.btn-danger { color: var(--critical); }
.btn-danger:hover { background: var(--critical-tint); color: var(--critical); }
.btn-danger-fill { background: var(--critical); color: #fff; font-weight: 600; }
.btn-sm { height: 28px; padding: 0 10px; }
.btn .icon { margin-left: -2px; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--surface-2);
  color: var(--text);
}
.pill-proposal { padding: 1px 8px; border: 1.5px dashed var(--border-strong); background: transparent; color: var(--text-2); }
.pill-in_progress { background: var(--good-tint); color: var(--good); }
.pill-delivered, .pill-cancelled, .pill-muted { background: var(--surface-2); color: var(--text-2); }
.pill-warning { padding: 1px 6px; border-radius: 6px; background: var(--warning-tint); color: var(--warning); font-variant-numeric: tabular-nums; }

/* --- toolbar and status --- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.toolbar .btn { height: 32px; }
.toolbar .select { width: auto; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-2);
}
.search:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.toolbar-count { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 20px; font-size: 12px; color: var(--text-2); }
.status-ok { color: var(--text-2); }
.status-check { stroke: var(--good); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.status-error { color: var(--critical); }
.status .link-btn { font-size: 12px; }
.crumbs { display: inline-flex; align-items: center; gap: 8px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumb-sep { color: var(--border-strong); }
.crumb-here { font-weight: 600; }

/* --- lists and tables --- */

.split { flex: 1 1 auto; display: flex; min-height: 0; align-items: stretch; }
.shows { flex: 1 1 auto; min-width: 0; overflow: auto; background: var(--surface); }
.table { width: 100%; min-width: 1100px; border-collapse: collapse; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 36px;
  padding: 0 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { height: 40px; padding: 0 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.col-date { width: 100px; white-space: nowrap; }
.col-location { width: 140px; }
.col-num { width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.col-designs { width: 64px; }
.col-status { width: 110px; }
.col-studio { width: 120px; }
.col-person { width: 130px; }
.col-planned { width: 110px; white-space: nowrap; }
.col-expand { width: 36px; text-align: center; }
.show-row { cursor: default; }
.show-row:hover { background: var(--surface-2); }
.show-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.show-row.is-selected, .show-row.is-selected:hover { background: var(--accent-tint); }
.show-row.is-archived .col-show { color: var(--text-2); }
.show-link { color: var(--text); font-weight: 600; }
.show-link:hover { text-decoration: underline; }
.col-show .pill { margin-left: 8px; }
.design-row { height: 32px; background: var(--bg); color: var(--text-2); }
.design-row td { height: 32px; }
.design-cell { padding-left: 24px !important; }
.design-link { color: var(--text); font-weight: 500; }
.table-foot { padding: 12px 16px; font-size: 12px; }

/* --- inspector --- */

.inspector {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow: auto;
}
.inspector-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.inspector-head h2 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspector-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.inspector-section { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.inspector-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.inspector-section h3 { margin: 0; font-size: 13px; font-weight: 600; }
.design-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.design-list li { display: flex; flex-direction: column; }
.design-list a { color: var(--text); font-weight: 500; }
.add-design { display: flex; gap: 8px; }
.add-design .btn { flex: 0 0 auto; height: 32px; }
.inspector-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }

/* --- sheets and alerts --- */

dialog { color: var(--text); }
.sheet, .alert {
  width: min(620px, calc(100vw - 48px));
  margin: 64px auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}
.sheet::backdrop, .alert::backdrop { background: rgba(0, 0, 0, 0.35); }
.sheet form { display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.sheet-head h2 { font-size: 17px; }
.sheet-head .muted { font-size: 12px; text-align: right; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; padding: 8px 24px 20px; }
.sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 24px 16px; border-top: 1px solid var(--border); }
.sheet-foot .error { flex: 1 1 auto; font-size: 12px; }
.sheet .btn { height: 34px; }
.designs-box { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.designs-box legend { float: left; padding: 0; font-weight: 600; }
.designs-box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.stepper button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }
.stepper button:hover { background: var(--surface-2); }
.stepper button:disabled { color: var(--text-2); opacity: 0.5; cursor: default; }
.stepper span { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.design-rows { display: flex; flex-direction: column; gap: 8px; }
.design-spec { display: grid; grid-template-columns: minmax(0, 1fr) 160px 92px; gap: 8px; align-items: center; }
.design-spec .input, .design-spec .select { background: var(--surface); }
.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.alert { width: min(440px, calc(100vw - 48px)); padding: 24px; }
/* A closed dialog stays hidden; only an open one lays out as a column. */
.alert[open] { display: flex; flex-direction: column; gap: 12px; }
.alert h2 { font-size: 15px; }
.alert-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

/* --- the Design page --- */

.design-layout { display: flex; flex-wrap: wrap; gap: 24px; padding: 24px; align-items: flex-start; }
.design-main { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.design-aside { flex: 1 1 360px; min-width: 0; max-width: 480px; display: flex; flex-direction: column; gap: 12px; }
.card { padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.design-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.design-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.title-input {
  width: 100%;
  margin: 0 0 0 -6px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 600 24px/1.2 var(--font-sans);
  letter-spacing: -0.015em;
}
.title-input:hover:not([readonly]) { border-color: var(--border); background: var(--surface); }
.title-input:focus { border-color: var(--accent); background: var(--surface); outline: 2px solid var(--accent); outline-offset: 0; }
.design-subtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.stats { display: flex; gap: 24px; font-variant-numeric: tabular-nums; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 600; }
.stat-label { font-size: 11px; color: var(--text-2); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.milestones { padding: 0; overflow: hidden; }
.milestones .card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.milestone-grid { display: grid; grid-template-columns: 28px minmax(0, 1fr) 140px 140px 150px 28px; gap: 0 12px; align-items: center; padding: 0 12px 0 16px; }
.milestone-grid-head { height: 28px; font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.milestone-row { min-height: 40px; border-bottom: 1px solid var(--border); }
.milestone-row:last-child { border-bottom: 0; }
.milestone-row.is-current { background: var(--accent-tint); }
.milestone-row.is-current .milestone-name { font-weight: 600; }
.milestone-row.is-delivered .milestone-name { color: var(--text-2); }
.done-toggle {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.done-toggle:hover { border-color: var(--good); }
.done-toggle[aria-pressed="true"] { background: var(--good); border-color: var(--good); }
.done-toggle .icon { stroke: #fff; stroke-width: 2.4; }
.is-current .done-toggle { border: 2px solid var(--accent); }
.done-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.done-toggle:disabled { cursor: default; }
.milestones-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; }
.mini-grid { display: flex; flex-direction: column; gap: 4px; }
.mini-row { display: grid; grid-template-columns: 130px repeat(10, minmax(0, 1fr)); gap: 0 2px; align-items: center; min-height: 28px; }
.mini-head { min-height: 20px; font-size: 10px; color: var(--text-2); }
.mini-week { border-left: 1px solid var(--border); padding-left: 4px; }
.mini-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.mini-elsewhere { font-size: 11px; }
.bar {
  height: 18px;
  border-radius: 5px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  background: var(--surface-2);
}
.bar-half { height: 11px; line-height: 11px; }
.bar-tentative { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-2); line-height: 15px; }
.studio-utrecht { background: var(--utrecht); }
.studio-bavaria { background: var(--bavaria); }
.studio-la { background: var(--la); }
.studio-berkeley { background: var(--berkeley); }
.studio-leeds { background: var(--leeds); }
.bar-tentative.studio-utrecht, .bar-tentative.studio-bavaria, .bar-tentative.studio-la, .bar-tentative.studio-berkeley, .bar-tentative.studio-leeds { background: transparent; }
.linked { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; background: var(--bg); font-size: 12px; }
.linked h3 { margin: 0; font-size: 13px; font-weight: 600; }
.linked-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.linked-list li { display: flex; align-items: center; gap: 6px; }
.linked .select { width: auto; align-self: flex-start; background: var(--surface); }

@media (max-width: 1100px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- pages --- */

.page { padding: 24px 32px; }
.content > .empty { margin: 96px auto; }

.empty {
  max-width: 480px;
  margin: 96px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty-title { font-size: 15px; font-weight: 600; }

/* --- sign in --- */

.auth {
  flex: 1 1 auto;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(400px, 100%);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-dev { margin-top: -4px; }

/* --- the schedule grid: people in rows grouped by studio, days in columns, bars inside the cells --- */

.schedule { flex: 1 1 auto; display: flex; min-height: 0; align-items: stretch; }
.grid-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  position: relative;
  background: var(--surface);
  user-select: none;
  -webkit-user-select: none;
}
/* The table gets its exact width (schedule.js sets --days), because table-layout: fixed only holds
   for a table with a width; without it the columns drift from --col and the bars overrun. */
.grid {
  --col: 24px;
  --people: 184px;
  --booked: 56px;
  --days: 56;
  width: calc(var(--people) + var(--days) * var(--col) + var(--booked));
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.grid[data-zoom="day"] { --col: 40px; }
.grid[data-zoom="month"] { --col: 8px; }
.grid col.col-people { width: var(--people); }
.grid col.col-day { width: var(--col); }
.grid col.col-booked { width: var(--booked); }
.grid th, .grid td { padding: 0; border-bottom: 1px solid var(--border); font-weight: normal; }
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 24px;
  background: var(--surface);
  font-size: 11px;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
}
.grid thead tr.days th { top: 24px; height: 32px; text-align: center; overflow: hidden; }
.grid[data-zoom="month"] thead tr.days th { height: 12px; }
.grid .corner { left: 0; z-index: 5; padding-left: 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.grid .week-head { padding-left: 6px; border-left: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; }
.grid .booked-head { right: 0; z-index: 5; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; box-shadow: inset 1px 0 var(--border); }
.grid .day-head .dow { display: block; line-height: 1.2; }
.grid .day-head .dom { color: var(--text); font-weight: 600; }
.grid .day-head.col-weekend .dom { color: var(--text-2); font-weight: normal; }
.today-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.grid .day-head .today-pill.dom { color: var(--on-accent); }
.today-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* A row is one 32 px lane, and grows a lane per overlapping bar (--lanes, set by the module on the tr). */
.grid td.cell { position: relative; height: calc(var(--lanes, 1) * 32px); box-shadow: inset -1px 0 var(--border); }
.grid[data-zoom="month"] td.cell { box-shadow: none; }
.grid[data-zoom="month"] td.cell.col-week-end { box-shadow: inset -1px 0 var(--border); }
.grid td.col-weekend, .grid th.col-weekend, .grid td.col-holiday, .grid td.col-off { background: var(--weekend); }
.grid td.col-today, .grid th.col-today { box-shadow: inset 1px 0 var(--accent), inset -1px 0 var(--border); }
.grid td.cell.in-range { background: var(--accent-tint); }
.grid td.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 2; }
.grid td.cell.can-paint { cursor: crosshair; }

.grid th.person-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  height: calc(var(--lanes, 1) * 32px);
  padding: 0 8px 0 12px;
  background: var(--surface);
  text-align: left;
  box-shadow: inset -1px 0 var(--border);
}
.person-cell-inner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person-avatar {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
}
.person-who { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-role { font-size: 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.grid tr.group-row th, .grid tr.group-row td { height: 28px; background: var(--bg); font-size: 11px; }
.grid .group-name { position: sticky; left: 0; z-index: 2; padding-left: 12px; font-weight: 600; text-align: left; }
.grid .group-summary { padding-left: 6px; color: var(--text-2); white-space: nowrap; }

.grid td.booked-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  box-shadow: inset 1px 0 var(--border);
}

.grid .bar {
  position: absolute;
  top: calc(4px + var(--lane, 0) * 32px);
  left: 2px;
  z-index: 1;
  height: 24px;
  line-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  cursor: grab;
  overflow: hidden;
  transition: box-shadow var(--ease), opacity var(--ease);
}
.grid .bar:active { cursor: grabbing; }
/* A row is one block; the label truncates inside it and sits above the weekend veils. */
.grid .bar-label { position: relative; z-index: 1; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.grid .bar-weekend { position: absolute; top: 0; bottom: 0; background: var(--bar-veil); pointer-events: none; }
.grid .bar-tentative .bar-weekend { display: none; }
.grid .bar.bar-tentative { line-height: 21px; }
.grid .bar.bar-cut-start { left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.grid .bar.bar-cut-end { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.grid .bar.studio-none { background: var(--surface-2); }
.grid .bar.is-selected { z-index: 2; box-shadow: 0 0 0 2px var(--accent); font-weight: 600; }
.grid .bar.has-conflict { box-shadow: inset 0 0 0 1.5px var(--warning); }
.grid .bar.has-conflict.is-selected { box-shadow: inset 0 0 0 1.5px var(--warning), 0 0 0 2px var(--accent); }
.grid .bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 2; }
.grid .bar.is-dimmed { opacity: 0.35; }
.grid .bar.is-dragging { opacity: 0.35; }
.grid .bar.is-ghost {
  z-index: 4;
  opacity: 0.92;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 8px 20px -8px rgba(0, 0, 0, 0.4);
}
.grid .bar-off {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--hatch) 6px 7px);
  color: var(--text-2);
}
.grid .bar-off.is-selected { color: var(--text); }
.grid .bar-off.is-requested { border: 1.5px dashed var(--border-strong); line-height: 21px; }
.grid[data-zoom="month"] .bar { padding: 0 4px; font-size: 10px; }
.grid-wrap[data-readonly] .bar { cursor: default; }

.legend {
  position: sticky;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-2);
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 14px; height: 10px; border-radius: 3px; box-sizing: border-box; }
.legend-tentative { border: 1.5px dashed var(--border-strong); }
.legend-off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--hatch) 4px 5px); }
.legend-weekend { background: var(--weekend); border: 1px solid var(--border); }
.legend-today { width: 2px; height: 12px; border-radius: 0; background: var(--accent); }
.legend-conflict { background: var(--utrecht); box-shadow: inset 0 0 0 1.5px var(--warning); }
.legend-help { margin-left: auto; }
.grid-wrap > .empty { margin: 64px auto; position: sticky; left: 0; }

/* the schedule toolbar and inspector */
.nav-dates { display: inline-flex; gap: 4px; }
.btn-icon { width: 32px; padding: 0; }
.select-brush { max-width: 240px; }
.inspector-head-stack { align-items: flex-start; }
.inspector-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inspector-who h2 { font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.switch-row > label { font-weight: 600; }
.switch {
  width: 38px;
  height: 22px;
  padding: 2px;
  border: 0;
  border-radius: 11px;
  background: var(--border-strong);
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  transition: background-color var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.switch-knob { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); }
.switch:disabled { cursor: default; opacity: 0.6; }
.conflicts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
}
.conflicts.is-warning { background: var(--warning-tint); color: var(--warning); }
/* An offer the inspector makes after a change (move the allocations too?): a quiet panel, one primary verb. */
.offer { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 12px; color: var(--text); }
.offer-actions { display: flex; gap: 8px; }
.inspector-actions { display: flex; justify-content: flex-end; gap: 8px; }
.inspector-actions-start { justify-content: flex-start; flex-wrap: wrap; }
.inspector-actions .btn { height: 32px; }

/* --- settings: a tab row in the toolbar, one card per holiday calendar, the people table (Settings › People) --- */
.tabs { display: inline-flex; gap: 4px; margin: -10px 0 -11px -4px; }
.tabs a { display: inline-flex; align-items: center; height: 52px; padding: 0 12px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.content { overflow: auto; }
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.settings-card { padding: 0; overflow: hidden; }
.settings-card > .card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; justify-content: flex-start; }
.settings-card h2 { font-size: 15px; }
.settings-card .table { min-width: 0; }
.calendar-head .calendar-name { width: 260px; font-size: 15px; font-weight: 600; }
.calendar-head .calendar-country { width: 64px; text-transform: uppercase; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.calendar-head .spacer { flex: 1 1 auto; }
.table-holidays td { height: 36px; }
.table-holidays .col-date { width: 180px; }
.table-holidays .col-actions { width: 48px; text-align: right; padding-right: 12px; }
.table-holidays .input-quiet { width: 100%; }
.table-holidays input[type="date"].input-quiet { width: 160px; }
.table-holidays .year-row th { height: 28px; padding-top: 6px; font-size: 11px; background: var(--bg); position: static; }
.table-holidays .add-row td { background: var(--bg); }
.table-holidays .add-row .input-quiet { background: var(--surface); border-color: var(--border); }

/* Settings › People: a full-width table like the Shows list, 48 px rows (name over email), quiet
   controls in every cell, studio hue on the avatar only, a ghost Deactivate on the row. */
.people-list { flex: 1 1 auto; min-width: 0; overflow: auto; background: var(--surface); }
.table-people { min-width: 1260px; }
.table-people td { height: 48px; }
.table-people .col-name { min-width: 220px; }
.table-people .col-role { width: 140px; }
.table-people .col-studio { width: 112px; }
.table-people .col-avail { width: 236px; }
.table-people th.col-avail { white-space: nowrap; }
.table-people .th-date { display: inline-block; width: 128px; height: 24px; padding: 0 4px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; vertical-align: middle; }
.avail-next { display: block; font-size: 11px; }
.table-people .col-calendar { width: 164px; }
.table-people .col-date { width: 140px; }
.table-people .col-access { width: 116px; }
.table-people .col-seen { width: 96px; white-space: nowrap; color: var(--text-2); }
.table-people .col-actions { width: 104px; text-align: right; padding-right: 12px; }
.table-people .input-quiet, .table-people .select-quiet { width: 100%; }
.table-people .col-actions .btn { white-space: nowrap; }
.person { display: flex; align-items: center; gap: 8px; min-width: 0; }
.person-fields { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.person-fields .person-name { height: 24px; font-weight: 600; }
.person-fields .person-email { height: 20px; font-size: 11px; color: var(--text-2); }
.avatar-sm {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
}
.is-inactive .person-name, .is-inactive .avatar-sm, .is-inactive .col-role .input-quiet { color: var(--text-2); }
.is-inactive .avatar-sm { background: var(--surface-2); }
/* Work days: one toggle per weekday, Monday to Friday, with the days per week after them (a pressed
   day is a selection, so it takes the accent tint); the same control sits in the Add person sheet, larger. */
.day-toggles { display: inline-flex; align-items: center; gap: 3px; }
.day-toggle {
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.day-toggle:hover { border-color: var(--text-2); color: var(--text); }
.day-toggle[aria-pressed="true"] { background: var(--accent-tint); border-color: transparent; color: var(--accent); }
.day-toggle.is-half[aria-pressed="true"] { background: linear-gradient(90deg, var(--accent-tint) 50%, transparent 50%); border-color: var(--accent); }
.avail-count { margin-left: 4px; font-size: 11px; font-variant-numeric: tabular-nums; }
.sheet .day-toggles { gap: 6px; }
.sheet .day-toggle { width: 36px; height: 30px; font-size: 12px; }
.sheet .avail-count { font-size: 12px; }
.switch-inline { gap: 8px; }
.switch-inline > label { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
