:root {
   color-scheme: light;
   --base: #f8fafc;
   --primary: #283247;
   --on-primary: #ffffff;
   --secondary: #3d4a61;
   --tertiary: #b64b36;
   --on-tertiary: #ffffff;
   --neutral: #fbfcfe;
   --border: #d5dce8;
   --surface: var(--neutral);
   --surface-soft: #edf1f7;
   --text: #263044;
   --muted: var(--secondary);
   --line: var(--border);
   --control-line: #7b879c;
   --accent: var(--tertiary);
   --accent-soft: #f6e9e4;
   --accent-text: #9e3f2e;
   --care: #316b59;
   --care-soft: #e5efe9;
   --medicine: #805d26;
   --medicine-soft: #f5efdf;
   --info: #375f85;
   --info-soft: #e9f1fa;
   --success: var(--care);
   --success-bg: var(--care-soft);
   --error: #a53830;
   --focus: var(--tertiary);
   --radius: 12px;
   font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
   color: var(--text);
   background: var(--base);
   font-synthesis: none;
}
:root[data-theme='dark'] {
   color-scheme: dark;
   --base: #020617;
   --primary: #e3e9f3;
   --on-primary: #1c2537;
   --secondary: #aebbd1;
   --tertiary: #e0a18d;
   --on-tertiary: #30201c;
   --neutral: #151c2d;
   --border: #35425a;
   --surface-soft: #202a3e;
   --text: #edf1f8;
   --control-line: #71819d;
   --accent-soft: #3d2c2b;
   --accent-text: #eab9a9;
   --care: #a6cbb9;
   --care-soft: #223a32;
   --medicine: #dbc28c;
   --medicine-soft: #393326;
   --info: #aec9e7;
   --info-soft: #24344c;
   --error: #f2aaa4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { position: relative; isolation: isolate; margin: 0; min-width: 0; min-height: 100dvh; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.6; }
button, input { color: inherit; }
button { transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
a { color: inherit; text-underline-offset: 4px; }
::selection { background: var(--accent); color: var(--on-tertiary); }
input { caret-color: var(--focus); }
* { scrollbar-color: var(--control-line) var(--base); scrollbar-width: thin; }
.page-background { position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(135deg, rgba(248,250,252,1) 0%, rgba(219,234,254,0.7) 30%, rgba(165,180,252,0.5) 60%, rgba(129,140,248,0.6) 100%), radial-gradient(circle at 20% 30%, rgba(255,255,255,0.6) 0%, transparent 40%), radial-gradient(circle at 80% 70%, rgba(199,210,254,0.4) 0%, transparent 50%), radial-gradient(circle at 40% 80%, rgba(224,231,255,0.3) 0%, transparent 60%); }
[data-theme='dark'] .page-background { background-image: radial-gradient(circle 500px at 50% 100px, rgba(139,92,246,0.4), transparent); }
.shell { max-width: 1160px; padding: 0 40px; margin: auto; }
.topbar { height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -0.025em; white-space: nowrap; }
.wordmark span { font-weight: 400; margin-left: 5px; }
.header-actions { display: flex; gap: 22px; align-items: center; }
.header-date { font-size: 13px; color: var(--muted); }
.icon-button { display: inline-flex; justify-content: center; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; width: 44px; height: 44px; flex-shrink: 0; }
.icon-button:hover, .secondary-button:hover, .today-button:hover { background: var(--surface-soft); border-color: var(--control-line); }
svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.program-view { padding: 40px 0 24px; }
.intro h1 { margin: 0; font-size: clamp(24px, 3vw, 30px); font-weight: 650; line-height: 1.25; letter-spacing: -0.025em; text-wrap: balance; }
.intro p { margin: 8px 0 0; max-width: 48ch; color: var(--muted); font-size: 14px; line-height: 1.6; }
.student-form { margin-top: 24px; max-width: 680px; }
.field-label { display: block; font-size: 13px; font-weight: 600; line-height: 1.6; }
.nim-field input { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--control-line); border-radius: 7px; font-size: 16px; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.program-options { min-width: 0; padding: 0; border: 0; margin: 24px 0 0; }
.program-options .program-grid { margin-top: 12px; }
.submit-button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 48px; padding: 0 22px; border: 1px solid var(--primary); border-radius: 7px; background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 600; margin-top: 20px; }
.submit-button > span { display: flex; }
.submit-button:hover { opacity: 0.88; }
.program-grid { margin-top: 24px; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.program-card {
   --program-ink: var(--care);
   --program-soft: var(--care-soft);
   text-align: left;
   color: var(--text);
   background: transparent;
   border: 0;
   border-radius: 0;
   padding: 20px 24px;
   display: grid;
   grid-template-columns: 44px minmax(0, 1fr) 20px;
   grid-template-areas: 'icon content choice';
   align-items: center;
   cursor: pointer;
   gap: 16px;
}
.program-card[data-icon='medicine'] { --program-ink: var(--medicine); --program-soft: var(--medicine-soft); }
.program-card + .program-card { border-top: 1px solid var(--line); }
.program-card:hover { background: var(--surface-soft); }
.program-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -4px; }
.program-card:has(input:checked) { background: var(--surface-soft); }
.program-radio { grid-area: choice; width: 20px; height: 20px; margin: 0; accent-color: var(--tertiary); cursor: pointer; }
.program-radio:focus-visible { outline: none; }
.program-icon { grid-area: icon; width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; background: var(--program-soft); color: var(--program-ink); }
.program-icon svg { width: 26px; height: 26px; stroke-width: 1.6; }
.program-content { grid-area: content; min-width: 0; }
.program-name { display: block; font-size: 20px; line-height: 1.35; font-weight: 650; letter-spacing: -0.02em; }
.program-description { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.selection-note { color: var(--muted); font-size: 13px; line-height: 1.6; display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.note-rule { width: 20px; height: 1px; background: var(--muted); }
.message { margin-top: 30px; color: var(--muted); }
.page-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); margin-top: 16px; padding: 16px 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.back-button { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; border: 0; background: transparent; padding: 0; margin-top: 20px; font-size: 13px; color: var(--muted); }
.back-button:hover { color: var(--text); }
.schedule-heading { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 12px 0 26px; }
.schedule-heading h1 { font-size: clamp(27px, 4vw, 34px); line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.03em; }
.schedule-heading p { font-size: 13px; color: var(--muted); margin: 9px 0 0; }
.secondary-button, .today-button { border: 1px solid var(--line); border-radius: 7px; padding: 0 16px; min-height: 44px; font-size: 13px; background: var(--surface); font-weight: 600; }
#refresh { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
#refresh:hover { opacity: 0.85; }
.workspace { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.toolbar { padding: 17px 28px; border-bottom: 1px solid var(--line); }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 12px; min-width: 0; width: 100%; border: 1px solid var(--control-line); border-radius: 7px; background: var(--surface); }
.search-field > span { color: var(--muted); }
.search-field:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: -2px; }
.search-field input { width: 100%; min-width: 0; min-height: 44px; padding: 0; background: transparent; border: 0; border-radius: 0; font-size: 14px; }
.search-field input:focus, .search-field input:focus-visible { outline: none; box-shadow: none; }
input::placeholder { color: var(--muted); opacity: 1; }
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 28px; }
.calendar-nav h2 { font-size: 20px; letter-spacing: -0.02em; font-weight: 650; margin: 0; }
.calendar-nav p { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.date-actions { display: flex; gap: 7px; align-items: center; }
.date-shortcuts { display: flex; gap: 7px; flex-shrink: 0; }
.date-field { min-width: 0; }
.date-field input { min-height: 44px; border: 1px solid var(--control-line); border-radius: 7px; background: var(--surface); font-size: 13px; padding: 7px 10px; width: 145px; max-width: 100%; }
.week-strip { margin: 0 28px; padding: 4px 4px 10px; display: grid; grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; border-bottom: 1px solid var(--line); }
.day-button { border: 1px solid transparent; border-radius: 7px; background: transparent; padding: 10px 4px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-variant-numeric: tabular-nums; }
.day-button:hover { background: var(--surface-soft); }
.day-button[aria-current='date']:not([aria-pressed='true']) { border-color: var(--care); }
.day-button[aria-pressed='true'] { background: var(--tertiary); color: var(--on-tertiary); }
.day-name { font-size: 12px; }
.day-number { font-size: 22px; font-weight: 650; }
.day-note { font-size: 11px; min-height: 14px; }
.calendar-hint { display: none; margin: 6px 16px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.agenda-header { padding: 30px 28px 0; display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.agenda-header h2 { font-size: 16px; font-weight: 650; margin: 0; }
#meeting-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
#agenda { padding: 5px 28px 14px; }
.meeting { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 20px; padding: 23px 0; }
.meeting + .meeting { border-top: 1px solid var(--line); }
.meeting-time { display: flex; flex-direction: column; gap: 6px; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.meeting-time small { font-size: 12px; color: var(--muted); font-weight: 400; }
.meeting h3 { margin: 0 0 8px; font-size: 17px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.meeting-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.meeting-location[data-online='true'] { color: var(--info); font-weight: 600; }
.meeting-teachers { color: var(--muted); margin: 10px 0 0; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.meeting-state { font-size: 12px; padding: 5px 9px; border-radius: 4px; background: var(--surface-soft); color: var(--muted); height: fit-content; white-space: nowrap; }
.meeting-state[data-state='current'] { background: var(--care-soft); color: var(--care); }
.meeting-state[data-state='scheduled'] { background: var(--medicine-soft); color: var(--medicine); }
.meeting-state[data-state='cancelled'] { background: var(--accent-soft); color: var(--error); }
.workspace-footer { padding: 17px 28px; display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.schedule-status { padding: 48px 24px 32px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }
.schedule-status strong { display: block; color: var(--text); font-size: 19px; font-weight: 650; margin-bottom: 8px; }
.schedule-status[data-state='error'] { color: var(--error); }
.cache-notice { margin: 14px 28px 0; padding: 10px 12px; background: var(--info-soft); color: var(--info); border-radius: 7px; font-size: 12px; line-height: 1.7; }
.schedule-loading { padding: 24px 28px 10px; }
.loading-summary { display: flex; align-items: flex-start; gap: 12px; }
.loading-summary strong { font-size: 15px; font-weight: 650; line-height: 1.5; }
.loading-summary p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.loading-spinner { flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border: 2px solid var(--line); border-top-color: var(--accent-text); border-radius: 50%; animation: loading-spin 900ms linear infinite; }
.skeleton-list { margin-top: 18px; }
.skeleton-meeting { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 20px; padding: 24px 0; }
.skeleton-meeting + .skeleton-meeting { border-top: 1px solid var(--line); }
.skeleton-time, .skeleton-title, .skeleton-detail { display: block; border-radius: 4px; background: var(--control-line); opacity: 0.24; animation: loading-breathe 1.8s ease-in-out infinite; }
.skeleton-time { height: 16px; width: 52px; }
.skeleton-title { height: 16px; width: min(80%, 320px); }
.skeleton-detail { height: 10px; width: min(60%, 240px); margin-top: 16px; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@keyframes loading-breathe { 50% { opacity: 0.44; } }
.retry-button { display: block; margin: 0 auto 30px; }
.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; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 5; padding: 14px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.noscript { padding: 25px; text-align: center; }
@media (max-width: 760px) {
   .shell { padding: 0 22px; }
   .topbar { height: 68px; }
   .header-date { display: none; }
   .program-view { padding-top: 32px; }
   .program-card { padding: 20px; }
   .calendar-nav { align-items: flex-start; flex-direction: column; padding: 22px; }
   .toolbar { padding: 18px 22px; }
   .date-actions { width: 100%; }
   .date-field { flex: 1; }
   .date-field input { width: 100%; }
   .week-strip { margin: 0 22px; }
   .agenda-header { padding: 25px 22px 0; }
   #agenda { padding-left: 22px; padding-right: 22px; }
   .cache-notice { margin-left: 22px; margin-right: 22px; }
   .meeting { grid-template-columns: 80px minmax(0, 1fr); gap: 12px 16px; }
   .meeting-state { grid-column: 2; justify-self: start; }
}
@media (max-width: 520px) {
   .shell { padding: 0 18px; }
   .wordmark { font-size: 19px; }
   .program-view { padding-top: 28px; }
   .program-grid { margin-top: 20px; }
   .program-card {
      grid-template-columns: 40px minmax(0, 1fr) 20px;
      grid-template-areas: 'icon content choice';
      gap: 12px;
      padding: 18px 16px;
   }
   .program-icon { width: 40px; height: 40px; }
   .program-icon svg { width: 24px; height: 24px; }
   .program-name { font-size: 18px; }
   .submit-button { width: 100%; }
   .selection-note { align-items: flex-start; margin-top: 16px; }
   .note-rule { margin-top: 10px; flex-shrink: 0; }
   .page-footer { flex-direction: column; gap: 8px; line-height: 1.6; }
   .schedule-heading { align-items: flex-start; flex-direction: column; gap: 17px; }
   .schedule-heading h1 { font-size: 28px; }
   .schedule-heading p { font-size: 12px; }
   .toolbar { padding: 16px; }
   .calendar-nav { padding: 22px 16px; }
   .today-button { padding: 0 10px; }
   .date-actions { flex-wrap: wrap; }
   .date-shortcuts { width: 100%; }
   .date-shortcuts button { flex: 1; }
   .date-field { flex: 1 1 120px; }
   .date-field input { width: 100%; font-size: 12px; }
   .week-strip { margin: 0 12px; gap: 4px; }
   .day-button { min-height: 80px; }
   .day-number { font-size: 21px; }
   .agenda-header { padding: 24px 16px 0; align-items: flex-start; }
   .agenda-header h2 { font-size: 14px; line-height: 1.5; }
   #agenda { padding-left: 16px; padding-right: 16px; }
   .cache-notice { margin-left: 16px; margin-right: 16px; }
   .schedule-loading { padding: 24px 16px 10px; }
   .skeleton-meeting { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
   .meeting { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 22px 0; }
   .meeting-time { font-size: 14px; }
   .meeting h3 { font-size: 15px; }
   .workspace-footer { padding: 16px; flex-direction: column; gap: 6px; }
}
@media (max-width: 400px) {
   .calendar-hint { display: block; }
}
@media (prefers-reduced-motion: reduce) {
   *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
