:root {
  --wine: #701a2c;
  --wine-dark: #46101d;
  --coral: #f47d68;
  --paper: #f7f4f1;
  --surface: #ffffff;
  --ink: #241f20;
  --muted: #756d70;
  --line: #e5deda;
  --office: #167253;
  --office-soft: #dcefe7;
  --remote: #315da8;
  --remote-soft: #e2eaf8;
  --off: #b16b18;
  --off-soft: #f8ead3;
  --event: #c44f43;
  --event-soft: #fbe5e1;
  --duty: #7a3f91;
  --duty-soft: #f0e3f4;
  --missing: #9e9697;
  --missing-soft: #efebea;
  --shadow: 0 20px 60px rgba(66, 34, 42, .09);
  --radius: 18px;
  font-family: "Manrope", "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(244, 125, 104, .5);
  outline-offset: 3px;
}

.topbar {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(247, 244, 241, .94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: start; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 50% 50% 50% 16%; background: var(--wine); color: white;
  font: 700 20px/1 Georgia, serif;
}
.brand strong { display: block; font-size: 13px; letter-spacing: .14em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a { padding: 9px 15px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px; }
.topnav a[aria-current="page"] { color: var(--wine); background: #eadde0; }
.profile { display: flex; align-items: center; gap: 14px; justify-self: end; font-size: 13px; }
.profile-name { font-weight: 700; }
.link-button { border: 0; background: none; padding: 4px 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 25px; }
.page-heading h1, .login-copy h1 { margin: 4px 0 0; color: var(--wine-dark); font: 600 clamp(36px, 6vw, 66px)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--wine); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; }
.today-link { color: var(--wine); font-weight: 800; font-size: 13px; text-underline-offset: 4px; }

.office-event-board {
  display: grid; grid-template-columns: 180px 1fr; gap: 22px; align-items: start;
  margin-bottom: 14px; padding: 18px 20px; border: 1px solid #efb8af;
  border-left: 6px solid var(--event); border-radius: var(--radius); background: var(--event-soft);
}
.office-event-board-heading strong { display: block; margin-top: 5px; color: var(--wine-dark); font: 600 18px Georgia, serif; }
.office-event-list { display: grid; gap: 8px; }
.office-event {
  display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.7);
}
.office-event-icon { color: var(--event); font-size: 12px; }
.office-event strong, .office-event small { display: block; }
.office-event strong { font-size: 13px; }
.office-event small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.office-event form { margin: 0; }
.office-event form button { border: 0; background: none; color: #9b3143; font-size: 10px; text-decoration: underline; cursor: pointer; }
.event-creator {
  margin-bottom: 14px; padding: 14px 18px; border: 1px dashed #d8b5b1;
  border-radius: var(--radius); background: rgba(255,255,255,.58);
}
.event-creator summary { color: var(--wine); font-size: 12px; font-weight: 900; cursor: pointer; }
.event-creator form { display: grid; grid-template-columns: 2fr 1fr .8fr auto; gap: 10px; align-items: end; margin-top: 14px; }
.event-creator label { color: var(--muted); font-size: 10px; font-weight: 800; }
.event-creator input { height: 42px; margin-top: 5px; font-size: 12px; }
.event-creator form > button {
  height: 42px; padding: 0 16px; border: 0; border-radius: 11px;
  color: white; background: var(--event); font-size: 12px; font-weight: 800; cursor: pointer;
}

.summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 8px; }
.summary-item {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px;
  min-height: 80px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.summary-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(66, 34, 42, .07); }
.summary-item.is-active { border-color: var(--wine); box-shadow: inset 0 0 0 1px var(--wine); }
.summary-item .status-pip { width: 10px; height: 10px; border-radius: 50%; }
.summary-item strong { font: 700 32px/1 Georgia, serif; }
.summary-item p { margin: 0; color: var(--muted); font-size: 13px; }
.summary-all .status-pip { background: var(--wine); }
.summary-office .status-pip { background: var(--office); }
.summary-remote .status-pip { background: var(--remote); }
.summary-off .status-pip { background: var(--off); }
.summary-duty .status-pip { background: var(--duty); }
.summary-missing .status-pip { background: var(--missing); }

.my-status {
  position: relative; overflow: hidden; padding: 24px;
  display: grid; grid-template-columns: minmax(130px, .6fr) 2fr; gap: 24px; align-items: center;
  color: white; border-radius: 24px; background: var(--wine);
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.my-status::after {
  content: ""; position: absolute; width: 170px; height: 170px; right: -75px; top: -95px;
  border: 28px solid rgba(255,255,255,.08); border-radius: 50%;
}
.my-status .eyebrow { color: #f1c8c8; }
.my-status h2 { margin: 4px 0 0; font: 500 24px/1.1 Georgia, serif; }
.status-choice { position: relative; z-index: 1; }
.status-select-label { display: block; max-width: 520px; color: #f1c8c8; font-size: 11px; font-weight: 800; }
.main-status-select {
  height: 64px; margin-top: 8px; padding: 0 48px 0 18px;
  border: 1px solid rgba(255,255,255,.28); border-radius: 16px;
  background: white; color: var(--ink); font-size: 16px; font-weight: 800;
  cursor: pointer;
}
.choice-button {
  min-height: 82px; display: flex; align-items: center; gap: 13px; padding: 14px;
  border-radius: 16px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09); color: white; cursor: pointer; text-align: left;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.choice-button:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); }
.choice-button.is-active { background: white; color: var(--ink); border-color: white; }
.choice-icon { flex: 0 0 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-weight: 900; background: rgba(255,255,255,.15); }
.choice-office.is-active .choice-icon { color: var(--office); background: var(--office-soft); }
.choice-remote.is-active .choice-icon { color: var(--remote); background: var(--remote-soft); }
.choice-button strong, .choice-button small { display: block; }
.choice-button strong { font-size: 14px; }
.choice-button small { margin-top: 4px; opacity: .72; font-size: 11px; }
.save-state { position: absolute; left: 24px; bottom: 9px; margin: 0; color: #e7cfd4; font-size: 11px; }
.save-state.is-error { color: #ffd3cb; }

.week-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.week-toolbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); text-align: center; }
.week-toolbar > a { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; font-size: 20px; }
.week-toolbar-center { display: grid; justify-items: center; }
.week-toolbar strong { display: block; margin-top: 4px; font: 600 18px/1.2 Georgia, serif; }
.week-picker { width: min(100%, 430px); margin-top: 14px; text-align: left; }
.week-picker > label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.week-picker-controls { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.week-picker select { height: 42px; margin: 0; font-size: 12px; font-weight: 800; cursor: pointer; }
.week-picker button {
  min-width: 88px; border: 0; border-radius: 11px; padding: 0 14px;
  color: white; background: var(--wine); font-size: 12px; font-weight: 800; cursor: pointer;
}
.week-scroll { overflow-x: auto; }
.schedule-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.schedule-table th, .schedule-table td { border-bottom: 1px solid var(--line); text-align: center; }
.schedule-table thead th { padding: 12px 8px; color: var(--muted); font-size: 11px; }
.schedule-table thead th:first-child { width: 250px; padding-left: 24px; text-align: left; }
.schedule-table thead a { display: block; text-decoration: none; }
.schedule-table thead span, .schedule-table thead strong { display: block; }
.schedule-table thead strong { margin-top: 4px; color: var(--ink); font-size: 18px; }
.day-event-marker {
  max-width: 112px; margin: 7px auto 0; padding: 5px 6px; overflow: hidden;
  border-radius: 8px; color: #8c3029; background: var(--event-soft);
  font-size: 9px; line-height: 1.2; text-align: left;
}
.day-event-marker b { display: block; font-size: 9px; }
.day-event-marker span { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-table tbody th { padding: 14px 24px; display: flex; align-items: center; gap: 11px; text-align: left; font-size: 13px; }
.schedule-table tbody th small { display: block; margin-top: 3px; color: var(--wine); font-size: 10px; }
.schedule-table tbody td { height: 64px; padding: 8px; }
.schedule-table .is-selected { background: #fbf5f4; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: #eee5e4; color: var(--wine); font-weight: 900; }
.day-status { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 12px; border: 0; font-size: 12px; font-weight: 900; }
button.day-status { cursor: pointer; transition: transform .15s ease; }
button.day-status:hover { transform: scale(1.08); }
.status-office { color: var(--office); background: var(--office-soft); }
.status-remote { color: var(--remote); background: var(--remote-soft); }
.status-off { color: var(--off); background: var(--off-soft); }
.status-missing { color: var(--missing); background: var(--missing-soft); }
.is-duty { box-shadow: inset 0 0 0 2px var(--duty); }
.day-status-select {
  width: 116px; height: 38px; margin: 0; padding: 0 8px;
  border: 0; border-radius: 12px; text-align: left; font-size: 11px;
  font-weight: 900; cursor: pointer;
}
.legend { padding: 16px 24px; display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend-office { background: var(--office); }
.legend-remote { background: var(--remote); }
.legend-duty { background: var(--duty); }
.legend-off { background: var(--off); }
.legend-missing { background: var(--missing); }
.legend small { margin-left: auto; }

.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 520px) 1fr;
  background: var(--paper);
}
.login-card { padding: clamp(32px, 7vw, 90px); display: flex; flex-direction: column; justify-content: center; }
.login-brand { position: absolute; top: 36px; display: flex; align-items: center; gap: 11px; letter-spacing: .12em; }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { color: var(--muted); font-size: 10px; letter-spacing: 0; margin-top: 3px; }
.brand-mark-large { width: 44px; height: 44px; }
.login-copy h1 { font-size: clamp(52px, 7vw, 82px); max-width: 420px; }
.login-copy > p:last-child { max-width: 390px; margin: 20px 0 30px; color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 10px; max-width: 390px; }
.login-form label, .stack-form label, .person-actions label { font-size: 12px; font-weight: 800; }
input, select { width: 100%; height: 50px; margin-top: 7px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); }
.primary-button { min-height: 52px; margin-top: 8px; border: 0; border-radius: 13px; color: white; background: var(--wine); font-weight: 800; cursor: pointer; }
.login-help { margin: 20px 0 0; color: var(--muted); font-size: 11px; }
.login-visual { position: relative; overflow: hidden; display: grid; grid-template-columns: repeat(5, 1fr); align-content: end; padding: 60px; background: var(--wine); color: white; }
.login-visual > p { padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.22); font-size: 12px; opacity: .65; }
.route-line { position: absolute; left: 10%; right: 10%; bottom: 35%; height: 2px; background: rgba(255,255,255,.22); transform: rotate(-8deg); }
.route-dot { position: absolute; display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50% 50% 50% 20%; font: 600 18px Georgia, serif; box-shadow: 0 20px 40px rgba(0,0,0,.18); }
.route-office { left: 16%; bottom: 28%; background: var(--coral); transform: rotate(-8deg); }
.route-remote { right: 15%; top: 22%; color: var(--remote); background: #edf3ff; transform: rotate(10deg); }

.team-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; align-items: start; }
.panel { padding: 24px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2 { margin: 0 0 22px; font: 600 24px Georgia, serif; }
.stack-form { display: grid; gap: 14px; }
.people-list { border-top: 1px solid var(--line); }
.person { border-bottom: 1px solid var(--line); }
.person summary { list-style: none; padding: 14px 2px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.person summary::-webkit-details-marker { display: none; }
.person summary strong, .person summary small { display: block; }
.person summary small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.chevron { margin-left: auto; }
.person-actions { padding: 5px 0 18px 46px; display: flex; gap: 12px; align-items: end; }
.person-actions form:first-child { display: flex; align-items: end; gap: 8px; }
.person-actions input { height: 40px; margin-top: 4px; }
.secondary-button { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; white-space: nowrap; }
.danger-link { border: 0; background: none; color: #9b3143; text-decoration: underline; cursor: pointer; font-size: 11px; }
.flash { margin-bottom: 14px; padding: 12px 15px; border-radius: 12px; font-size: 13px; }
.flash-error { color: #7d1f2f; background: #f8dfe3; }
.flash-success { color: #155a44; background: var(--office-soft); }

@media (max-width: 760px) {
  .topbar { height: 66px; grid-template-columns: 1fr auto; padding: 0 16px; }
  .topnav { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; padding: 5px; background: white; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
  .profile-name { display: none; }
  .shell { width: min(100% - 24px, 620px); padding: 30px 0 90px; }
  .page-heading h1 { font-size: 42px; }
  .office-event-board { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .office-event { grid-template-columns: auto minmax(0, 1fr) auto; }
  .event-creator form { grid-template-columns: 1fr 1fr; }
  .event-creator form label:first-of-type { grid-column: 1 / -1; }
  .event-creator form > button { grid-column: 1 / -1; }
  .summary { grid-template-columns: repeat(6, minmax(72px, 1fr)); gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .summary-item { display: block; min-height: 88px; padding: 13px; }
  .summary-item .status-pip { display: block; margin-bottom: 10px; }
  .summary-item strong { font-size: 28px; }
  .summary-item p { margin-top: 3px; font-size: 10px; }
  .filter-result { margin-bottom: 12px; text-align: left; }
  .my-status { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
  .status-choice { display: block; }
  .choice-button { min-height: 70px; }
  .save-state { position: static; grid-column: 1; }
  .week-toolbar { grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 8px; padding: 16px 10px; }
  .week-toolbar > a { width: 38px; height: 38px; }
  .week-toolbar strong { font-size: 16px; }
  .week-picker { margin-top: 12px; }
  .week-picker-controls { grid-template-columns: 1fr; }
  .week-picker button { height: 40px; }
  .legend { flex-wrap: wrap; gap: 10px 16px; }
  .legend small { width: 100%; margin-left: 0; }
  .login-shell { display: block; }
  .login-card { min-height: 100vh; padding: 104px 24px 40px; }
  .login-brand { top: 28px; }
  .login-visual { display: none; }
  .team-grid { grid-template-columns: 1fr; }
  .person-actions, .person-actions form:first-child { display: grid; grid-template-columns: 1fr; padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.filter-result { margin: 0 0 16px; color: var(--muted); font-size: 11px; text-align: right; }
