/* Layout: sticky header with tabs, one centered column of cards; team rosters as a wrapping grid. */
:root {
  /* DLS 로고 남색 #103587 이 중심 색 */
  --bg: #f3f5fa;
  --surface: #ffffff;
  --sunk: #e9edf5;
  --ink: #141b2d;
  --muted: #586379;
  --line: #d8deea;
  --accent: #103587;
  --accent-ink: #ffffff;
  --accent-soft: #e2e8f5;
  --hero: #103587;
  --hero-ink: #ffffff;
  --hero-muted: #c3cfee;
  --warn: #9a5a08;
  --warn-soft: #f8ecd8;
  --bad: #a93636;
  --bad-soft: #f6e3e1;
  --team-l: 42%;
  --font-display: "IBM Plex Sans KR", "Noto Sans KR", system-ui, sans-serif;
  --font-body: "Noto Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1120; --surface: #141b2e; --sunk: #10162a; --ink: #e6eaf3; --muted: #9aa4ba; --line: #253049;
    --accent: #93aef2; --accent-ink: #0a1330; --accent-soft: #1b2748; --hero: #17306f; --hero-ink: #ffffff; --hero-muted: #b9c7ec;
    --warn: #e2a85b; --warn-soft: #33281a; --bad: #e88383; --bad-soft: #3a2222; --team-l: 62%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1120; --surface: #141b2e; --sunk: #10162a; --ink: #e6eaf3; --muted: #9aa4ba; --line: #253049;
  --accent: #93aef2; --accent-ink: #0a1330; --accent-soft: #1b2748; --hero: #17306f; --hero-ink: #ffffff; --hero-muted: #b9c7ec;
  --warn: #e2a85b; --warn-soft: #33281a; --bad: #e88383; --bad-soft: #3a2222; --team-l: 62%;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.3; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.wrap { max-width: 960px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 12px 8px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: inherit; text-decoration: none; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: none; }
.brand .bt { display: grid; line-height: 1.15; min-width: 0; }
.brand b { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: .06em; color: var(--accent); }
.brand .bt > span { color: var(--muted); font-size: .74rem; font-style: italic; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.who select { max-width: 52vw; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 8px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main.wrap { padding-block: 20px 64px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.banner { padding: 10px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: .9rem; }

.hero { display: grid; gap: 4px; position: relative; overflow: hidden; background: var(--hero); color: var(--hero-ink); border-color: transparent; padding: 22px 20px; }
.hero::after { content: ""; position: absolute; right: -36px; bottom: -44px; width: 190px; height: 190px; background: url(icons/logo.png) center / contain no-repeat; filter: brightness(0) invert(1); opacity: .09; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow, .hero .muted, .hero .lec .by { color: var(--hero-muted) !important; }
.hero .wk { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1.5px solid rgb(255 255 255 / .35); justify-self: start; padding-right: 24px; }
.hero .lec .area { color: var(--hero); background: var(--hero-ink); }
.hero .wk { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .theme { font-size: 1.05rem; }

.subjects { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.subjects li { display: grid; grid-template-columns: 5.5em 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline; }
.subjects li:first-child { border-top: 0; }
.subjects .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; }
.subjects .s { font-weight: 500; min-width: 0; }
.subjects .p { color: var(--muted); font-size: .88rem; text-align: right; }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice .btn { padding: 14px; font-size: 1rem; }

input[type=text], input[type=date], input[type=url], input[type=number], input[type=search], select, textarea {
  background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { min-height: 96px; resize: vertical; }
label.f { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.form { display: grid; gap: 10px; }
.form .two { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

.stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--sunk); }
.bar i { display: block; }
.bar .ok { background: var(--accent); }
.bar .no { background: var(--bad); opacity: .7; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.no { background: var(--bad-soft); color: var(--bad); }
.pill.none { background: var(--sunk); color: var(--muted); }
.pill.staff { background: var(--warn-soft); color: var(--warn); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: .88rem; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.team { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.team-h { display: flex; align-items: center; gap: 8px; }
.team-h .dot { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--h) 45% var(--team-l)); flex: none; }
.team-h h3 { margin-right: auto; }
.team-h .n { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.names { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.names .me { color: var(--accent); font-weight: 700; }
.sub-l { font-size: .75rem; color: var(--muted); letter-spacing: .04em; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: .8rem; border-top: 0; }
td input, td select { padding: 4px 8px; }

.weeks { display: grid; gap: 12px; }
.week { display: grid; grid-template-columns: 76px 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.week.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.week.past { opacity: .62; }
.week .no { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.week .no small { display: block; font-size: .78rem; font-weight: 500; color: var(--muted); margin-top: 6px; }
.week > div { min-width: 0; }
.hw-line { margin-top: 8px; font-size: .88rem; color: var(--muted); }

.notice { white-space: pre-wrap; background: var(--sunk); border-radius: 8px; padding: 12px 14px; }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--ink); font-size: 1.05rem; }
details > summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
.sub-body { white-space: pre-wrap; margin-top: 6px; }
a { color: var(--accent); word-break: break-all; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 520px) {
  .hero .wk { font-size: 1.6rem; }
  .week { grid-template-columns: 1fr; gap: 8px; }
  .subjects li { grid-template-columns: 4.5em 1fr; }
  .subjects .p { grid-column: 2; text-align: left; margin-top: -6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- PWA 추가 ---- */
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-tap-highlight-color: transparent; }
#topBanners:empty { display: none; }
#topBanners { padding-block: 12px 0; display: grid; gap: 8px; }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.banner .row { margin-top: 6px; }
.join { max-width: 420px; margin: 24px auto 0; width: 100%; }
.join h2 { font-size: 1.4rem; }
.join input { font-size: 1.1rem; letter-spacing: .08em; }
.foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; padding-top: 8px; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; text-decoration: underline; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--sunk); padding: 2px 8px; border-radius: 6px; }

/* ---- 강의 · 과제 ---- */
.lec { display: grid; gap: 4px; }
.lec .area { justify-self: start; font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 1px 9px; border-radius: 999px; }
.lec .topic { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; line-height: 1.4; }
.lec .by { color: var(--muted); font-size: .9rem; }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; }
.tasks li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.tasks li:first-child { border-top: 0; }
.tasks .tk { margin-right: auto; min-width: 0; }
.tasks .tk small { display: block; color: var(--muted); font-size: .8rem; }
.qnum { display: grid; grid-template-columns: 1.6em 1fr; gap: 8px; align-items: start; }
.qnum b { font-family: var(--font-display); color: var(--accent); padding-top: 8px; font-variant-numeric: tabular-nums; }
.qnum textarea { min-height: 64px; }
.filepick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; background: var(--sunk); }
.filepick input[type=file] { max-width: 100%; font-size: .85rem; }
.filepick .fname { font-size: .88rem; word-break: break-all; }
.week .tag { display: inline-block; font-size: .72rem; color: var(--muted); margin-right: 6px; }

/* ---- 프로필 카드 (조별 명단 · 교무위원) ---- */
:root { --av-l: 90%; --av-ink-l: 34%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --av-l: 24%; --av-ink-l: 78%; } }
:root[data-theme="dark"] { --av-l: 24%; --av-ink-l: 78%; }
.team-card .team-h .dot { background: hsl(var(--h) 45% var(--team-l)); }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 16px 12px; }
.pc { display: grid; gap: 6px; align-content: start; min-width: 0; }
.pc .av { aspect-ratio: 9 / 10; border-radius: 8px; overflow: hidden; background: hsl(222 38% var(--av-l)); display: grid; place-items: center; }
.pc .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc .av span { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: hsl(222 62% var(--av-ink-l)); }
.pc .nm { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.pc .nm em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .8rem; }
.pc small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.4; overflow-wrap: anywhere; }
.pc small b { color: var(--accent); font-weight: 600; }
.pc.me .nm { color: var(--accent); }
.pc.me .av { box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 400px) { .people { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; } .pc .av span { font-size: 1.6rem; } }

/* ---- 교무위원 조직도 ---- */
.org { display: grid; gap: 16px; align-items: start; }
.org.has-side { grid-template-columns: minmax(0, 1fr) minmax(150px, 240px); }
.org-main { display: grid; gap: 0; justify-items: stretch; min-width: 0; }
.org-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; display: grid; gap: 12px; min-width: 0; }
.org-box.lead { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); justify-self: center; width: min(100%, 420px); }
.org-box.side { border-style: dashed; }
.org-l { font-family: var(--font-display); font-weight: 700; font-size: .95rem; display: flex; justify-content: center; gap: 8px; align-items: baseline; }
.org-l span { font-family: var(--font-body); font-weight: 400; font-size: .78rem; color: var(--muted); }
.org-line { width: 2px; height: 22px; background: var(--line); justify-self: center; }
.org-lower { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.org-lower > :only-child { grid-column: 1 / -1; }
.org .people { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 12px; }
.org .pc { width: 112px; }
.org .org-box.narrow .people { flex-direction: column; align-items: center; }
@media (max-width: 640px) {
  .org.has-side { grid-template-columns: 1fr; }
  .org-lower { grid-template-columns: 1fr; }
  .org .org-box.narrow .people { flex-direction: row; }
  .org .pc { width: calc((100% - 24px) / 3); max-width: 112px; }
}
.join-logo { width: 120px; height: 120px; justify-self: center; border-radius: 50%; background: #fff; margin-bottom: 4px; }
.join { text-align: center; }
.join .form { text-align: left; }
