:root {
  color-scheme: light;
  --bg: #f4f2eb;
  --surface: #fffdf8;
  --surface-strong: #181b1f;
  --text: #1e2428;
  --muted: #637079;
  --line: #ded8ca;
  --line-strong: #c8bfae;
  --accent: #2f7d6f;
  --accent-strong: #1f5f54;
  --danger: #a6453e;
  --today: #fff4cd;
  --shadow: 0 24px 70px rgba(31, 43, 46, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(47, 125, 111, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 125, 111, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(47, 125, 111, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100svh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: calc(100svh - 44px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background: #fbf8ef;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.brand-block {
  padding-bottom: 6px;
}

.roster-section {
  padding-top: 0;
  border-top: 0;
}

.roster-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: #efe7d8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.roster-tab {
  min-height: 38px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-weight: 900;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.roster-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.roster-tab.is-active {
  color: #ffffff;
  background: var(--surface-strong);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4.7rem);
  line-height: 0.92;
  font-weight: 900;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 800;
}

.muted {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.field-grid,
.stacked-form {
  display: grid;
  gap: 12px;
}

.field-grid {
  grid-template-columns: 1fr 0.78fr;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.panel-section {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title-row,
.schedule-toolbar,
.toolbar-actions {
  display: flex;
  align-items: center;
}

.section-title-row,
.schedule-toolbar {
  justify-content: space-between;
  gap: 16px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  color: #17453e;
  background: rgba(47, 125, 111, 0.12);
  border: 1px solid rgba(47, 125, 111, 0.18);
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 7px;
  font-weight: 800;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  color: #fff;
  background: var(--danger);
}

.ghost-button {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.ghost-button:hover {
  background: #f1eadb;
}

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

.event-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.event-item:last-child {
  border-bottom: 0;
}

.event-item p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.event-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.event-item button {
  min-width: 36px;
  min-height: 36px;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(166, 69, 62, 0.28);
  border-radius: 7px;
  font-weight: 900;
}

.schedule-panel {
  min-width: 0;
  padding: 30px;
  overflow: auto;
  background:
    radial-gradient(circle at 86% 7%, rgba(255, 244, 205, 0.64), transparent 26%),
    var(--surface);
}

.schedule-toolbar {
  margin-bottom: 18px;
}

.schedule-title-block {
  display: grid;
  gap: 10px;
}

.schedule-toolbar h2 {
  font-size: clamp(1.65rem, 4vw, 3.4rem);
  line-height: 1;
}

.schedule-tabs {
  width: min(380px, 100%);
  background: #eee5d5;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.notice {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.notice.error {
  color: var(--danger);
}

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

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(255, 253, 248, 0.9);
}

th,
td {
  padding: 15px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f7f1e3;
  font-size: 0.78rem;
  font-weight: 900;
}

td {
  line-height: 1.35;
}

tbody tr {
  transition: background-color 140ms ease;
}

tbody tr:hover {
  background: #f8f5ec;
}

tbody tr.today-row {
  background: var(--today);
}

.date-cell {
  font-weight: 900;
}

.person-cell {
  font-size: 1.05rem;
  font-weight: 900;
}

.members-cell {
  color: var(--muted);
  font-size: 0.92rem;
}

.empty-state {
  padding: 18px 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: calc(100svh - 20px);
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .schedule-panel {
    padding: 22px 14px 18px;
  }

  .schedule-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .schedule-title-block,
  .schedule-tabs {
    width: 100%;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
    background-size: 34px 34px;
  }

  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .control-panel {
    gap: 18px;
    padding: 20px 16px;
  }

  .brand-block {
    padding-bottom: 0;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.7rem);
    line-height: 1.08;
  }

  .muted {
    margin-top: 10px;
    font-size: 0.94rem;
    line-height: 1.55;
  }

  .roster-tabs {
    gap: 4px;
    padding: 4px;
  }

  .roster-tab {
    min-height: 40px;
    padding: 8px;
  }

  .panel-section {
    gap: 10px;
    padding-top: 15px;
  }

  .chip-list {
    gap: 7px;
  }

  .chip {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 0.84rem;
  }

  .schedule-panel {
    padding: 18px 12px 24px;
    background:
      linear-gradient(180deg, rgba(47, 125, 111, 0.08), transparent 180px),
      var(--surface);
  }

  .schedule-toolbar {
    gap: 14px;
    margin-bottom: 14px;
  }

  .schedule-toolbar h2 {
    font-size: 1.72rem;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    min-height: 40px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .notice {
    min-height: 18px;
    margin-bottom: 8px;
    font-size: 0.84rem;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  table {
    min-width: 0;
    background: transparent;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "date person"
      "weekday members";
    align-items: center;
    column-gap: 12px;
    row-gap: 5px;
    padding: 12px 13px;
    background: rgba(255, 253, 248, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(31, 43, 46, 0.06);
  }

  tbody tr:hover {
    background: rgba(255, 253, 248, 0.94);
  }

  tbody tr.today-row {
    background: var(--today);
    border-color: #e7ce83;
  }

  td {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  .date-cell {
    grid-area: date;
    font-size: 1.05rem;
    line-height: 1.18;
  }

  td:nth-child(2) {
    grid-area: weekday;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
  }

  .person-cell {
    grid-area: person;
    justify-self: end;
    max-width: 7.5em;
    padding: 5px 9px;
    color: #ffffff;
    background: var(--surface-strong);
    border-radius: 7px;
    font-size: 0.98rem;
    line-height: 1.16;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .members-cell {
    grid-area: members;
    justify-self: end;
    max-width: 16em;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: right;
    overflow-wrap: anywhere;
  }
}
