:root {
  --paper: #f7f4ed;
  --paper-deep: #eee9df;
  --ink: #202522;
  --muted: #747771;
  --line: #dedbd2;
  --white: #fffefa;
  --orange: #e97235;
  --orange-dark: #c7541f;
  --orange-soft: #fff0e4;
  --sage: #e6ece1;
  --sage-dark: #486052;
  --blue-night: #263a45;
  --shadow: 0 22px 60px rgba(57, 47, 34, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(233, 114, 53, 0.28);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  top: 170px;
  left: -160px;
  width: 380px;
  height: 380px;
  background: rgba(232, 182, 123, 0.13);
}

.ambient-two {
  right: -110px;
  bottom: 80px;
  width: 310px;
  height: 310px;
  background: rgba(154, 177, 143, 0.12);
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 25px 0;
  border-bottom: 1px solid rgba(36, 40, 36, 0.09);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  justify-self: start;
  color: var(--ink);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--white);
  background: var(--orange);
  border-radius: 12px 12px 14px 14px;
  transform: rotate(-2deg);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.top-nav {
  display: flex;
  gap: 8px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(38, 40, 36, 0.08);
  border-radius: 999px;
}

.nav-button {
  padding: 9px 19px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: 180ms ease;
}

.nav-button:hover {
  color: var(--ink);
}

.nav-button.active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 3px 12px rgba(46, 41, 34, 0.08);
}

.header-tools {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-self: end;
}

.identity-chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  max-width: 150px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(38, 40, 36, 0.08);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.identity-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
}

.header-action {
  padding: 7px 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.header-action:hover {
  color: var(--orange-dark);
  background: var(--orange-soft);
}

.today-chip {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #67a064;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(103, 160, 100, 0.12);
}

main {
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 166px);
  margin: 0 auto;
}

.view {
  animation: view-in 320ms ease both;
}

.view[hidden] {
  display: none;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.hero {
  position: relative;
  padding: 30px 0 20px;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.25em;
}

.hero h1,
.stats-header h1 {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.hero h1 {
  overflow: visible;
  font-size: clamp(24px, 6.4vw, 54px);
  line-height: 1.13;
  white-space: nowrap;
}

.hero h1 em {
  position: relative;
  color: var(--orange);
  font-style: normal;
}

.hero h1 .title-underline {
  position: relative;
  display: inline-block;
}

.hero h1 .title-underline::after {
  position: absolute;
  left: 9%;
  bottom: -10px;
  width: 82%;
  height: 9px;
  background: url("data:image/svg+xml,%3Csvg width='220' height='10' viewBox='0 0 220 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 7C47 2 133 2 218 5' fill='none' stroke='%23e97235' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  content: "";
}

.hero-copy {
  position: absolute;
  right: 2%;
  bottom: 53px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.signup-layout {
  display: grid;
  grid-template-columns: 1.28fr 0.72fr;
  gap: 18px;
  align-items: stretch;
}

.panel {
  background: rgba(255, 254, 250, 0.88);
  border: 1px solid rgba(42, 43, 39, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.signup-panel,
.overview-panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading > div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.panel-heading h2,
.chart-heading h2,
.details-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.required-note,
.panel-date,
.list-heading span,
.details-heading span {
  color: #92928c;
  font-size: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.preset-fieldset {
  padding: 0;
  margin: 14px 0;
  border: 0;
}

.preset-fieldset legend {
  padding: 0;
  margin-bottom: 8px;
  color: #52564f;
  font-size: 12px;
  font-weight: 600;
}

.preset-fieldset legend small {
  margin-left: 5px;
  color: #9a9b96;
  font-size: 10px;
  font-weight: 400;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.preset-grid button {
  min-height: 36px;
  padding: 6px 8px;
  color: #575a54;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  transition: 160ms ease;
}

.preset-grid button:hover {
  color: var(--orange);
  background: #fff7ed;
  border-color: rgba(233, 114, 53, 0.45);
}

.schedule-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) minmax(190px, 0.85fr);
  gap: 12px;
  margin-bottom: 14px;
}

.calendar-section,
.day-meal-editor {
  padding: 12px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.calendar-heading,
.active-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 6px;
}

.calendar-heading strong,
.active-day-heading strong {
  color: #3f433e;
  font-size: 12px;
}

.calendar-heading > span,
.active-day-heading > span {
  color: #989993;
  font-size: 9px;
}

.calendar-heading i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 3px;
  background: var(--orange);
  border-radius: 50%;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.weekday-row {
  margin-bottom: 3px;
  color: #a0a19b;
  font-size: 9px;
  text-align: center;
}

.calendar-day-button,
.calendar-blank {
  min-width: 0;
  height: 34px;
}

.calendar-day-button {
  position: relative;
  display: grid;
  padding: 4px 2px 3px;
  place-items: center;
  color: #62645f;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  transition: 140ms ease;
}

.calendar-day-button:hover {
  background: #f4eee4;
}

.calendar-day-button.has-meals {
  color: #9f4f24;
  background: #ffead2;
}

.calendar-day-button.lunch-only {
  color: #914417;
  background: linear-gradient(145deg, #fff2d6, #ffc97e);
}

.calendar-day-button.dinner-only {
  color: #fff;
  background: linear-gradient(145deg, #496776, #1e3440);
}

.calendar-day-button.has-both {
  color: #fff;
  background: linear-gradient(135deg, #e98a48 0 50%, #354e59 50% 100%);
}

.calendar-day-button.locked {
  opacity: 0.68;
}

.calendar-day-button.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(34, 40, 36, 0.12);
}

.calendar-day-button.today::after {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 3px;
  height: 3px;
  background: #69a268;
  border-radius: 50%;
  content: "";
}

.calendar-meal-dots {
  display: flex;
  gap: 2px;
  min-height: 7px;
}

.calendar-meal-dots i {
  color: #c56527;
  font-size: 7px;
  font-style: normal;
  line-height: 1;
}

.calendar-meal-dots i.dinner {
  color: #354e59;
}

.calendar-day-button.has-both .calendar-meal-dots i {
  color: rgba(255, 255, 255, 0.95);
}

.calendar-day-button.dinner-only .calendar-meal-dots i {
  color: #fff;
}

.compact-meals {
  margin: 8px 0 0;
}

.compact-meals legend {
  margin-bottom: 7px;
  font-size: 11px;
}

.compact-meals .meal-options {
  grid-template-columns: 1fr;
  gap: 7px;
}

.compact-meals .meal-card {
  min-height: 58px;
  padding: 9px;
  border-radius: 11px;
}

.compact-meals .meal-icon {
  width: 34px;
  height: 34px;
}

.compact-meals .meal-icon svg {
  width: 22px;
}

.compact-meals .meal-info strong {
  font-size: 12px;
}

.compact-meals .meal-info > span {
  font-size: 9px;
}

.schedule-tip {
  margin: 8px 0 0;
  color: #969791;
  font-size: 9px;
  line-height: 1.5;
}

.field-label {
  display: grid;
  gap: 9px;
}

.field-label > span,
.meal-fieldset legend,
.stats-actions label {
  color: #52564f;
  font-size: 13px;
  font-weight: 600;
}

.field-label > span small {
  margin-left: 5px;
  color: #9a9b96;
  font-size: 10px;
  font-weight: 400;
}

.field-label input,
.stats-actions input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: 160ms ease;
}

.field-label input:focus,
.stats-actions input:focus {
  background: var(--white);
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(233, 114, 53, 0.08);
}

.field-label input.invalid {
  border-color: #c44e42;
}

.field-label input[readonly] {
  color: var(--sage-dark);
  background: var(--sage);
  border-color: rgba(72, 96, 82, 0.14);
  cursor: default;
  font-weight: 700;
}

.meal-fieldset {
  padding: 0;
  margin: 22px 0 24px;
  border: 0;
}

.meal-fieldset legend {
  padding: 0;
  margin-bottom: 10px;
}

.meal-fieldset legend small {
  margin-left: 5px;
  color: #9a9b96;
  font-size: 11px;
  font-weight: 400;
}

.meal-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meal-option {
  position: relative;
  cursor: pointer;
}

.meal-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.meal-card {
  display: flex;
  align-items: center;
  min-height: 85px;
  padding: 16px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 15px;
  transition: 170ms ease;
}

.meal-option:hover .meal-card {
  border-color: #c9c3b7;
  transform: translateY(-1px);
}

.meal-option input:focus-visible + .meal-card {
  outline: 3px solid rgba(233, 114, 53, 0.25);
  outline-offset: 2px;
}

.meal-option input:checked + .meal-card {
  background: var(--orange-soft);
  border-color: rgba(233, 114, 53, 0.55);
}

.meal-option input:disabled + .meal-card {
  cursor: not-allowed;
  opacity: 0.62;
}

.dinner-option input:checked + .meal-card {
  background: #edf1ef;
  border-color: rgba(72, 96, 82, 0.48);
}

.meal-icon {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--orange);
  background: var(--white);
  border-radius: 13px;
}

.dinner-option .meal-icon {
  color: var(--sage-dark);
}

.meal-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.meal-info {
  display: grid;
  gap: 4px;
  margin-left: 12px;
}

.meal-info strong {
  font-size: 15px;
}

.meal-info > span {
  color: var(--muted);
  font-size: 11px;
}

.check-mark {
  display: grid;
  width: 20px;
  height: 20px;
  margin-left: auto;
  place-items: center;
  color: transparent;
  background: var(--white);
  border: 1px solid #d3d0c8;
  border-radius: 50%;
}

.check-mark svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.meal-option input:checked + .meal-card .check-mark {
  color: var(--white);
  background: var(--orange);
  border-color: var(--orange);
}

.dinner-option input:checked + .meal-card .check-mark {
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

.field-error {
  min-height: 16px;
  margin: 7px 0 -6px;
  color: #b53f34;
  font-size: 11px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: 170ms ease;
}

.primary-button {
  width: 100%;
  height: 49px;
  gap: 12px;
  color: white;
  background: var(--ink);
  border-radius: 13px;
  box-shadow: 0 8px 22px rgba(31, 36, 33, 0.15);
}

.primary-button:hover {
  background: #323934;
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.delete-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.primary-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.panel-heading.compact {
  margin-bottom: 20px;
}

.count-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.count-card {
  position: relative;
  min-height: 142px;
  padding: 18px;
  overflow: hidden;
  border-radius: 16px;
}

.lunch-count-card {
  background: #fff0dd;
}

.dinner-count-card {
  color: #f4f5f0;
  background: var(--blue-night);
}

.count-card::after {
  position: absolute;
  right: -19px;
  bottom: -28px;
  width: 90px;
  height: 90px;
  border: 1px solid rgba(224, 135, 64, 0.2);
  border-radius: 50%;
  content: "";
}

.dinner-count-card::after {
  border-color: rgba(255, 255, 255, 0.1);
}

.count-topline {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 11px;
  font-size: 12px;
  font-weight: 600;
}

.mini-meal-icon {
  color: #e58c36;
  font-size: 13px;
}

.moon-icon {
  color: #d7e0d0;
  font-size: 9px;
  text-shadow: -4px -3px 0 var(--blue-night);
}

.count-card strong {
  font-size: 38px;
  line-height: 1;
}

.count-card small {
  margin-left: 5px;
  color: #7f7569;
  font-size: 11px;
}

.dinner-count-card small {
  color: #aebbb4;
}

.time-label {
  margin-top: 13px;
  color: #8d7c6b;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.dinner-count-card .time-label {
  color: #aebbb4;
}

.changes-block,
.registrations-block {
  margin-top: 23px;
}

.changes-block + .registrations-block {
  margin-top: 15px;
}

.list-heading,
.details-heading,
.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid #e7e3db;
}

.list-heading h3 {
  margin: 0;
  font-size: 13px;
}

.registration-list {
  display: grid;
  max-height: 151px;
  overflow: auto;
}

.registration-item {
  display: flex;
  align-items: center;
  min-height: 50px;
  border-bottom: 1px solid #efede7;
}

.person-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  place-items: center;
  color: #5e655e;
  background: #ecebe5;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}

.registration-name {
  max-width: 100px;
  margin-left: 9px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-tag {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 4px 7px;
  color: #bb5b25;
  background: #fff0e4;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
}

.meal-tag.dinner {
  color: var(--sage-dark);
  background: var(--sage);
}

.meal-tag.both {
  color: #fff;
  background: linear-gradient(135deg, #e98a48 0 50%, #354e59 50% 100%);
}

.change-list {
  max-height: 128px;
}

.change-item {
  gap: 6px;
}

.change-action {
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 700;
}

.change-item.cancel .change-action {
  color: #b53f34;
}

.final-badge,
.late-badge,
.admin-badge {
  display: inline-flex;
  padding: 3px 5px;
  color: #b53f34;
  background: #fbe7e3;
  border-radius: 5px;
  font-size: 9px;
  white-space: nowrap;
}

.admin-badge {
  margin-left: 4px;
  color: #3f5c4c;
  background: var(--sage);
}

.delete-button {
  display: grid;
  width: 27px;
  height: 27px;
  margin-left: 5px;
  place-items: center;
  color: #aaa9a3;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: 150ms ease;
}

.registration-item:hover .delete-button,
.delete-button:focus-visible,
tr:hover .delete-button {
  opacity: 1;
}

.delete-button:hover {
  color: #b8493e;
  background: #fbece8;
}

.delete-button svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.empty-state {
  display: grid;
  min-height: 100px;
  place-items: center;
  color: #999a94;
  font-size: 12px;
  text-align: center;
}

.compact-empty {
  min-height: 54px;
}

.stats-view {
  padding: 69px 0 40px;
}

.stats-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 36px;
}

.stats-header h1 {
  font-size: clamp(36px, 5vw, 55px);
}

.stats-header p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.stats-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.stats-actions label {
  margin-right: 2px;
}

.stats-actions input {
  width: 157px;
  background: rgba(255, 254, 250, 0.76);
}

.secondary-button {
  height: 45px;
  gap: 7px;
  padding: 0 15px;
  color: var(--white);
  background: var(--ink);
  border-radius: 11px;
  font-size: 12px;
}

.secondary-button:hover {
  background: #353b37;
  transform: translateY(-1px);
}

.secondary-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stats-summary article {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-height: 100px;
  padding: 22px;
  background: rgba(255, 254, 250, 0.82);
  border: 1px solid rgba(42, 43, 39, 0.09);
  border-radius: 17px;
}

.stats-summary span {
  color: var(--muted);
  font-size: 12px;
}

.stats-summary strong {
  font-size: 32px;
}

.chart-panel,
.details-panel,
.matrix-panel,
.admin-panel {
  padding: 25px;
}

.chart-panel {
  margin-bottom: 18px;
}

.chart-heading > div {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.chart-heading span {
  color: var(--muted);
  font-size: 11px;
}

.legend {
  display: flex;
  gap: 6px;
  align-items: center;
}

.legend i {
  width: 8px;
  height: 8px;
  background: var(--orange);
  border-radius: 50%;
}

.bar-chart {
  display: grid;
  gap: 18px;
  padding-top: 26px;
}

.bar-row {
  display: grid;
  grid-template-columns: 45px 1fr 30px;
  gap: 14px;
  align-items: center;
  font-size: 12px;
}

.bar-row > span {
  font-weight: 600;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  background: #efede7;
  border-radius: 99px;
}

.bar-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #eb8c52, var(--orange));
  border-radius: inherit;
  transition: width 450ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar-row:nth-child(2) .bar-track i {
  background: linear-gradient(90deg, #799081, var(--sage-dark));
}

.details-heading {
  margin-bottom: 15px;
}

.details-panel {
  margin-bottom: 18px;
}

.matrix-panel {
  margin-bottom: 18px;
}

.matrix-panel .details-heading > div,
.admin-panel .details-heading > div {
  display: grid;
  gap: 5px;
}

.matrix-panel .details-heading strong {
  font-size: 12px;
  white-space: nowrap;
}

.matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.monthly-matrix {
  min-width: 1260px;
  font-size: 10px;
  text-align: center;
}

.monthly-matrix th,
.monthly-matrix td {
  min-width: 36px;
  height: 32px;
  padding: 4px;
  border: 1px solid #e5e1d8;
}

.monthly-matrix thead th,
.monthly-matrix tfoot th,
.monthly-matrix tfoot td {
  background: #f5f1e9;
  font-weight: 700;
}

.monthly-matrix .matrix-name {
  position: sticky;
  z-index: 1;
  left: 0;
  min-width: 100px;
  color: var(--ink);
  background: #fffefa;
  text-align: left;
}

.monthly-matrix thead .matrix-name,
.monthly-matrix tfoot .matrix-name {
  z-index: 2;
  background: #f5f1e9;
}

.monthly-matrix .matrix-value.value-0 {
  color: #aaa9a2;
}

.monthly-matrix .matrix-value.value-1 {
  color: #a75627;
  background: #fff7ee;
}

.monthly-matrix .matrix-value.value-2 {
  color: #fff;
  background: #3b525c;
}

.monthly-matrix .matrix-value.late {
  color: #d52f25;
  background: #ffe3de;
  font-weight: 800;
}

.matrix-empty {
  height: 80px;
  color: #999a94;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: #52564f;
  font-size: 11px;
  font-weight: 600;
}

.admin-form input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.admin-submit {
  white-space: nowrap;
}

.admin-actions {
  display: grid;
  gap: 7px;
}

.admin-restore {
  height: 36px;
  color: #535a54;
  background: #f3f0e9;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}

.admin-restore:disabled {
  cursor: wait;
  opacity: 0.55;
}

.secondary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid #ece9e2;
}

th {
  color: #8d8f89;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

td:first-child {
  font-weight: 600;
}

td:last-child {
  width: 38px;
  text-align: right;
}

tbody .delete-button {
  display: inline-grid;
}

.empty-row td {
  height: 100px;
  color: #999a94;
  text-align: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: min(1180px, calc(100% - 48px));
  margin: 34px auto 0;
  padding: 22px 0 27px;
  color: #a3a39c;
  border-top: 1px solid rgba(36, 40, 36, 0.08);
  font-size: 10px;
}

.copyright {
  flex-basis: 100%;
  margin-top: 2px;
  text-align: center;
}

#connectionStatus[data-state="loading"] {
  color: #8b7442;
}

#connectionStatus[data-state="error"] {
  color: #b53f34;
}

.auth-pending > .site-header,
.auth-pending > main,
.auth-pending > footer,
.auth-pending > .ambient,
.auth-required > .site-header,
.auth-required > main,
.auth-required > footer,
.auth-required > .ambient {
  display: none !important;
}

body.auth-pending,
body.auth-required,
body.modal-open {
  overflow: hidden;
}

.access-gate {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: 24px;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(233, 114, 53, 0.13), transparent 31%),
    radial-gradient(circle at 88% 78%, rgba(72, 96, 82, 0.12), transparent 32%),
    var(--paper);
}

.access-gate[hidden],
.access-loading[hidden],
.binding-form[hidden],
.access-retry[hidden],
.text-action[hidden],
.modal-backdrop[hidden],
.admin-unlock-form[hidden],
.people-workspace[hidden] {
  display: none !important;
}

.access-card {
  display: grid;
  width: min(100%, 430px);
  padding: 36px;
  background: rgba(255, 254, 250, 0.96);
  border: 1px solid rgba(36, 40, 36, 0.08);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(57, 47, 34, 0.13);
  text-align: center;
}

.access-brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 17px;
  place-items: center;
  color: var(--white);
  background: var(--orange);
  border-radius: 17px 17px 20px 20px;
  transform: rotate(-2deg);
}

.access-brand-mark svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.access-eyebrow,
.manager-heading p {
  margin: 0 0 7px;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.access-card h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 38px);
  letter-spacing: -0.04em;
}

.access-message {
  min-height: 42px;
  margin: 13px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.access-loading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 700;
}

.access-loading i {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(72, 96, 82, 0.22);
  border-top-color: var(--sage-dark);
  border-radius: 50%;
  animation: access-spin 760ms linear infinite;
}

@keyframes access-spin {
  to { transform: rotate(360deg); }
}

.binding-form,
.admin-unlock-form,
.person-editor-form {
  display: grid;
  gap: 13px;
  text-align: left;
}

.binding-form label,
.admin-unlock-form label,
.person-editor-form label {
  display: grid;
  gap: 7px;
  color: #52564f;
  font-size: 12px;
  font-weight: 700;
}

.binding-form input,
.admin-unlock-form input,
.person-editor-form input {
  width: 100%;
  height: 47px;
  padding: 0 14px;
  color: var(--ink);
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

.binding-form input:focus,
.admin-unlock-form input:focus,
.person-editor-form input:focus {
  background: var(--white);
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(233, 114, 53, 0.08);
}

.access-submit {
  width: 100%;
  margin-top: 3px;
}

.access-retry {
  justify-self: center;
  min-width: 150px;
}

.text-action {
  justify-self: center;
  padding: 8px 10px;
  color: var(--orange-dark);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.text-action + .text-action {
  margin-top: -4px;
}

.access-card > small {
  margin-top: 10px;
  color: #999a94;
  font-size: 10px;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: 22px;
  place-items: center;
  background: rgba(27, 31, 28, 0.48);
  backdrop-filter: blur(5px);
}

.people-manager {
  width: min(100%, 650px);
  max-height: min(820px, calc(100vh - 44px));
  overflow-y: auto;
  padding: 27px;
  background: var(--white);
  border-radius: 24px;
  box-shadow: 0 30px 100px rgba(20, 24, 21, 0.28);
}

.manager-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.manager-heading h2 {
  margin: 0;
  font-size: 27px;
}

.modal-close {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  color: var(--muted);
  background: var(--paper-deep);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
}

.admin-unlock-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.admin-unlock-form .secondary-button {
  height: 47px;
}

.people-workspace {
  display: grid;
  gap: 18px;
}

.manager-note {
  margin: -7px 0 0;
  padding: 10px 12px;
  color: var(--sage-dark);
  background: var(--sage);
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.6;
}

.person-editor-form {
  grid-template-columns: 0.8fr 1fr;
  padding: 16px;
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.person-editor-form label small {
  color: #999a94;
  font-weight: 400;
}

.person-editor-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 9px;
}

.subtle-button,
.person-fill-button,
.person-delete-button {
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.subtle-button:hover,
.person-fill-button:hover {
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-color: rgba(233, 114, 53, 0.25);
}

.people-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.people-list-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.people-list {
  display: grid;
  gap: 8px;
}

.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  background: #fbfaf6;
  border: 1px solid rgba(36, 40, 36, 0.07);
  border-radius: 13px;
}

.person-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.person-row > div strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-row > div small {
  color: var(--muted);
  font-size: 10px;
}

.person-fill-button {
  color: var(--sage-dark);
}

.person-delete-button {
  color: #b53f34;
  border-color: rgba(181, 63, 52, 0.16);
}

.person-delete-button:hover {
  background: #fff0ed;
}

.people-empty {
  padding: 28px 16px;
  color: var(--muted);
  background: #faf8f3;
  border-radius: 13px;
  text-align: center;
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 70;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 220px;
  padding: 14px 17px;
  color: var(--white);
  background: #252b27;
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(30, 35, 31, 0.24);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 220ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error .toast-icon {
  color: #ff8b7e;
}

.toast-icon {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  color: #8bc38b;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    position: fixed;
    z-index: 5;
    right: 16px;
    bottom: 15px;
    left: 16px;
    justify-content: center;
    background: rgba(247, 244, 237, 0.93);
    box-shadow: 0 10px 35px rgba(40, 39, 35, 0.14);
    backdrop-filter: blur(15px);
  }

  .nav-button {
    flex: 1;
  }

  .header-tools {
    grid-column: 2;
  }

  .hero-copy {
    position: static;
    margin-top: 25px;
  }

  .signup-layout {
    grid-template-columns: 1fr;
  }

  .stats-header {
    display: grid;
    gap: 25px;
  }

  .stats-actions {
    flex-wrap: wrap;
  }

  .stats-summary {
    grid-template-columns: 1fr 1fr;
  }

  .admin-form {
    grid-template-columns: 1fr 1fr;
  }

  footer {
    padding-bottom: 94px;
  }
}

@media (max-width: 600px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    padding: 11px 0;
  }

  .brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .header-tools {
    gap: 2px;
  }

  .identity-chip {
    max-width: 86px;
    padding: 6px 8px;
  }

  .identity-chip > span,
  .today-chip {
    display: none;
  }

  .header-action {
    padding: 7px 5px;
    font-size: 10px;
  }

  .today-chip {
    font-size: 11px;
  }

  .hero {
    padding: 7px 0 9px;
  }

  .hero h1 {
    font-size: clamp(22px, 6.35vw, 26px);
  }

  .desktop-break {
    display: none;
  }

  .signup-panel,
  .overview-panel {
    padding: 13px;
  }

  .signup-panel .panel-heading {
    margin-bottom: 10px;
  }

  .signup-panel .step-number {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }

  .signup-panel .panel-heading > div {
    gap: 8px;
  }

  .signup-panel .panel-heading h2 {
    font-size: 16px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(108px, 0.75fr);
    gap: 8px;
  }

  .field-label > span small {
    display: none;
  }

  .field-label input {
    height: 38px;
    padding: 0 10px;
  }

  .preset-fieldset {
    margin: 9px 0;
  }

  .preset-fieldset legend {
    margin-bottom: 5px;
  }

  .preset-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .preset-grid button {
    min-height: 34px;
    padding: 4px 3px;
    border-radius: 8px;
    font-size: 9px;
    line-height: 1.25;
  }

  .schedule-workspace {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 9px;
  }

  .calendar-section,
  .day-meal-editor {
    padding: 7px;
    border-radius: 11px;
  }

  .calendar-heading,
  .active-day-heading {
    margin-bottom: 4px;
  }

  .calendar-heading > span,
  .compact-meals legend,
  .schedule-tip {
    display: none;
  }

  .weekday-row,
  .calendar-grid {
    gap: 2px;
  }

  .calendar-day-button,
  .calendar-blank {
    height: 40px;
  }

  .calendar-day-button {
    font-size: 12px;
  }

  .day-meal-editor {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
  }

  .day-meal-editor .active-day-heading {
    display: grid;
    gap: 2px;
    align-content: center;
    margin: 0;
  }

  .day-meal-editor .active-day-heading strong {
    font-size: 11px;
    line-height: 1.25;
  }

  .compact-meals {
    margin: 0;
  }

  .compact-meals .meal-options {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .compact-meals .meal-card {
    min-height: 43px;
    padding: 5px;
  }

  .compact-meals .meal-icon {
    width: 26px;
    height: 26px;
    margin-right: 5px;
  }

  .compact-meals .meal-icon svg {
    width: 18px;
  }

  .compact-meals .meal-info > span {
    display: none;
  }

  .compact-meals .check-mark {
    width: 17px;
    height: 17px;
    margin-left: auto;
  }

  .primary-button {
    height: 44px;
  }

  .count-card {
    min-height: 135px;
    padding: 15px;
  }

  .stats-view {
    padding-top: 47px;
  }

  .stats-header h1 {
    font-size: 38px;
  }

  .stats-actions label {
    flex-basis: 100%;
  }

  .stats-actions input {
    flex: 1;
  }

  .stats-summary {
    gap: 9px;
  }

  .stats-summary article {
    display: grid;
    min-height: 91px;
    padding: 16px;
  }

  .chart-panel,
  .details-panel,
  .matrix-panel,
  .admin-panel {
    padding: 17px;
  }

  .matrix-panel .details-heading {
    display: grid;
    gap: 8px;
  }

  .matrix-panel .details-heading strong {
    white-space: normal;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-submit {
    width: 100%;
  }

  .admin-actions {
    width: 100%;
  }

  .chart-heading > div {
    display: grid;
    gap: 4px;
  }

  .bar-row {
    grid-template-columns: 37px 1fr 25px;
    gap: 9px;
  }

  footer {
    gap: 10px;
    flex-direction: column;
  }

  .toast {
    right: 14px;
    bottom: 84px;
    left: 14px;
  }

  .access-gate,
  .modal-backdrop {
    padding: 14px;
  }

  .access-card {
    padding: 28px 20px;
    border-radius: 22px;
  }

  .access-message {
    margin-bottom: 14px;
  }

  .people-manager {
    max-height: calc(100vh - 28px);
    padding: 20px 15px;
    border-radius: 19px;
  }

  .admin-unlock-form,
  .person-editor-form {
    grid-template-columns: 1fr;
  }

  .admin-unlock-form .secondary-button {
    width: 100%;
  }

  .person-editor-actions {
    grid-column: auto;
  }

  .person-editor-actions > button {
    flex: 1;
  }

  .person-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .person-fill-button {
    grid-column: 2;
    justify-self: start;
  }

  .person-delete-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
