:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #20211f;
  --muted: #70716c;
  --line: #e2e3de;
  --green: #176b55;
  --green-soft: #e9f3ee;
  --rust: #a54532;
  --rust-soft: #f7ece8;
  --amber: #805b12;
  --amber-soft: #fff3d6;
  --shadow: 0 4px 18px rgba(29, 34, 31, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); }

body { font-size: 15px; line-height: 1.45; letter-spacing: 0; }

button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.view {
  width: min(100%, 720px);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { display: block; margin-bottom: 4px; color: var(--green); font-size: 13px; font-weight: 700; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 750; }
h2 { font-size: 20px; line-height: 1.3; }
.subtitle { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.bell-button { font-size: 19px; }

.summary-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-item { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 88px; padding: 20px 8px; }
.summary-item + .summary-item { border-left: 1px solid var(--line); }
.summary-value { font-size: 34px; line-height: 1; font-weight: 760; }
.summary-label { color: var(--muted); font-size: 12px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-heading h2 { font-size: 17px; }

.course-list { display: grid; gap: 12px; }
.course-card { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.course-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.course-time { font-size: 21px; font-weight: 750; }
.type-label { margin-left: 8px; color: var(--amber); font-size: 12px; font-weight: 650; }
.course-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.course-group { color: var(--text); font-size: 17px; font-weight: 700; }
.course-actions { display: grid; grid-template-columns: minmax(0, 1fr) 82px; gap: 10px; margin-top: 18px; }

.status {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f0f1ed;
  color: #60615c;
  font-size: 12px;
  text-align: center;
}
.status.completed { background: var(--green-soft); color: var(--green); }
.status.cancelled { background: var(--rust-soft); color: var(--rust); }
.status.rescheduled { background: var(--amber-soft); color: var(--amber); }

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
}
.button.primary { background: var(--green); color: #fff; }
.button.secondary { border-color: #cfe0d8; background: var(--green-soft); color: #145e4a; }
.button.danger { border-color: #efd1ca; background: var(--rust-soft); color: var(--rust); }
.button.ghost { background: transparent; color: var(--green); }
.button.full-width { width: 100%; margin-top: 14px; }
.button.small { min-height: 38px; padding: 0 13px; font-size: 13px; }

.empty-state { padding: 46px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--text); }

.week-control { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 22px 0 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.week-arrow { width: 44px; height: 58px; padding: 0; border: 0; background: transparent; font-size: 30px; }
.week-label { text-align: center; font-size: 13px; font-weight: 700; }
.week-label button { display: block; width: 100%; margin-top: 2px; padding: 0; border: 0; background: transparent; color: var(--green); font-size: 11px; }

.week-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.day-section { padding: 16px; border-bottom: 1px solid var(--line); }
.day-section:last-child { border-bottom: 0; }
.day-section.today { box-shadow: inset 4px 0 var(--green); }
.day-heading { display: flex; align-items: baseline; gap: 8px; }
.weekday { font-size: 16px; font-weight: 750; }
.day-date { color: var(--muted); font-size: 12px; }
.today-mark { margin-left: auto; color: var(--green); font-size: 12px; font-weight: 700; }
.schedule-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 8px 0; border: 0; border-top: 1px solid #eeeeea; background: transparent; color: inherit; text-align: left; }
.schedule-row:first-child { margin-top: 10px; }
.schedule-time { font-size: 13px; font-weight: 700; }
.schedule-time small, .schedule-credit { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.schedule-group { font-size: 15px; font-weight: 700; }
.no-course { margin-top: 8px; color: #9b9c97; font-size: 12px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 22px 0 14px; padding: 4px; border-radius: 8px; background: #e9eae5; }
.segment { min-height: 38px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; }
.segment.active { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 2px 8px rgba(29,34,31,.06); }

.record-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.record-row { display: grid; grid-template-columns: 102px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 76px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; }
.record-row:last-child { border-bottom: 0; }
.record-date, .record-group { font-size: 13px; font-weight: 700; }
.record-date small, .record-credit { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }

.total-panel { margin-top: 24px; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.total-panel span { display: block; color: var(--muted); font-size: 12px; }
.total-number { margin: 2px 0; font-size: 64px; line-height: 1.15; font-weight: 780; }
.total-number small { display: inline; margin-left: 8px; color: var(--text); font-size: 15px; font-weight: 500; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.metric { min-height: 104px; padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric:nth-child(2n) { border-right: 0; }
.metric:nth-child(n+3) { border-bottom: 0; }
.metric strong { display: block; font-size: 30px; }
.metric span { color: var(--muted); font-size: 12px; }
.group-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.group-row { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.group-row:last-child { border-bottom: 0; }
.group-row strong { font-size: 18px; }
.group-row small { margin-left: 4px; color: var(--muted); }
.info-note { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.bottom-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(66px + env(safe-area-inset-bottom)); padding: 5px max(8px, calc((100% - 720px) / 2)) env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; padding: 0; border: 0; background: transparent; color: #777873; font-size: 11px; }
.nav-mark { font-size: 15px; font-weight: 750; }
.nav-item.active { color: var(--green); }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(20, 24, 22, .42); }
.form-dialog, .sheet-dialog { width: min(calc(100% - 24px), 520px); max-height: calc(100dvh - 32px); margin: auto; padding: 20px; border: 0; border-radius: 8px; background: var(--bg); box-shadow: 0 16px 50px rgba(20,24,22,.25); }
.sheet-dialog { margin-bottom: max(12px, env(safe-area-inset-bottom)); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-header p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.form-field { display: grid; grid-template-columns: 106px minmax(0, 1fr); align-items: center; min-height: 58px; padding: 0 12px; border: 1px solid var(--line); border-bottom: 0; background: #fff; }
.form-field:first-of-type { border-radius: 8px 8px 0 0; }
.form-field:nth-of-type(5) { border-bottom: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.form-field span { color: #555651; font-size: 13px; }
.form-field input, .form-field select { min-width: 0; width: 100%; height: 56px; border: 0; outline: 0; background: transparent; color: var(--text); text-align: right; font-weight: 650; }
.settings-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.setting-row { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
input[role="switch"] { width: 44px; height: 24px; accent-color: var(--green); }
.dialog-note { margin-top: 12px; color: var(--muted); font-size: 11px; text-align: center; }
.action-title { margin-bottom: 12px; font-size: 15px; font-weight: 750; }
.action-list { display: grid; gap: 8px; }

.toast { position: fixed; z-index: 50; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 16px; width: fit-content; max-width: calc(100% - 32px); margin: auto; padding: 10px 16px; border-radius: 8px; background: #252a27; color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 760px) {
  .view { padding: 36px 24px 48px; }
  .app-shell { border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
}

@media (max-width: 370px) {
  .view { padding-right: 12px; padding-left: 12px; }
  h1 { font-size: 23px; }
  .summary-value { font-size: 30px; }
  .schedule-row { grid-template-columns: 82px minmax(0, 1fr) auto; }
  .record-row { grid-template-columns: 92px minmax(0, 1fr) auto; }
}
