:root {
  --bg: #f4f2ed;
  --surface: #fffefb;
  --surface-strong: #ffffff;
  --ink: #171714;
  --muted: #77746c;
  --line: #dedbd2;
  --line-soft: #e9e6df;
  --accent: #ff5a36;
  --accent-soft: #ffe2d9;
  --radius: 22px;
  --shadow: 0 16px 50px rgba(23, 23, 20, 0.06);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
}
button, input { font: inherit; }
button { color: inherit; }

.shell, .gate-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 36px;
}

.topbar, .gate-topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(23px, 2.6vw, 31px);
  letter-spacing: -0.055em;
  font-weight: 560;
  display: inline-flex;
  align-items: baseline;
}
.brand strong { font-weight: 880; letter-spacing: -0.08em; }
.brand-dot { width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.domain-mark { color: var(--muted); font-size: 12px; letter-spacing: .02em; }

.topbar-actions { display: flex; align-items: center; gap: 9px; }
.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.45);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: .18s ease;
}
.icon-button:hover { background: var(--surface); transform: translateY(-1px); }
.icon-button:active { transform: translateY(0) scale(.97); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-button.small { width: 38px; height: 38px; }

.room-button {
  min-height: 46px;
  max-width: min(44vw, 280px);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.45);
  border-radius: 99px;
  padding: 0 11px 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.room-button:hover { background: var(--surface); }
.room-button span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: 0 0 auto; }
.room-dot { width: 7px; height: 7px; border-radius: 50%; background: #79ad65; flex: 0 0 auto; }

main { padding-top: 34px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 760; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(39px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; font-weight: 700; }
h2 { margin-bottom: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; line-height: 1; }
h3 { letter-spacing: -.03em; }

/* First visit */
.gate-shell {
  min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr;
  padding-bottom: 0;
}
.gate-main { padding: 0; display: grid; align-items: center; }
.gate-hero { width: min(760px, 100%); padding: 62px 0 70px; }
.gate-hero h1 { font-size: clamp(55px, 9vw, 104px); max-width: 900px; }
.gate-lead { max-width: 600px; margin: 28px 0 0; color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.48; letter-spacing: -.02em; }
.gate-actions { display: flex; gap: 10px; margin-top: 34px; }
.gate-primary, .gate-secondary { width: auto; min-height: 54px; padding: 0 22px; }
.gate-facts { display: flex; align-items: center; gap: 10px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.gate-facts i { width: 3px; height: 3px; border-radius: 50%; background: #aaa69d; }
.gate-footer { margin-top: 0; padding: 22px 0; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 28px;
  align-items: end;
  padding: 14px 0 38px;
}
.workday-schedule { text-align: right; padding-bottom: 7px; }
.workday-time { font-variant-numeric: tabular-nums; font-size: clamp(18px, 2vw, 24px); font-weight: 650; letter-spacing: -.035em; }
.lunch-time { margin-top: 5px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-track { grid-column: 1 / -1; height: 5px; background: #dedbd3; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress-value { height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .5s ease; }
.progress-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.people-section, .summary-section { padding: 34px 0 42px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; gap: 20px; }
.live-indicator { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; display: flex; align-items: center; gap: 7px; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #79ad65; box-shadow: 0 0 0 4px rgba(121,173,101,.12); }

.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.person-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  min-height: 206px;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.person-card:hover { transform: translateY(-2px); }
.person-card.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.person-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 14px; background: #ece9e1; display: grid; place-items: center; font-weight: 760; letter-spacing: -.03em; }
.is-active .avatar { background: rgba(255,255,255,.13); }
.person-actions { display: flex; align-items: center; gap: 3px; }
.person-menu, .person-calendar-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
  border-radius: 8px;
  line-height: 1;
}
.person-menu { font-size: 21px; }
.person-calendar-button { width: 30px; height: 30px; display: grid; place-items: center; }
.person-calendar-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.person-menu:hover, .person-calendar-button:hover { background: rgba(23,23,20,.05); color: var(--ink); }
.is-active .person-menu, .is-active .person-calendar-button { color: rgba(255,255,255,.45); }
.is-active .person-menu:hover, .is-active .person-calendar-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.person-card.is-absent { background: #eeece6; box-shadow: none; }
.person-card.is-absent .avatar { background: #ddd9cf; }
.person-card.is-absent .action-button { background: #d7d3c9; color: #77746c; }
.absence-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 760; }
.person-name { font-size: 22px; margin: 18px 0 3px; letter-spacing: -.04em; font-weight: 680; overflow-wrap: anywhere; }
.person-meta { font-size: 13px; color: var(--muted); margin: 0; }
.is-active .person-meta { color: rgba(255,255,255,.58); }
.person-bottom { margin-top: auto; display: flex; align-items: end; justify-content: space-between; gap: 12px; padding-top: 18px; }
.active-clock { font-size: 28px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-weight: 650; line-height: 1; }
.active-label { color: rgba(255,255,255,.55); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.action-button { border: 0; min-height: 42px; border-radius: 13px; padding: 0 15px; font-weight: 700; cursor: pointer; transition: transform .15s ease, opacity .15s ease; white-space: nowrap; }
.action-button:active { transform: scale(.97); }
.action-button.start { background: var(--ink); color: #fff; }
.action-button.stop { background: var(--accent); color: #fff; }
.action-button:disabled { opacity: .55; cursor: wait; }

.empty-state { border: 1px dashed #cbc7bd; border-radius: var(--radius); text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state h3 { color: var(--ink); margin-bottom: 7px; font-size: 23px; }
.empty-state p { margin: 0 auto 22px; max-width: 420px; line-height: 1.5; }
.empty-add-button { width: auto; min-width: 190px; }
.secondary-button, .primary-button, .danger-button { border: 0; border-radius: 14px; min-height: 46px; padding: 0 18px; font-weight: 750; cursor: pointer; }
.secondary-button { background: var(--surface-strong); border: 1px solid var(--line); }
.primary-button { background: var(--ink); color: #fff; width: 100%; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; }
.danger-button { background: transparent; color: #a73b28; padding: 0; min-height: 38px; }
.full-button { width: 100%; }

.summary-total { font-size: 26px; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.summary-card { overflow: hidden; border: 1px solid var(--line); background: rgba(255,255,255,.42); border-radius: var(--radius); }
.summary-table-header, .summary-row { display: grid; grid-template-columns: minmax(0, 1.8fr) .5fr .68fr .62fr .7fr; gap: 12px; align-items: center; }
.summary-table-header { color: var(--muted); font-size: 10px; font-weight: 760; text-transform: uppercase; letter-spacing: .1em; padding: 14px 18px 10px; }
.summary-row { min-height: 57px; padding: 0 18px; border-top: 1px solid var(--line-soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.summary-row:first-child { border-top: 0; }
.summary-name { font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-row span:not(:first-child), .summary-table-header span:not(:first-child) { text-align: right; }
.summary-empty { color: var(--muted); text-align: center; padding: 28px 18px; font-size: 14px; }

footer { border-top: 1px solid var(--line); padding: 22px 0 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.dialog { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; }
.dialog::backdrop { background: rgba(23,23,20,.28); backdrop-filter: blur(6px); }
.dialog-card { width: min(430px, calc(100vw - 28px)); border-radius: 25px; background: var(--surface-strong); padding: 22px; box-shadow: 0 30px 100px rgba(0,0,0,.18); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
.dialog-head h2 { font-size: 28px; }
.field-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.field-label span { font-weight: 500; }
.dialog input { width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; outline: none; background: #faf9f6; font-size: 17px; }
.dialog input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,23,20,.06); }
.dialog .code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; letter-spacing: -.01em; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 9px 0 0; }
.form-error { min-height: 18px; margin: 8px 0 12px; color: #b63722; font-size: 12px; }

.code-card { width: min(520px, calc(100vw - 28px)); }
.code-note { color: var(--muted); line-height: 1.5; margin-bottom: 18px; }
.room-code { width: 100%; border: 1px solid var(--line); background: #f7f5f0; border-radius: 17px; padding: 18px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(16px, 3.8vw, 21px); line-height: 1.35; overflow-wrap: anywhere; cursor: copy; }
.code-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.code-actions .primary-button { width: auto; }
.settings-card {
  width: min(920px, calc(100vw - 28px));
  max-height: min(88vh, 860px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.settings-block { padding: 17px; border: 1px solid var(--line-soft); background: #faf9f6; border-radius: 17px; margin-bottom: 14px; }
.settings-title { margin: 0 0 6px; font-weight: 760; }
.settings-copy { margin: 0 0 15px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.schedule-group { margin-top: 14px; }
.schedule-group:first-of-type { margin-top: 0; }
.schedule-group-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; }
.dialog .timezone-select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.dialog .timezone-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23,23,20,.06);
}
.timezone-create-label { margin-top: 14px; }
.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.weekday-picker label { position: relative; }
.weekday-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.weekday-picker span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
  user-select: none;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.weekday-picker input:checked + span {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.weekday-picker input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.weekday-picker span:active { transform: scale(.96); }
.picker-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
  gap: 9px;
  align-items: end;
}
.picker-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}
.picker-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .02em;
}
.picker-range-arrow {
  width: 36px;
  height: 52px;
  display: grid;
  place-items: center;
  align-self: end;
}
.picker-range-arrow::before {
  content: "";
  width: 18px;
  height: 1px;
  border-radius: 99px;
  background: var(--muted);
  opacity: .8;
}
.dialog .picker-field input[type="time"],
.dialog .picker-field input[type="date"] {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
.dialog .picker-field input[type="time"]:focus,
.dialog .picker-field input[type="date"]:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23,23,20,.06);
}
.dialog .picker-field input[type="date"]::-webkit-date-and-time-value,
.dialog .picker-field input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
}
.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.quick-pick-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 11px;
  background: rgba(255,255,255,.62);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.quick-pick-button:hover {
  border-color: #cac6bc;
  background: var(--surface-strong);
  color: var(--ink);
}
.quick-pick-button.is-selected {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.quick-pick-button:active { transform: scale(.97); }
.time-picker-range { margin-top: 1px; }
.date-quick-picks { margin-top: 12px; }
.date-picker-range { margin-top: 9px; }
.date-range-summary {
  min-height: 17px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.schedule-error { margin-bottom: 10px; }
#schedule-submit { margin-top: 2px; }

.calendar-kind label,
.calendar-label-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.personal-calendar-card { max-height: min(88vh, 760px); overflow-y: auto; overscroll-behavior: contain; }
.personal-calendar-card > .settings-copy { margin-top: -12px; }
.personal-calendar-card .calendar-kind { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.absence-badge { background: #eee7dd; color: #765f45; }
.work-share-cell { font-weight: 760; }

.calendar-kind select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.calendar-kind select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23,23,20,.06);
}
.calendar-label-field { margin-top: 12px; }
.calendar-label-field > span { font-weight: 500; }
.dialog .calendar-label-field input { min-height: 52px; font-size: 14px; }
.calendar-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.calendar-section-head .settings-copy { max-width: 620px; margin-bottom: 0; }
.year-calendar-toolbar {
  flex: 0 0 auto;
  min-height: 38px;
  display: grid;
  grid-template-columns: 38px minmax(70px, auto) 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  overflow: hidden;
}
.year-calendar-toolbar strong {
  min-width: 74px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.year-calendar-nav {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}
.year-calendar-nav:hover { background: #f1eee7; color: var(--ink); }
.year-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 15px 0 12px;
  color: var(--muted);
  font-size: 10px;
}
.year-calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 15px;
  height: 15px;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-strong);
}
.legend-swatch.is-off { background: #eee9df; border-color: #e2dbce; }
.legend-swatch.is-override {
  position: relative;
  background: var(--surface-strong);
  border-color: var(--ink);
}
.legend-swatch.is-override::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.year-calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.year-calendar-month {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  background: var(--surface-strong);
}
.year-calendar-month h4 {
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 780;
  text-transform: capitalize;
}
.year-calendar-weekdays,
.year-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.year-calendar-weekdays { margin-bottom: 4px; }
.year-calendar-weekdays span {
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 8px;
  font-weight: 760;
  text-transform: uppercase;
}
.year-calendar-empty { aspect-ratio: 1; }
.year-calendar-day {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.year-calendar-day.is-work { background: #fbfaf7; border-color: #f0ede6; }
.year-calendar-day.is-off { background: #eee9df; color: #776b5b; border-color: #e6dfd3; }
.year-calendar-day:hover { border-color: var(--ink); transform: translateY(-1px); }
.year-calendar-day:active { transform: scale(.94); }
.year-calendar-day.is-override { border-color: #9e998f; }
.year-calendar-day.is-override::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.year-calendar-day.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.year-calendar-day:disabled { opacity: .5; cursor: wait; transform: none; }
.calendar-click-help {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.calendar-import-form {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}
.calendar-import-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}
.dialog .calendar-import-field textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  outline: none;
  background: var(--surface-strong);
  color: var(--ink);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.dialog .calendar-import-field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23,23,20,.06);
}
.calendar-import-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-import-footer > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.calendar-import-footer .secondary-button {
  width: auto;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
}
.calendar-advanced {
  margin-top: 13px;
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}
.calendar-advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  user-select: none;
}
.calendar-advanced[open] > summary { color: var(--ink); }
.calendar-advanced-body { padding-top: 14px; }

.calendar-list {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.calendar-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.calendar-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 28px;
  gap: 9px;
  align-items: center;
  min-height: 55px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface-strong);
}
.calendar-badge {
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.calendar-badge.is-off { background: #eee9df; color: #7b6a4b; }
.calendar-badge.is-work { background: #e7efe3; color: #4f7248; }
.calendar-item-copy { min-width: 0; display: grid; gap: 3px; }
.calendar-item-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.calendar-item-copy span { color: var(--muted); font-size: 10px; }
.calendar-remove {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
}
.calendar-remove:hover { background: #f1eee7; color: var(--ink); }
.calendar-remove:disabled { opacity: .45; cursor: wait; }


.pwa-install-hint {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9;
  width: min(460px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(250,249,246,.97);
  box-shadow: 0 18px 54px rgba(23,23,20,.14);
  backdrop-filter: blur(14px);
}
.pwa-install-hint[hidden] { display: none; }
.pwa-install-hint-copy {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.pwa-install-hint-copy img { border-radius: 8px; }
.pwa-install-hint-copy div { min-width: 0; display: grid; gap: 2px; }
.pwa-install-hint-copy strong { font-size: 13px; }
.pwa-install-hint-copy span { color: var(--muted); font-size: 11px; line-height: 1.35; }
.pwa-install-hint-actions {
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-left: 42px;
}
.pwa-install-hint-actions button[hidden] { display: none; }
.pwa-install-hint-actions button {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.pwa-install-hint-actions .pwa-install-android {
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 760;
}
.pwa-install-later { color: var(--ink); font-size: 12px; font-weight: 760; }
.pwa-install-never { color: var(--muted); font-size: 11px; }
.pwa-install-hint-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; border-radius: 99px; padding: 11px 16px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 10; box-shadow: 0 12px 40px rgba(0,0,0,.16); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }


.app-tabs {
  display: inline-flex;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255,255,255,.38);
}
.app-tab, .view-switch-button, .range-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 99px;
  cursor: pointer;
  font: inherit;
  font-weight: 720;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.app-tab { min-height: 36px; padding: 0 15px; font-size: 13px; }
.app-tab.is-active, .view-switch-button.is-active, .range-button.is-active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 4px 14px rgba(23,23,20,.06);
}
.app-tab:active, .view-switch-button:active, .range-button:active { transform: scale(.97); }

.section-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.people-add-button {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s ease, opacity .15s ease;
}
.people-add-button:active { transform: scale(.97); }
.view-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.35); }
.view-switch-button { min-height: 32px; padding: 0 11px; font-size: 11px; }

.people-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop-zone {
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255,255,255,.36);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.drop-zone.smoke-zone { background: #ece9e1; }
.drop-zone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.drop-zone-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.drop-zone-head h3 { margin: 0; font-size: 22px; }
.zone-count {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}
.drop-list { display: grid; gap: 8px; }
.drop-hint { margin: 14px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.zone-empty { min-height: 112px; border: 1px dashed #c9c5bb; border-radius: 16px; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }

.drag-person {
  min-height: 78px;
  display: grid;
  grid-template-columns: 28px 40px minmax(0, 1fr) auto 30px auto;
  gap: 10px;
  align-items: center;
  padding: 11px 11px 11px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 17px;
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgba(23,23,20,.045);
  transition: opacity .16s ease, transform .16s ease;
}
.drag-person.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.drag-person.is-dragging { opacity: .3; transform: scale(.985); }
.drag-handle {
  width: 28px;
  height: 40px;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  place-content: center;
  gap: 4px;
  cursor: grab;
  touch-action: none;
  color: currentColor;
  opacity: .42;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.drag-avatar { width: 40px; height: 40px; border-radius: 13px; background: #ece9e1; display: grid; place-items: center; font-size: 12px; font-weight: 780; }
.drag-person.is-active .drag-avatar { background: rgba(255,255,255,.13); }
.drag-copy { min-width: 0; }
.drag-copy h3 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.drag-meta { color: var(--muted); font-size: 12px; }
.drag-person.is-active .drag-meta { color: rgba(255,255,255,.58); }
.drag-timer { font-size: 13px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.72); }
.drag-quick {
  min-height: 34px;
  border: 0;
  border-radius: 11px;
  padding: 0 11px;
  background: #efede7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}
.drag-person.is-active .drag-quick { background: var(--accent); color: #fff; }
.drag-quick:disabled { opacity: .5; cursor: wait; }
.drag-calendar, .drag-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.drag-calendar { display: grid; place-items: center; }
.drag-calendar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drag-remove { font-size: 20px; }
.drag-calendar:hover, .drag-remove:hover { background: rgba(23,23,20,.05); color: var(--ink); }
.drag-person.is-active .drag-calendar, .drag-person.is-active .drag-remove { color: rgba(255,255,255,.4); }
.drag-person.is-active .drag-calendar:hover, .drag-person.is-active .drag-remove:hover { background: rgba(255,255,255,.08); color: #fff; }
.drag-person.is-absent { background: #eeece6; box-shadow: none; color: var(--ink); }
.drag-person.is-absent .drag-handle { cursor: not-allowed; opacity: .18; }
.drag-person.is-absent .drag-avatar { background: #ddd9cf; }
.drag-person.is-absent .drag-quick { background: #dedad1; color: #6f6b63; }
.away-divider { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; font-weight: 760; }
.away-divider strong { font-size: 10px; }
.drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: .96;
  box-shadow: 0 24px 70px rgba(23,23,20,.22);
  transform-origin: center;
}

.analytics-view { padding-top: 34px; }
.analytics-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 14px 0 38px;
}
.analytics-lead { max-width: 620px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.range-switch { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.38); flex: 0 0 auto; }
.range-button { min-height: 36px; padding: 0 14px; font-size: 12px; }
.analytics-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-bottom: 38px; }
.metric-card { min-height: 158px; padding: 20px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.metric-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 760; }
.metric-value { margin-top: auto; font-size: clamp(31px, 4vw, 48px); line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metric-caption { margin-top: 8px; color: var(--muted); font-size: 12px; }
.analytics-section { padding: 34px 0 42px; border-top: 1px solid var(--line); }
.analytics-period { color: var(--muted); font-size: 12px; }
.chart-card, .people-ranking { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.42); overflow: hidden; }
.daily-chart {
  min-height: 260px;
  display: flex;
  align-items: stretch;
  gap: 5px;
  padding: 24px 18px 16px;
  overflow-x: auto;
}
.daily-bar-item { min-width: 22px; flex: 1 0 22px; height: 218px; display: grid; grid-template-rows: 22px 1fr 24px; gap: 5px; align-items: end; text-align: center; }
.daily-bar-value { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.daily-bar-track { height: 100%; min-height: 130px; display: flex; align-items: flex-end; justify-content: center; }
.daily-bar { width: min(100%, 24px); min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--ink); transition: height .28s ease; }
.daily-bar-item:hover .daily-bar { background: var(--accent); }
.daily-bar-label { color: var(--muted); font-size: 9px; white-space: nowrap; }
.daily-bar-label.is-muted { opacity: .35; }

.people-ranking { padding: 6px 18px; }
.ranking-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 72px; border-top: 1px solid var(--line-soft); }
.ranking-row:first-child { border-top: 0; }
.ranking-place { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ranking-person { min-width: 0; }
.ranking-line { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 9px; }
.ranking-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ranking-line span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ranking-track { height: 5px; background: #dfdcd4; border-radius: 99px; overflow: hidden; }
.ranking-value { height: 100%; border-radius: inherit; background: var(--ink); }
.analytics-empty { padding: 34px 18px; color: var(--muted); text-align: center; }

@media (max-width: 850px) {
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .people-board { grid-template-columns: 1fr; }
  .analytics-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .settings-card { width: min(660px, calc(100vw - 28px)); }
  .year-calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .settings-card { width: min(430px, calc(100vw - 14px)); padding: 14px; }
  .settings-block { padding: 14px; }
  .calendar-section-head { display: grid; grid-template-columns: 1fr; gap: 11px; }
  .year-calendar-toolbar { width: 100%; grid-template-columns: 42px 1fr 42px; }
  .year-calendar-nav { width: 42px; height: 42px; }
  .year-calendar-grid { grid-template-columns: 1fr; gap: 9px; }
  .year-calendar-month { padding: 12px 10px; }
  .year-calendar-weekdays, .year-calendar-days { gap: 4px; }
  .year-calendar-day { border-radius: 9px; font-size: 11px; }
  .calendar-import-footer { align-items: stretch; flex-direction: column; }
  .calendar-import-footer .secondary-button { width: 100%; min-height: 46px; }

  .shell, .gate-shell { width: min(100% - 24px, 1180px); padding-bottom: 26px; }
  .gate-shell { padding-bottom: 0; }
  .topbar, .gate-topbar { height: 72px; }
  .domain-mark { display: none; }
  .room-button { max-width: 50vw; min-height: 42px; }
  .icon-button { width: 42px; height: 42px; }
  main { padding-top: 24px; }
  .gate-main { padding: 0; }
  .gate-hero { padding: 48px 0; }
  .gate-hero h1 { font-size: clamp(48px, 15vw, 76px); }
  .gate-lead { margin-top: 23px; font-size: 17px; }
  .gate-actions { display: grid; grid-template-columns: 1fr; margin-top: 28px; }
  .gate-primary, .gate-secondary { width: 100%; }
  .gate-facts { flex-wrap: wrap; }
  .hero { grid-template-columns: 1fr; gap: 9px; padding-bottom: 31px; }
  .workday-schedule { text-align: left; padding: 6px 0 0; }
  .workday-time { padding: 0; }
  .app-tabs { margin-top: 12px; width: 100%; }
  .app-tab { flex: 1; }
  .people-section, .summary-section { padding: 28px 0 34px; }
  .section-heading { align-items: flex-start; }
  .people-section .section-heading { flex-direction: column; align-items: stretch; }
  .people-section .section-tools {
    width: 100%;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
  }
  .people-add-button { min-height: 40px; padding: 0 13px; }
  .live-indicator { display: none; }
  .view-switch-button { min-height: 31px; padding: 0 9px; }
  .drop-zone { min-height: 220px; padding: 14px; }
  .drag-person { grid-template-columns: 24px 38px minmax(0, 1fr) auto 28px; gap: 8px; }
  .drag-remove { display: none; }
  .drag-quick { padding: 0 9px; }
  .analytics-view { padding-top: 24px; }
  .analytics-hero { align-items: flex-start; flex-direction: column; gap: 22px; padding: 14px 0 30px; }
  .range-switch { width: 100%; }
  .range-button { flex: 1; }
  .analytics-metrics { grid-template-columns: 1fr; gap: 9px; padding-bottom: 30px; }
  .metric-card { min-height: 125px; }
  .analytics-section { padding: 28px 0 34px; }
  .daily-chart { padding-left: 12px; padding-right: 12px; }
  .ranking-line { gap: 8px; }
  .ranking-line span { font-size: 10px; }
  .people-grid { grid-template-columns: 1fr; gap: 10px; }
  .person-card { min-height: 176px; padding: 18px; }
  .person-name { margin-top: 14px; }
  .summary-card { border-radius: 18px; }
  .summary-table-header, .summary-row { grid-template-columns: minmax(0, 1.35fr) .38fr .58fr .55fr .62fr; gap: 6px; padding-left: 12px; padding-right: 12px; }
  .summary-table-header { font-size: 9px; }
  .summary-row { font-size: 13px; }
  footer { padding-top: 18px; }
  .code-actions { grid-template-columns: 1fr; }
  .picker-range { grid-template-columns: 1fr; gap: 9px; }
  .picker-range-arrow { display: none; }
  .quick-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-pick-button { width: 100%; min-height: 40px; padding: 0 7px; }
  .dialog .picker-field input[type="time"],
  .dialog .picker-field input[type="date"] { min-height: 54px; font-size: 16px; }
  .calendar-item { grid-template-columns: 1fr 28px; }
  .calendar-badge { justify-self: start; grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Colleague break history */
.break-history-card { max-width: 620px; }
.break-history-list { display: grid; gap: 18px; max-height: min(52dvh, 480px); overflow-y: auto; margin-top: 14px; }
.break-history-day h3 { margin: 0 0 8px; font-size: 13px; text-transform: capitalize; color: var(--muted); }
.break-history-entry { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.break-history-entry-copy { display: grid; gap: 3px; min-width: 0; }
.break-history-entry-copy strong { font-size: 15px; }
.break-history-entry-copy span, .break-history-empty { color: var(--muted); font-size: 13px; }
.break-history-edit { flex-shrink: 0; padding: 9px 12px; }
.break-edit-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.break-edit-form[hidden] { display: none; }
.break-edit-form h3 { margin: 0 0 12px; }
.break-edit-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.break-edit-fields .picker-field { min-width: 0; }
.break-edit-fields input { width: 100%; min-width: 0; }
.break-edit-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.break-edit-actions button { flex: 1; min-width: 110px; }
.drag-calendar svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The history dialog must remain scrollable even when editing expands it. */
#break-history-dialog {
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.break-history-card {
  box-sizing: border-box;
  width: min(620px, calc(100vw - 24px));
}
.break-edit-fields > .picker-field {
  min-width: 0;
  max-width: 100%;
}
.break-edit-fields > .picker-field input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 600px) {
  .break-history-card { padding: 18px; }
  .break-history-list { max-height: 38dvh; }
  /* Native date/time pickers need the full available width on mobile. */
  .break-edit-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .break-edit-fields > .picker-field input { min-height: 52px; }
  .break-history-entry { gap: 8px; }
  .break-history-edit { padding: 9px 10px; }
}
