:root {
  --forest: #173e34;
  --forest-2: #245848;
  --mint: #dcefe6;
  --mint-soft: #f1f7f4;
  --cream: #fbfaf5;
  --paper: #ffffff;
  --ink: #18312b;
  --muted: #697b75;
  --line: #dfe8e3;
  --orange: #e9763f;
  --orange-soft: #fff0e7;
  --yellow: #e7b84f;
  --shadow: 0 18px 48px rgba(31, 61, 52, 0.10);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(220, 239, 230, .8), transparent 28rem),
    linear-gradient(180deg, var(--cream) 0%, #f6f8f4 100%);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.site-header {
  width: min(1120px, calc(100% - 36px));
  height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: white; background: var(--forest); }
.today { color: var(--muted); font-size: 14px; }

main { width: min(1120px, calc(100% - 36px)); margin: 30px auto 70px; }
.student-shell { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); gap: 24px; align-items: start; }
.welcome-card, .notice-panel, .panel, .login-card { background: rgba(255,255,255,.9); border: 1px solid rgba(223,232,227,.9); box-shadow: var(--shadow); border-radius: var(--radius); }
.welcome-card { padding: clamp(28px, 5vw, 56px); }
.eyebrow { margin: 0 0 8px; color: var(--forest-2); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 50px); line-height: 1.12; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.lead { max-width: 570px; margin: 16px 0 32px; color: var(--muted); line-height: 1.75; }

.class-day-banner { margin: -8px 0 26px; padding: 15px; display: flex; align-items: center; gap: 13px; background: var(--mint-soft); border: 1px solid #cfe2d8; border-radius: 15px; }
.class-day-banner.no-class-day { background: #fff8e7; border-color: #eddfb8; }
.class-day-icon { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--forest-2); border-radius: 13px; font-size: 12px; font-weight: 850; }
.no-class-day .class-day-icon { color: #654b12; background: #f2d889; }
.class-day-banner strong { display: block; margin-bottom: 3px; font-size: 15px; }
.class-day-banner p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.attendance-form > label, .stack-form label, .login-form label { display: block; margin: 0 0 9px; font-weight: 750; font-size: 14px; }
select, input, textarea { width: 100%; color: var(--ink); background: white; border: 1px solid #cad8d1; border-radius: 13px; outline: none; }
select, input { height: 50px; padding: 0 15px; }
textarea { padding: 13px 15px; resize: vertical; line-height: 1.55; }
select:focus, input:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36, 88, 72, .12); }
select optgroup { font-weight: 800; }

.current-status { margin-top: 11px; padding: 13px 15px; display: flex; align-items: center; gap: 11px; background: #f5f7f6; border: 1px solid var(--line); border-radius: 13px; }
.current-status-dot { flex: 0 0 auto; width: 10px; height: 10px; background: #98a7a1; border-radius: 50%; box-shadow: 0 0 0 5px rgba(152, 167, 161, .14); }
.current-status small { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.current-status strong { display: block; font-size: 14px; }
.current-status.status-present { color: var(--forest); background: var(--mint-soft); border-color: #c8dfd4; }
.current-status.status-present .current-status-dot { background: var(--forest-2); box-shadow: 0 0 0 5px rgba(36, 88, 72, .12); }
.current-status.status-absent { color: #9f482c; background: var(--orange-soft); border-color: #f2d1c0; }
.current-status.status-absent .current-status-dot { background: var(--orange); box-shadow: 0 0 0 5px rgba(233, 118, 63, .12); }
.current-status.status-pending { color: #806018; background: #fff8e7; border-color: #eddfb8; }
.current-status.status-pending .current-status-dot { background: var(--yellow); box-shadow: 0 0 0 5px rgba(231, 184, 79, .14); }

fieldset { margin: 26px 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; font-weight: 750; font-size: 14px; }
.status-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.status-card { position: relative; min-height: 148px; padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; border: 1.5px solid var(--line); border-radius: 18px; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.status-card:hover { transform: translateY(-2px); }
.status-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.status-card:has(input:focus-visible) { outline: 3px solid rgba(36, 88, 72, .3); outline-offset: 2px; }
.present-card:has(input:checked) { border-color: var(--forest-2); background: var(--mint-soft); }
.absent-card:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.status-icon { position: absolute; top: 17px; right: 17px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 18px; font-weight: 900; background: var(--forest-2); }
.absent-card .status-icon { background: var(--orange); }
.status-card strong { margin-bottom: 5px; font-size: 17px; }
.status-card small { color: var(--muted); }
.optional-label { display: inline-block; margin-left: 4px; padding: 2px 7px; color: var(--muted); background: #edf1ef; border-radius: 100px; font-size: 12px; font-weight: 700; }
.field-help { margin: 7px 0 15px; color: var(--muted); font-size: 12px; }

.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 14px; color: white; background: var(--forest); font-weight: 800; box-shadow: 0 8px 20px rgba(23, 62, 52, .18); transition: background .15s ease, transform .15s ease; }
.primary-button:hover { background: var(--forest-2); transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }

.notice-panel { padding: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.notice-count { min-width: 29px; height: 29px; padding: 0 9px; display: grid; place-items: center; color: white; background: var(--orange); border-radius: 100px; font-size: 13px; font-weight: 800; }
.notice-list { display: grid; gap: 10px; }
.notice-item { position: relative; padding: 17px 17px 17px 20px; background: var(--mint-soft); border-radius: 15px; }
.notice-item::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 9px; background: var(--forest-2); }
.notice-item p { margin: 0 0 10px; line-height: 1.6; white-space: pre-line; }
.notice-item time, .admin-notices time { color: var(--muted); font-size: 12px; }
.notice-empty, .empty-state { padding: 28px 18px; color: var(--muted); text-align: center; background: #f7f9f7; border: 1px dashed #cedad4; border-radius: 15px; }
.empty-state { margin-top: 30px; }
.empty-state span { display: block; font-size: 30px; margin-bottom: 10px; }
.empty-state strong { display: block; color: var(--ink); }
.empty-state p { margin: 7px 0 0; line-height: 1.6; }

.flash-stack { position: fixed; z-index: 10; top: 76px; left: 50%; width: min(520px, calc(100% - 30px)); transform: translateX(-50%); }
.flash { padding: 13px 17px; border-radius: 12px; color: white; box-shadow: 0 10px 30px rgba(0,0,0,.14); font-size: 14px; font-weight: 700; }
.flash-success { background: var(--forest); }
.flash-error { background: #a83d35; }

footer { width: min(1120px, calc(100% - 36px)); margin: 0 auto 26px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
footer a { text-underline-offset: 3px; }

.login-shell { min-height: 62vh; display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 38px; }
.login-card h1 { font-size: 34px; }
.login-card .lead { margin-bottom: 24px; }
.login-form { display: grid; }
.login-form .primary-button { margin-top: 14px; }
.back-link { display: inline-block; margin-top: 24px; color: var(--muted); font-size: 13px; text-decoration: none; }

.admin-shell { display: grid; gap: 24px; }
.admin-title-row { display: flex; align-items: end; justify-content: space-between; }
.admin-title-row h1 { font-size: clamp(32px, 5vw, 44px); }
.text-button { padding: 9px 13px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 10px; }
.admin-class-banner { margin-top: -8px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: white; background: var(--forest-2); border-radius: 14px; }
.admin-class-summary { display: grid; gap: 4px; }
.admin-class-banner span { color: rgba(255,255,255,.78); font-size: 13px; }
.admin-class-banner.no-class-day { color: #594416; background: #f2d889; }
.admin-class-banner.no-class-day span { color: #765d24; }
.reset-all-button { min-height: 38px; padding: 0 13px; color: white; white-space: nowrap; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35); border-radius: 10px; font-size: 13px; font-weight: 800; }
.reset-all-button:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.reset-all-button:disabled { cursor: default; opacity: .45; }
.no-class-day .reset-all-button { color: #684d11; background: rgba(255,255,255,.25); border-color: rgba(104,77,17,.25); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 20px; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; background: white; border: 1px solid var(--line); border-radius: 17px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat strong { font-size: 34px; line-height: 1; }
.stat-present { background: var(--forest); color: white; border-color: var(--forest); }
.stat-present span { color: rgba(255,255,255,.75); }
.stat-absent strong { color: var(--orange); }
.stat-pending strong { color: #9b741c; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 20px; align-items: start; }
.admin-side { display: grid; gap: 20px; }
.panel { padding: 26px; }
.student-list { display: grid; gap: 6px; }
.student-response { border-bottom: 1px solid #edf1ef; }
.student-response:last-child { border-bottom: 0; }
.student-row { min-height: 58px; padding: 9px 12px; display: grid; grid-template-columns: 38px 1fr auto auto; gap: 11px; align-items: center; border-bottom: 1px solid #edf1ef; }
.student-response .student-row { border-bottom: 0; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; color: var(--forest); background: var(--mint); border-radius: 12px; font-weight: 850; }
.student-identity { display: grid; gap: 2px; }
.student-identity span { color: var(--muted); font-size: 12px; }
.badge { padding: 6px 10px; border-radius: 100px; font-size: 12px; font-weight: 800; }
.badge-present { color: var(--forest); background: var(--mint); }
.badge-absent { color: #a84429; background: var(--orange-soft); }
.badge-pending { color: #8a691b; background: #fff6da; }
.updated-time { color: var(--muted); font-size: 12px; text-align: right; }
.response-actions { min-width: 47px; display: grid; justify-items: end; gap: 2px; }
.response-actions form { margin: 0; }
.reset-link { padding: 2px 0; color: #a83d35; background: transparent; border: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.student-note { margin: -3px 12px 10px 61px; padding: 10px 12px; background: #f7f9f7; border-radius: 10px; }
.student-note span { display: block; margin-bottom: 4px; color: var(--forest-2); font-size: 12px; font-weight: 800; }
.student-note p { margin: 0; color: #42564f; font-size: 13px; line-height: 1.55; white-space: pre-line; }
.other-class-list { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.other-class-list summary { padding: 8px 4px; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 750; }
.other-class-list summary span { margin-left: 5px; padding: 3px 7px; background: #edf1ef; border-radius: 100px; font-size: 12px; }
.other-class-list .student-list { margin-top: 8px; }
.stack-form { display: grid; }
.stack-form .primary-button { margin-top: 11px; }
.admin-notices { margin-top: 22px; display: grid; gap: 9px; }
.admin-notices article { padding: 13px 14px; background: #f7f9f7; border-radius: 12px; }
.admin-notices p { margin: 0 0 9px; white-space: pre-line; line-height: 1.55; font-size: 14px; }
.admin-notices article > div { display: flex; align-items: center; justify-content: space-between; }
.admin-notices form { margin: 0; }
.danger-link { padding: 3px 5px; color: #a83d35; background: transparent; border: 0; font-size: 12px; }
.add-student-form { display: grid; grid-template-columns: minmax(100px, 1fr) 105px auto; gap: 8px; }
.add-student-form button { min-width: 64px; color: white; background: var(--forest); border: 0; border-radius: 12px; font-weight: 750; }
.roster-list { margin-top: 17px; display: grid; gap: 6px; }
.roster-card { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; padding: 7px 0; border-bottom: 1px solid #edf1ef; }
.roster-card.inactive { opacity: .5; }
.edit-student-form { display: grid; grid-template-columns: minmax(92px, 1fr) 96px auto; gap: 6px; }
.edit-student-form input, .edit-student-form select { height: 38px; padding: 0 9px; border-radius: 9px; font-size: 13px; }
.small-button { padding: 6px 9px; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.save-button { height: 38px; color: var(--forest); background: var(--mint-soft); border-color: #cfe2d8; font-weight: 800; }
.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: 820px) {
  main { margin-top: 12px; }
  .student-shell, .admin-grid { grid-template-columns: 1fr; }
  .notice-panel { order: -1; }
  .admin-side { order: -1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .site-header { height: 68px; }
  .today { font-size: 12px; }
  .student-shell { gap: 14px; }
  .welcome-card, .notice-panel, .panel, .login-card { border-radius: 18px; }
  .welcome-card { padding: 26px 20px; }
  .notice-panel, .panel, .login-card { padding: 22px 18px; }
  h1 { font-size: 33px; }
  .status-options { grid-template-columns: 1fr; }
  .status-card { min-height: 112px; }
  .admin-title-row { align-items: start; }
  .admin-class-banner { align-items: stretch; flex-direction: column; gap: 10px; }
  .admin-class-banner form { align-self: flex-start; }
  .student-row { grid-template-columns: 36px 1fr auto; }
  .updated-time { display: none; }
  .student-note { margin-left: 56px; }
  .add-student-form { grid-template-columns: 1fr 100px; }
  .add-student-form button { grid-column: 1 / -1; height: 44px; }
  .roster-card { grid-template-columns: 1fr; }
  .roster-card > form:last-child { justify-self: end; }
}

@media (max-width: 390px) {
  .edit-student-form { grid-template-columns: 1fr 94px; }
  .edit-student-form .save-button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
