/* 지큐 — GQMATH orange, quiet surfaces, daily learning and teaching. */
:root {
  --chrome: #111111;
  --chrome-2: #242424;
  --chrome-text: #f2f3f5;
  --bg: #f5f5f4;
  --panel: #f7f7f5;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #596170;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --accent: #ff6a00;          /* GQMATH orange */
  --accent-soft: #fff1e8;
  --accent-text: #171717;
  --ok: #15804d;
  --ok-bg: #e7f8ef;
  --err: #d92d20;
  --err-bg: #fdecec;
  --blue: #2e6be6;
  --accent-ink: #a33d00;
  --focus: #1859b8;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --font-small: 13px;
  --font-body: 15px;
  --font-title: 26px;
  --radius-sm: 8px;
  --radius-control: 10px;
  --radius: 16px;
  --shadow-menu: 0 8px 24px #10182826;
  --shadow: 0 2px 8px rgba(16, 24, 40, .035);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--font-body)/1.55 "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
h1 { font-size: var(--font-title); font-weight: 800; margin: 0; letter-spacing: -0.03em; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: var(--font-small); }
.center { text-align: center; }
.pad { padding: 12px 16px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.danger { color: var(--err); }
.pre { white-space: pre-wrap; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.hint::before { content: "ⓘ "; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-control); padding: 9px 12px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent-ink); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 0; }
.field.compact { gap: 0; }
.field.compact > span { font-size: 12px; }
.field.compact input, .field.compact select { border: 0; padding: 2px 0; min-height: 28px; background: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; gap: var(--space-2); align-items: center; font-size: 14px; }
.small-input { width: 110px !important; min-height: 32px !important; padding: 4px 8px !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-control);
  padding: 8px 14px; min-height: 40px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--text); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent-ink); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--chrome); border-color: var(--chrome); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: var(--font-small); border-radius: var(--radius-sm); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.round { width: 44px; height: 44px; border-radius: 50%; padding: 0; background: var(--line); border: 0; font-size: 18px; }
.btn.danger-outline { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); background: transparent; }
.icon-btn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn.danger:hover { color: var(--err); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.inline-form { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.inline-form.card { align-items: flex-end; }
.search { margin-bottom: 8px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--text); white-space: nowrap; vertical-align: middle; }
.badge.dark { background: rgba(20, 22, 26, .78); color: #fff; }
.badge.light { background: rgba(255,255,255,.85); color: #16181d; }
.badge.red { background: var(--err); color: #fff; }
.badge.green { background: var(--ok); color: #fff; }
.badge.blue { background: var(--blue); color: #fff; }
.badge.st-재원 { background: var(--ok-bg); color: var(--ok); }
.badge.st-휴원 { background: #fff4d6; color: #a15c00; }
.badge.st-퇴원 { background: var(--line); color: var(--muted); }
.badge.s-제출\ 완료, .badge.s-채점\ 완료 { background: var(--ok-bg); color: var(--ok); }
.badge.s-확정 { background: var(--ok); color: #fff; }
.badge.s-미제출 { background: var(--err-bg); color: var(--err); }
.badge.s-응시\ 중 { background: #e8efff; color: var(--blue); }

/* ---------- staff chrome ---------- */
.topnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; height: 60px; padding: 0 24px; background: var(--chrome); color: var(--chrome-text); }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: 20px; color: #fff; letter-spacing: -0.03em; }
.brand img { width: 30px; height: 30px; border-radius: var(--radius-sm); background: #fff; padding: 2px; }
.brand:hover { color: #fff; }
.menu { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.menu a { padding: 8px 14px; border-radius: var(--radius-control); color: #c7cbd2; font-weight: 600; white-space: nowrap; }
.menu a:hover { color: #fff; background: var(--chrome-2); }
.menu a.on { color: #fff; background: var(--chrome-2); }
.tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tool { color: #c7cbd2; font-size: var(--font-small); border: 1px solid #3a3f48; padding: 6px 12px; border-radius: var(--radius-control); white-space: nowrap; }
.tool:hover { color: #fff; border-color: #6b7280; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; width: 36px; height: 36px; border-radius: var(--radius-control); border: 1px solid #3a3f48; display: grid; place-items: center; cursor: pointer; font-weight: 700; color: #fff; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .drop { position: absolute; right: 0; top: 44px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; min-width: 200px; display: flex; flex-direction: column; gap: var(--space-2); z-index: 30; }
.usermenu .drop a, .usermenu .drop .linkbtn { color: var(--text); text-decoration: none; font-size: 14px; text-align: left; }

.page { padding: 28px 32px 80px; max-width: 1400px; margin: 0 auto; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 700; flex: none; background: var(--surface); }
.with-side { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; }
.side-title { font-weight: 800; font-size: 18px; margin: 0 6px 14px; }
.class-switch { margin-bottom: 14px; font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: var(--radius-control); color: var(--muted); font-weight: 600; }
.side-nav a i { font-style: normal; width: 20px; text-align: center; }
.side-nav a.on { background: var(--bg); color: var(--text); }
.side-nav a:hover { color: var(--text); }
.side-meta { margin: 18px 8px 0; line-height: 1.7; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card + .card, .card + section, section + .card, form + .card, .card + form { margin-top: 16px; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.table-card { padding: 0; overflow: hidden; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.two-col.wide-right { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
.two-col > .card + .card, .two-col > form + .card, .two-col > .card + form, .two-col > * { margin-top: 0; }
.kv { display: grid; grid-template-columns: 80px 1fr; gap: 6px 12px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.kv-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; padding: 4px 0; }
.kv-line > span { color: var(--muted); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-top: 16px; }
.alert { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 8px 0 14px; }
.alert.err { background: var(--err-bg); color: var(--err); }

/* filters + status bar (학생 현황) */
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-3); margin-bottom: 16px; }
.filters { display: flex; align-items: center; gap: 0; padding: 10px 12px 10px 18px; }
.filters .field { padding: 0 14px; border-right: 1px solid var(--line); flex: 0 1 180px; }
.filters .field:first-of-type { padding-left: 0; }
.filters .field.grow { flex: 1 1 200px; border-right: 0; }
.statusbar { padding: 12px 16px; display: flex; flex-direction: column; gap: var(--space-2); justify-content: center; }
.legend { display: flex; gap: 14px; font-size: 12.5px; font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--line-2); margin-right: 4px; vertical-align: -1px; }
.dot.on { background: var(--ok); }
.bars { display: flex; gap: 3px; height: 28px; }
.bars i { flex: 1; border-radius: 4px; background: var(--line); max-width: 14px; }
.bars i.on { background: var(--ok); }
.toggle { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 600; color: var(--text); }
.toggle span { width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: .2s; }
.toggle span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; }
.toggle.on span { background: var(--accent); }
.toggle.on span::after { left: 16px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: var(--font-small); font-weight: 600; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
table.grid td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover, table.grid tr[data-href]:hover { background: var(--panel); cursor: pointer; }
table.grid.compact td, table.grid.compact th { padding: 8px 10px; }
table.grid td.chk, table.grid th.chk { width: 40px; }
table.grid tr.dim td { opacity: .55; }
table.grid td.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
table.grid .ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid tr.ok td:first-child { box-shadow: inset 3px 0 var(--ok); }
table.grid tr.bad td:first-child { box-shadow: inset 3px 0 var(--err); }
.num { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: #e8efff; color: var(--blue); font-size: 10px; font-weight: 700; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.table-foot .actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.table-foot select { width: auto; min-height: 40px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span { display: inline-flex; gap: 4px; align-items: center; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 600; background: var(--surface); }
.chip-check input:checked + span { background: var(--chrome); color: #fff; border-color: var(--chrome); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-control); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.seg input:checked + span { background: var(--chrome); color: #fff; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--text); }
.count-tabs a i { font-style: normal; font-size: 11px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; margin-left: 3px; color: var(--muted); }
.count-tabs a.on i { border-color: var(--text); color: var(--text); }
.tabs-inline { display: flex; gap: 4px; background: var(--line); padding: 3px; border-radius: var(--radius-control); }
.tabs-inline a { padding: 5px 12px; border-radius: var(--radius-sm); font-size: var(--font-small); font-weight: 600; color: var(--muted); }
.tabs-inline a.on { background: var(--surface); color: var(--text); }

/* card grids: classes, lectures, homework, templates */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 18px; }
.class-card, .lec-card, .hw-card, .tpl-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; color: var(--text); transition: border-color .15s, box-shadow .15s; }
a.class-card:hover, a.lec-card:hover, a.hw-card:hover, a.tpl-card:hover { border-color: var(--line-2); box-shadow: 0 4px 14px rgba(16,24,40,.07); color: var(--text); }
.cover { min-height: 120px; padding: 14px 16px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; color: #fff; position: relative;
  background: linear-gradient(135deg, var(--c1), var(--c2)); }
.cover b { font-size: 19px; font-weight: 800; line-height: 1.3; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.cover .badge + .badge { position: absolute; top: 14px; right: 14px; }
.color-orange { --c1: #FF6600; --c2: #bf4800; }
.color-blue { --c1: #6aa5ff; --c2: #2e6be6; }
.color-green { --c1: #4fd8a0; --c2: #0e9f6e; }
.color-purple { --c1: #b39cff; --c2: #6d4ae0; }
.color-pink { --c1: #ff9cc7; --c2: #e0447f; }
.color-gray { --c1: #9aa3af; --c2: #4b5563; }
.class-card .body, .lec-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.stats3 span { background: var(--panel); border-radius: var(--radius-control); padding: 6px; text-align: center; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; }
.stats3 b { font-size: 17px; color: var(--text); }
.class-card.new, .lec-card.new, .tpl-card.new { padding: 18px; gap: 10px; border-style: dashed; box-shadow: none; background: transparent; }
.lec-card.off { opacity: .6; }
.tpl-card { padding: 18px; gap: var(--space-2); }
.tpl-card b { font-size: 17px; }
.tpl-card .badge.light { background: var(--accent-soft); color: var(--accent-ink); align-self: flex-start; }
.hw-card { padding: 10px; gap: var(--space-2); }
.hw-card .cover { border-radius: 14px; min-height: 150px; }
.hw-card .cover .small { opacity: .9; }
.hw-box { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hw-box div:first-child { display: flex; flex-direction: column; min-width: 0; }
.hw-box span { font-size: 12px; color: var(--muted); font-weight: 600; }
.hw-box b { font-size: var(--font-small); font-weight: 600; }
.new-hw { margin-top: 18px; }
.new-hw summary, details.card > summary { cursor: pointer; padding: 2px 0; }
details.card[open] > summary { margin-bottom: 14px; }

/* rings, meters, gauges */
.ring { --p: 0; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(var(--err) calc(var(--p) * 1%), var(--line) 0); }
.ring span { font-size: 12px; font-weight: 700; display: block; text-align: center; line-height: 1.1; }
.ring small { font-size: 9px; }
.ring.dark { background: radial-gradient(closest-side, var(--chrome) 70%, transparent 72% 100%), conic-gradient(var(--line-2) 0 100%); }
.ring.dark span { color: #fff; }
.ring.big { width: 92px; height: 92px; background: radial-gradient(closest-side, var(--surface) 80%, transparent 82% 100%), conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0); }
.ring.big span { font-size: 22px; font-weight: 800; }
.ring.big em { display: block; font-size: 11px; font-style: normal; color: var(--muted); font-weight: 600; }
.meter { --p: 0; position: relative; height: 22px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 100px; flex: 1; }
.meter::before { content: ""; position: absolute; inset: 0; width: calc(var(--p) * 1%); background: linear-gradient(90deg, #4fd8a0, var(--ok)); border-radius: 999px; }
.meter span { position: relative; display: block; text-align: right; padding-right: 8px; font-size: 12px; font-weight: 700; line-height: 22px; }
.meter.small { height: 16px; max-width: 160px; }
.meter.small span { line-height: 16px; font-size: 11px; }
.prog-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.prog-row:last-child { border-bottom: 0; }
.prog-row .meter { max-width: 180px; }

/* lecture editor */
.part { border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; overflow: hidden; }
.part-head { display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.part-title { font-weight: 700; border: 0 !important; background: transparent !important; min-height: 32px !important; padding: 4px 6px !important; }
.item-row { display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.item-row input { min-height: 34px !important; padding: 4px 8px !important; }
.thumb { width: 64px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.add-videos { padding: 10px 12px; }
.add-videos summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); }
.lib { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-control); margin-bottom: 10px; }
.lib label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.lib label span { display: flex; flex-direction: column; }
.pick { display: block; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; }
.pick.on { background: var(--bg); font-weight: 700; }
.part-label { margin: 10px 10px 2px; }
.post { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }

/* template editor */
.tpl-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.items-card .sum { display: flex; gap: 14px; font-size: var(--font-small); color: var(--muted); }
.items-card .sum b { color: var(--text); font-size: 16px; }
.items-head, .titem { display: grid; grid-template-columns: 70px 92px minmax(150px, 1fr) 64px minmax(80px, .7fr) 70px 64px; gap: var(--space-2); align-items: center; }
.items-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.titem { padding: 8px 4px; border-bottom: 1px dashed var(--line-2); }
.titem input, .titem select { min-height: 34px !important; padding: 4px 8px !important; font-size: 14px; }
.titem .ans-bubbles { display: flex; gap: 4px; flex-wrap: wrap; }
.titem .ans-bubbles button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; cursor: pointer; font-size: var(--font-small); }
.titem .ans-bubbles button.on { background: var(--chrome); color: #fff; border-color: var(--chrome); }
.titem .ops { display: flex; gap: 2px; }
.quick { margin: 4px 0 12px; font-size: 14px; }
.quick summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; margin-bottom: 8px; }
.quick .inline-form { margin-bottom: 8px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0 0; background: linear-gradient(transparent, var(--surface) 30%); display: flex; justify-content: flex-end; }

/* homework detail */
.dash3 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; }
.stat > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 22px; font-weight: 800; }
.stat b.small { font-size: 14px; font-weight: 600; }
.item-stats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.istat { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 34px; font-size: 11px; }
.istat .vbar { width: 18px; height: 80px; background: var(--line); border-radius: 6px; position: relative; overflow: hidden; }
.istat .vbar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ok); }
.istat b { font-size: 11px; }
.obj { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.obj:last-child { border-bottom: 0; }
.obj .inline-form { min-width: min(100%, 420px); }
.score-big { font-size: 34px; font-weight: 800; margin-left: auto; color: var(--accent-ink); }
.score-big small { font-size: 16px; color: var(--muted); }
table.review select { width: auto; min-height: 34px; padding: 4px 8px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: var(--space-2); width: min(560px, calc(100% - 32px)); }
.toast { background: var(--chrome); color: #fff; padding: 12px 40px 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); position: relative; animation: rise .25s ease; }
.toast.err { background: var(--err); }
.toast .x { position: absolute; right: 8px; top: 8px; border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ---------- login ---------- */
.login-page { background: var(--chrome); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; color: #c7cbd2; }
.login-wrap a { color: #c7cbd2; }
.login-card { background: var(--surface); color: var(--text); border-radius: 22px; padding: 32px 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; }
.login-brand img { width: 56px; height: 56px; }
.login-brand b { font-size: var(--font-title); font-weight: 800; }
.login-brand span { color: var(--muted); font-size: var(--font-small); }

/* ---------- student chrome (dark frame + rail + rounded light panel) ---------- */
.learner { background: var(--chrome); }
.s-top { position: fixed; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; padding: 0 22px; z-index: 20; background: var(--chrome); }
.s-rail { position: fixed; top: 64px; bottom: 0; left: 0; width: 76px; display: flex; flex-direction: column; justify-content: center; gap: 6px; z-index: 19; }
.s-rail a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; color: #8b929c; font-size: 12px; font-weight: 600; }
.s-rail a i { font-style: normal; font-size: 22px; line-height: 1; }
.s-rail a.on, .s-rail a:hover { color: #fff; }
.s-panel { margin: 64px 0 0 76px; min-height: calc(100vh - 64px); background: var(--panel); border-top-left-radius: 36px; padding: 32px 40px 60px; }
.hello { display: flex; align-items: center; gap: 14px; margin: 4px 0 22px; }
.hello-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: var(--font-title); color: #fff; background: linear-gradient(135deg, #4fd8a0, #0e9f6e); box-shadow: 0 6px 16px rgba(14,159,110,.3); flex: none; }
.hello-icon[class*="color-"] { background: linear-gradient(135deg, var(--c1), var(--c2)); }
.s-card { background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.s-card + .s-card { margin-top: 16px; }
.s-card h2 { margin-bottom: 2px; }
.s-card .sub { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.s-card .sub::before { content: "ⓘ "; }
.empty-card { text-align: center; color: var(--muted); padding: 48px 20px; }
.s-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.s-grid .wide { grid-column: 1 / -1; }
.s-grid .s-card + .s-card { margin-top: 0; }
.today { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); margin-bottom: 8px; }
.today .dot { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.resume { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: 14px; }
.mini-hws { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.mini-hw { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; align-items: flex-start; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); position: relative; }
.tile i { font-style: normal; font-size: 28px; }
.tile b { font-size: 20px; }
.tile span { color: var(--muted); font-size: 13.5px; }
.tile em { position: absolute; top: 18px; right: 18px; font-style: normal; }
.lec-hero { background: var(--chrome); color: #fff; border-radius: 18px 18px 0 0; padding: 30px 32px; }
.lec-hero span { color: #b5bac2; }
.lec-hero h1 { font-size: 30px; margin-top: 4px; }
.lec-hero + .tabs { background: var(--surface); border-radius: 0 0 18px 18px; padding: 0 20px; border: 1px solid var(--line); border-top: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.dash-grid .s-card + .s-card { margin-top: 0; }
.dash-grid .side-posts { grid-row: span 2; grid-column: 3; }
.dash-grid .outline { grid-column: 1 / 3; }
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.gauge { --p: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; padding-top: 6px; }
.gauge .arc { width: 150px; height: 75px; border-radius: 150px 150px 0 0; position: relative; overflow: hidden; background: var(--line); margin-bottom: -30px; }
.gauge .arc::before { content: ""; position: absolute; inset: 0; border-radius: 150px 150px 0 0; background: conic-gradient(from 270deg at 50% 100%, var(--ok) calc(var(--p) * 1.8deg), transparent 0); }
.gauge .arc::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 61px; border-radius: 120px 120px 0 0; background: var(--surface); }
.gauge b { font-size: 20px; font-weight: 800; position: relative; }
.gauge span { font-size: 11.5px; color: var(--muted); }
.gauge em { font-style: normal; font-size: 11.5px; background: var(--panel); padding: 2px 8px; border-radius: 6px; margin-top: 4px; }
.post-mini { display: flex; justify-content: space-between; gap: var(--space-2); padding: 8px 0; border-bottom: 1px solid var(--line); }
.side-posts h2 + .muted { padding: 20px 0; }
.side-posts h2:not(:first-child) { margin-top: 18px; }
.outline details { border-radius: 12px; margin-bottom: 8px; }
.outline summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; list-style: none; }
.outline summary::before { content: "▸"; margin-right: 8px; transition: .15s; }
.outline details[open] summary::before { transform: rotate(90deg); }
.outline summary b { flex: 1; }
.o-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.o-item:last-child { border-bottom: 0; }
.o-item .check { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--line); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.o-item.done .check { background: var(--ok); }
.o-item.on { background: var(--accent-soft); border-radius: var(--radius-control); font-weight: 700; }
.outline.compact { max-height: calc(100vh - 140px); overflow-y: auto; position: sticky; top: 80px; }
.watch-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
.player-wrap { background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; }
.player-wrap video { width: 100%; height: 100%; display: block; }
.watch-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.note { background: var(--accent-soft); padding: 8px 12px; border-radius: var(--radius-control); font-size: var(--font-small); margin: 8px 0 0; }

/* OMR */
.omr { max-width: 760px; }
.omr-row { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px dashed var(--line-2); }
.omr-row .no { width: 64px; font-weight: 700; flex: none; }
.omr-row .pts { margin-left: auto; flex: none; }
.bubbles { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.bubbles label { position: relative; }
.bubbles input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.bubbles span { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-weight: 700; background: var(--surface); }
.bubbles input:checked + span { background: var(--chrome); color: #fff; border-color: var(--chrome); }
.bubbles input:focus-visible + span { outline: 2px solid var(--accent); }
.omr-row .short { max-width: 260px; }
.omr-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--surface) 30%); }
.obj-form textarea { margin: 6px 0; min-width: 200px; }

/* timetable */
.tt { --lo: 14; --hi: 22; display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); gap: 6px; }
.tt-hours { position: relative; height: calc((var(--hi) - var(--lo)) * 56px); margin-top: 28px; }
.tt-hours span { position: absolute; top: calc((var(--h) - var(--lo)) * 56px - 8px); font-size: 11px; color: var(--muted); }
.tt-day > b { display: block; text-align: center; height: 28px; font-size: 14px; }
.tt-day.is-today > b { color: var(--accent-ink); }
.tt-col { position: relative; height: calc((var(--hi) - var(--lo)) * 56px); background: repeating-linear-gradient(var(--panel) 0 55px, var(--line) 55px 56px); border-radius: var(--radius-control); }
.tt-day.is-today .tt-col { background: repeating-linear-gradient(var(--accent-soft) 0 55px, var(--line) 55px 56px); }
.tt-block { position: absolute; left: 3px; right: 3px; top: calc((var(--s) - var(--lo)) * 56px); height: calc((var(--e) - var(--s)) * 56px - 2px); border-radius: var(--radius-control); padding: 6px 8px; color: #fff; font-size: 12px; overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2)); display: flex; flex-direction: column; }
.tt-block:hover { color: #fff; filter: brightness(1.05); }
.tt-list { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-grid .side-posts { grid-column: auto; grid-row: auto; }
  .dash-grid .outline { grid-column: 1 / -1; }
  .tpl-layout, .two-col, .two-col.wide-right { grid-template-columns: minmax(0, 1fr); }
  .dash3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topnav { gap: var(--space-3); padding: 0 12px; }
  .topnav .tool { display: none; }
  .brand span { display: none; }
  .with-side { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .side-title, .side-meta { display: none; }
  .class-switch { margin-bottom: 8px; }
  .side-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .side-nav a { padding: 8px 12px; white-space: nowrap; }
  .page { padding: 18px 16px 80px; }
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .filters { flex-wrap: wrap; gap: var(--space-2); }
  .filters .field { border-right: 0; padding: 0; flex: 1 1 120px; }
  .watch-grid { grid-template-columns: minmax(0, 1fr); }
  .outline.compact { position: static; max-height: none; }
  .items-head { display: none; }
  .titem { grid-template-columns: 60px 1fr 1fr; grid-template-areas: "no kind pts" "ans ans ans" "el el lv" "ops ops ops"; }
  .titem > :nth-child(1) { grid-area: no; } .titem > :nth-child(2) { grid-area: kind; } .titem > :nth-child(3) { grid-area: ans; }
  .titem > :nth-child(4) { grid-area: pts; } .titem > :nth-child(5) { grid-area: el; } .titem > :nth-child(6) { grid-area: lv; } .titem > :nth-child(7) { grid-area: ops; justify-content: flex-end; }
  h1 { font-size: 22px; }
}
@media (max-width: 700px) {
  .s-top { height: 56px; padding: 0 14px; }
  .s-rail { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: calc(62px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); background: var(--chrome); border-top: 1px solid #2a2f37; }
  .s-rail a { flex: 1; padding: 8px 0; }
  .s-panel { margin: 56px 0 0; border-radius: 22px 22px 0 0; padding: 20px 16px calc(90px + env(safe-area-inset-bottom)); }
  .s-grid, .tiles, .dash-grid, .gauges { grid-template-columns: minmax(0, 1fr); }
  .tiles { gap: 10px; }
  .tile { padding: 16px; }
  .dash-grid .outline { grid-column: auto; }
  .lec-hero { padding: 22px 18px; }
  .lec-hero h1 { font-size: 22px; }
  .row2, .row3 { grid-template-columns: minmax(0, 1fr); }
  .tt { display: none; }
  .tt-list { display: block; }
  .tt-list .today.on { outline: 2px solid var(--accent); }
  .bubbles span { width: 40px; height: 40px; }
  .omr-row { flex-wrap: wrap; gap: var(--space-2); }
  .omr-row .no { width: auto; min-width: 48px; }
  .omr-row .pts { margin-left: 0; }
  .score-big { font-size: var(--font-title); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .dash3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .table-foot .actions { width: 100%; }
  .table-foot .actions > * { flex: 1 1 auto; }
  .cards { gap: var(--space-3); }
}
[hidden] { display: none !important; }
.filter-row > *, .dash3 > *, .cards > *, .s-grid > *, .tiles > * { margin-top: 0 !important; }
.part-head .inline-form { flex-wrap: nowrap; }

/* 교재 (books, solve pane) */
.book-card { flex-direction: row; gap: 14px; align-items: flex-start; }
.book-card > .grow { display: flex; flex-direction: column; gap: 4px; }
.book-cover { width: 76px; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); flex: none; }
.legacy-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.legacy-row { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.legacy-row:last-child { border-bottom: 0; }
.ok-text { color: var(--ok); font-weight: 600; }
.book-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
.viewer { padding: 12px; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); margin-bottom: 10px; }
.btn.disabled { pointer-events: none; opacity: .4; }
.page-img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.field.dashed { border: 1px dashed var(--line-2); border-radius: 12px; padding: 10px 12px; }
.range-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.range-row input { width: 76px !important; }
.import-box { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.pane-switch { display: none; }
.solve-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.solve-grid .omr, .solve-grid .s-card { max-width: none; }
.book-pane { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 14px; }
.book-pane .pages { --zoom: 100%; display: flex; flex-direction: column; gap: 14px; overflow-x: auto; }
.book-pane figure { margin: 0; }
.book-pane img { width: var(--zoom); max-width: none; min-width: 100%; height: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.book-pane figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
.book-pane .sol { margin-top: 12px; }
.book-pane .sol summary { cursor: pointer; padding: 8px 0; }
.zoom { display: flex; gap: 2px; }
@media (max-width: 1100px) { .book-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .pane-switch { display: flex; position: sticky; top: 56px; z-index: 5; background: var(--panel); padding: 6px 0 10px; gap: 6px; }
  .pane-switch button { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; }
  .pane-switch button.on { background: var(--chrome); color: #fff; border-color: var(--chrome); }
  .solve-grid { grid-template-columns: minmax(0, 1fr); }
  .solve-grid[data-pane="book"] .answer-pane, .solve-grid[data-pane="answer"] .book-pane { display: none; }
  .book-pane { position: static; max-height: none; padding: 10px; }
}
@media (max-width: 700px) {
  table.result thead { display: none; }
  table.result tr { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "no mark pts" "mine key key" "obj obj obj"; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.result td { padding: 0; border: 0; }
  table.result .c-no { grid-area: no; } table.result .c-mark { grid-area: mark; } table.result .c-pts { grid-area: pts; }
  table.result td[data-label="내 답"] { grid-area: mine; } table.result td[data-label="정답"] { grid-area: key; } table.result .c-obj { grid-area: obj; }
  table.result td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  table.result tr.ok td:first-child, table.result tr.bad td:first-child { box-shadow: none; }
  table.result tr.ok { box-shadow: inset 3px 0 var(--ok); } table.result tr.bad { box-shadow: inset 3px 0 var(--err); }
}

/* 영상 관리 */
.head-right { margin-left: auto; }
.two-col.wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); margin-bottom: 16px; }
.yt-add summary { cursor: pointer; }
.yt-add[open] summary { margin-bottom: 12px; }
.vgroup { margin-top: 16px; }
.vrow { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.vthumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--radius-control); overflow: hidden; background: var(--line); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vlen { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.75); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.yt-badge { position: absolute; left: 6px; top: 6px; background: #ff0033; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.vinfo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vinfo > input { font-weight: 600; }
.vmeta { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.vmeta .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.vops { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.btn.danger { color: var(--err); }
.foot-links { margin-top: 16px; justify-content: space-between; }
.player-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); border: 2px dashed var(--line-2); border-radius: 14px; padding: 28px 16px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--accent-ink); background: var(--accent-soft); }
.queue { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.queue li { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 12px; }
.queue li.done { border-color: var(--ok); } .queue li.fail { border-color: var(--err); }
.q-row { display: flex; justify-content: space-between; gap: var(--space-2); font-size: 14px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.q-bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.lib .yt-badge { position: static; display: inline-block; margin-right: 4px; }
@media (max-width: 860px) {
  .two-col.wide-left { grid-template-columns: minmax(0, 1fr); }
  .vrow { grid-template-columns: 110px minmax(0, 1fr); }
  .vops { grid-column: 1 / -1; justify-content: flex-start; }
}
.item-row .yt-badge { position: static; margin-left: -6px; }
.yt-inline { border-top: 1px dashed var(--line-2); margin-top: 10px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }

/* 영상 + 교재 */
.item-book { padding: 0 10px 8px 82px; border-bottom: 1px solid var(--line); font-size: var(--font-small); }
.item-book summary { cursor: pointer; color: var(--muted); padding: 2px 0; }
.item-book.linked summary { color: var(--blue); font-weight: 600; }
.item-book select { width: auto; min-height: 32px; padding: 4px 8px; }
.item-row { border-bottom: 0; }
.small-badge { font-size: 11px; padding: 1px 7px; background: #e8efff; color: var(--blue); }
.watch-grid.with-book { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.watch-book { top: 80px; max-height: calc(100vh - 100px); }
.outline.in-main { position: static; max-height: none; margin-top: 16px; }
@media (max-width: 860px) {
  .watch-grid.with-book { grid-template-columns: minmax(0, 1fr); }
  .watch-book { position: static; max-height: none; }
  .watch-grid.with-book .watch-main { position: sticky; top: 56px; z-index: 4; background: var(--panel); padding-bottom: 6px; }
  .watch-grid.with-book .watch-main .in-main, .watch-grid.with-book .watch-main .watch-meta .nav-btn { display: none; }
  .item-book { padding-left: 10px; }
}
.danger-card { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); margin-top: 16px; }

/* CC 자막 */
video::cue { font-size: var(--cue-size, 100%); background: rgba(0, 0, 0, .72); color: #fff; line-height: 1.4; }
.cc-tools { display: inline-flex; align-items: center; gap: 2px; }
.cc-badge { position: absolute; right: 6px; top: 6px; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.55); color: #fff; border: 1px solid #fff; }
.cc-badge.published { background: var(--ok); border-color: var(--ok); }
.cap-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cap-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 14px; border-top: 1px solid var(--line); }
.cap-row .t { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--blue); cursor: pointer; background: none; border: 0; text-align: left; padding: 0; }
.cap-row input { min-height: 36px !important; padding: 6px 10px !important; }
.cap-row input.changed { border-color: var(--accent-ink); background: var(--accent-soft); }
.cap-row .raw { font-size: 11.5px; color: var(--muted); grid-column: 2; margin-top: -4px; }
.cap-row.flag input { border-color: var(--err); }
.cap-player { position: sticky; top: 76px; }
.cap-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-4); align-items: start; }
.save-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 14px; }
.pager a { min-width: 32px; text-align: center; padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: var(--font-small); }
.pager a.on { background: var(--chrome); color: #fff; border-color: var(--chrome); }
@media (max-width: 1000px) { .cap-layout { grid-template-columns: minmax(0, 1fr); } .cap-player { position: static; } }
@media (max-width: 600px) { .cap-row { grid-template-columns: minmax(0, 1fr) auto; } .cap-row .t { grid-column: 1 / -1; } .cap-row .raw { grid-column: 1; } }
.cap-row.now { background: var(--accent-soft); }
.preview-note { background: #e8efff; color: #1d4ed8; border-radius: 12px; padding: 8px 14px; font-size: var(--font-small); margin-bottom: 14px; } .preview-note a { text-decoration: underline; }
.icon-btn.wide { width: auto; padding: 0 8px; white-space: nowrap; font-weight: 700; }

/* 활동 기록 */
.audit-filters { flex-wrap: wrap; margin-bottom: 8px; }
table.audit td { vertical-align: top; }
table.audit .path { word-break: break-all; }
table.audit .detail { max-width: 420px; word-break: break-word; }
table.audit tr.err td { background: var(--err-bg); }
table.audit tr.warn td:first-child { box-shadow: inset 3px 0 #f59e0b; }
table.audit pre { white-space: pre-wrap; font-size: 11px; background: var(--panel); padding: 8px; border-radius: var(--radius-sm); max-width: 420px; }
.stat b.danger { color: var(--err); }


/* Shared finishing: navigation, readable data, touch controls. */
html { scroll-padding-top: 84px; }
body { line-height: 1.6; }
h1, h2, h3, .cover b, .tile b { overflow-wrap: anywhere; }
h1 { line-height: 1.3; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
button:disabled, .btn.disabled { opacity: .5; cursor: default; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-ink); width: 18px; height: 18px; flex: none; }
input[type=file] { max-width: 100%; font-size: var(--font-small); }
input[type=file]::file-selector-button {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 8px 12px; margin-right: 10px; cursor: pointer;
}
.field { gap: 6px; }
.field > span, .field > legend { color: var(--text); font-weight: 600; }
.btn { min-height: 42px; padding: 9px 16px; }
.btn.primary:hover { filter: none; background: #ed5f00; border-color: #ed5f00; }
.btn.dark:hover { background: #292929; color: #fff; }
.btn.ghost:hover { background: var(--panel); border-color: var(--line); }
.card, .s-card { padding: 22px; }
.table-card { padding: 0; }
.card-head { margin-bottom: 16px; }
.page-head { margin-bottom: 24px; }
.topnav { border-bottom: 1px solid #303030; }
.menu a.on { background: #292929; box-shadow: inset 0 -2px var(--accent); }
.side-nav a.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 var(--accent); }
.side-nav a:hover { background: var(--panel); }
.tabs { gap: var(--space-2); }
.tabs a { padding: 12px 14px; }
.tabs a.on { border-color: var(--accent-ink); }
.tabs-inline { background: var(--panel); border: 1px solid var(--line); }
.tabs-inline a.on { box-shadow: var(--shadow); }
.badge { line-height: 1.5; padding: 4px 10px; }
.badge.green, .badge.s-확정 { background: var(--ok-bg); color: var(--ok); }
table.grid th { background: var(--panel); padding: 13px 16px; }
table.grid td { padding: 14px 16px; overflow-wrap: anywhere; }
table.grid td.empty, .empty-card { padding: 48px 24px; line-height: 1.8; background: var(--panel); }
.table-wrap { overscroll-behavior-x: contain; }
.stats3 span { padding: 10px 6px; }
.stats3 b, .score-big, .stat b, .c-pts { font-variant-numeric: tabular-nums; }
.class-card, .lec-card, .hw-card, .tpl-card, .tile { border-radius: var(--radius); }
.class-card .body, .lec-card .body { padding: 18px; gap: var(--space-2); }
.hw-card .cover { min-height: 140px; }
.s-panel { border-top-left-radius: 24px; }
.s-rail a { margin: 0 8px; border-radius: 12px; }
.s-rail a.on { background: #242424; color: #ff8a3d; }
.hello-icon { background: var(--chrome); box-shadow: none; }
.preview-note { background: var(--accent-soft); color: var(--text); border: 1px solid var(--line); }
.login-card { max-width: 400px; padding: 36px 30px; border: 1px solid var(--line); box-shadow: 0 16px 48px #0003; }
.login-brand { margin-bottom: 12px; }
.login-brand img { width: 64px; height: 64px; }
.login-brand b { letter-spacing: -.04em; }
.login-card .btn { min-height: 48px; }
.brand small { color: #aeb0b5; font-size: 10px; letter-spacing: .08em; font-weight: 600; margin-left: 2px; }
.skip-link { position: fixed; top: -100px; left: 16px; padding: 10px 16px; background: var(--surface); color: var(--text); border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 8px; }
.omr-foot { gap: var(--space-3); padding: 16px 0 4px; }
.omr-row .no { overflow-wrap: anywhere; }
.omr-row .short { min-width: 0; }
.bubbles input:checked + span { background: var(--accent); border-color: var(--accent-ink); color: #171717; }
.note, .alert { border: 1px solid var(--line); line-height: 1.7; }
.toast { animation: none; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .page-head > div { min-width: 0; flex: 1; }
  .part-head .inline-form { flex-wrap: wrap; }
  .dash-grid .side-posts { grid-column: auto; grid-row: auto; }
  .viewer-bar { flex-wrap: wrap; }
  .side-nav a { min-height: 44px; }
}
@media (max-width: 700px) {
  html { scroll-padding-top: 72px; }
  .card, .s-card { padding: 18px; }
  .table-card { padding: 0; }
  .s-panel { padding: 24px 16px calc(100px + env(safe-area-inset-bottom)); }
  .s-rail a { margin: 4px 6px; padding: 7px 0; }
  .s-rail a.on { box-shadow: inset 0 2px var(--accent); }
  .brand small { display: none; }
  .btn.small, .icon-btn, .linkbtn { min-height: 40px; }
  .icon-btn { min-width: 40px; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px; }
  .page-head { gap: 10px; margin-bottom: 18px; }
  .resume { flex-wrap: wrap; }
  .omr-row { padding: 14px 0; align-items: flex-start; }
  .omr-row .bubbles { flex-basis: 100%; order: 3; gap: 10px; }
  .omr-row .short { flex-basis: 100%; max-width: none; order: 3; }
  .omr-row .pts { margin-left: auto; }
  .omr-foot { bottom: calc(74px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .book-pane { padding: 12px; }
  .pane-switch button.on { border-color: var(--accent-ink); box-shadow: inset 0 -2px var(--accent); }
  .book-card { gap: var(--space-3); }
  .book-cover { width: 60px; }
  .book-card .btn-row { flex-wrap: wrap; }
  .obj-form textarea { min-width: 0; width: 100%; }
  table.result td { padding: 0; }
  .login-card { padding: 28px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 출결 */
.badge.att-출석 { background: var(--ok-bg); color: var(--ok); }
.badge.att-지각, .badge.att-조퇴, .badge.att-지각·조퇴 { background: #fff4d6; color: #a15c00; }
.badge.att-결석 { background: var(--err-bg); color: var(--err); }
.badge.att-인정 { background: #e8efff; color: var(--blue); }
.date-nav { display: flex; gap: 6px; align-items: center; }
.date-nav input { width: auto; min-height: 34px; padding: 4px 8px; }
.att-form { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.att-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius-sm); padding: 4px 9px; font-size: var(--font-small); cursor: pointer; font-weight: 600; }
.att-btn.on.att-출석 { background: var(--ok); color: #fff; border-color: var(--ok); }
.att-btn.on.att-지각, .att-btn.on.att-조퇴 { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.att-btn.on.att-결석 { background: var(--err); color: #fff; border-color: var(--err); }
.att-btn.on.att-인정 { background: var(--blue); color: #fff; border-color: var(--blue); }
.att-form .memo { width: 140px !important; min-height: 32px !important; padding: 4px 8px !important; font-size: var(--font-small); }
table.att-month th.c, table.att-month td.c { text-align: center; padding: 8px 4px; min-width: 30px; }
td.att-cell.att-결석 { color: var(--err); font-weight: 700; } td.att-cell.att-출석 { color: var(--ok); }
td.att-cell.att-지각, td.att-cell.att-조퇴 { color: #d97706; font-weight: 700; } td.att-cell.att-인정 { color: var(--blue); }
.kiosk-page { background: var(--chrome); color: #fff; }
.kiosk { min-height: 100vh; display: flex; flex-direction: column; padding: 18px 24px; }
.kiosk header { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.kiosk header img { width: 40px; height: 40px; background: #fff; border-radius: var(--radius-control); padding: 3px; }
.kiosk .clock { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kiosk-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: center; }
.kiosk-pad { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.kiosk-guide { font-size: var(--font-title); font-weight: 700; margin: 0; }
.code { display: flex; gap: 18px; }
.code i { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #6b7280; }
.code i.on { background: #fff; border-color: #fff; }
.keys { display: grid; grid-template-columns: repeat(3, 108px); gap: 14px; }
.keys button { height: 92px; border-radius: 22px; border: 0; background: var(--chrome-2); color: #fff; font-size: 36px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.keys button:active { background: #3a3f48; }
.keys button.fn { font-size: 22px; background: #2b3038; }
.keys button[data-k="확인"] { background: var(--accent); }
.kiosk-side { background: var(--chrome-2); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.kiosk-side .ks { font-size: 18px; } .kiosk-side .muted { color: #9aa3af; }
.kiosk-side .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.kiosk-exit { color: #6b7280; font-size: var(--font-small); margin-top: 10px; }
.kiosk-msg { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 36px 48px; border-radius: 26px; font-size: 32px; font-weight: 800; text-align: center; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.kiosk-msg.ok { background: var(--ok); } .kiosk-msg.bad { background: var(--err); }
@media (max-width: 800px) {
  .kiosk-body { grid-template-columns: minmax(0, 1fr); }
  .keys { grid-template-columns: repeat(3, 84px); } .keys button { height: 76px; font-size: 30px; }
  .kiosk-msg { font-size: 24px; padding: 26px; }
}

/* 질문 게시판 */
.nav-badge { font-style: normal; background: var(--err); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: 2px; }
.tab-count { font-style: normal; font-size: 11px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; margin-left: 3px; }
.qna-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.ask-card { position: sticky; top: 80px; }
.qna-list { display: flex; flex-direction: column; gap: var(--space-3); }
.qna-list.wide { max-width: 900px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.q-card.open { border-left: 4px solid var(--err); }
.q-card.answered { border-left: 4px solid var(--ok); }
.q-head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.q-at { display: inline-block; margin-top: 8px; font-size: var(--font-small); font-weight: 600; color: var(--blue); background: #e8efff; padding: 3px 10px; border-radius: 999px; }
.q-img { max-width: min(100%, 360px); max-height: 320px; border-radius: var(--radius-control); border: 1px solid var(--line); margin-top: 6px; display: block; }
.q-reply { margin: 10px 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.q-reply.teacher { background: var(--ok-bg); }
.q-answer { margin-top: 10px; }
.q-answer summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); font-size: 14px; }
.q-answer form { margin-top: 8px; }
.q-ops { display: flex; gap: 14px; margin-top: 8px; }
.watch-qna { margin-top: 16px; }
.ask-inline summary { list-style: none; display: inline-flex; }
.ask-inline summary::-webkit-details-marker { display: none; }
.watch-qna .q-card { box-shadow: none; margin-top: 10px; }
.notice-card { margin-bottom: 16px; border-color: var(--ok); }
.ellipsis1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 8px; color: var(--muted); }
@media (max-width: 860px) { .qna-layout { grid-template-columns: minmax(0, 1fr); } .ask-card { position: static; } }

/* 성적표 · 통계 */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 22px; max-width: 980px; }
.report h2 { font-size: 16px; margin: 0 0 10px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.report-head h1 { margin: 4px 0; } .report-head h1 small { font-size: 15px; color: var(--muted); font-weight: 500; }
.report-logo { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.report-grade { width: 96px; height: 96px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; flex: none; }
.report-grade b { font-size: 44px; line-height: 1; } .report-grade span { font-size: var(--font-small); opacity: .9; }
.grade-A { background: #12b76a; } .grade-B { background: #2e6be6; } .grade-C { background: #f59e0b; } .grade-D { background: #f97316; } .grade-E { background: #d92d20; } .grade--, .report-grade.grade-- { background: #9aa3af; }
.gchip { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); color: #fff; font-weight: 800; font-size: var(--font-small); }
.report-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.report-stats > div { background: var(--panel); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.report-stats span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.report-stats b { font-size: var(--font-title); font-weight: 800; } .report-stats b small { font-size: 14px; color: var(--muted); }
.report-stats em { font-style: normal; font-size: 12px; color: var(--muted); }
.report-chart { width: 100%; height: auto; max-height: 200px; }
.report-chart .grid-line { stroke: var(--line); } .report-chart .axis { font-size: 10px; fill: var(--muted); }
.report-chart .mine-line { fill: none; stroke: var(--accent); stroke-width: 3; } .report-chart .avg-line { fill: none; stroke: #9aa3af; stroke-width: 2; stroke-dasharray: 5 4; }
.report-chart .dot { fill: var(--accent); }
.legend .lg { display: inline-block; width: 18px; height: 3px; vertical-align: middle; margin: 0 4px 0 10px; } .lg.mine { background: var(--accent); } .lg.avg { background: #9aa3af; }
.report-table tr.missing td { color: var(--err); }
.meter.weak::before { background: linear-gradient(90deg, #fca5a5, var(--err)); }
.report-note textarea { min-height: 90px; }
.links-card { margin-bottom: 14px; display: flex; flex-direction: column; gap: var(--space-2); }
.link-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; } .link-row input { flex: 1; min-width: 220px; font-size: var(--font-small); }
.parent-report { background: var(--panel); } .parent-wrap { max-width: 980px; margin: 0 auto; padding: 20px 14px 40px; }
.print-only { display: none; }
.stats-table th.c, .stats-table td.c { text-align: center; padding: 8px 6px; }
.stats-table td.heat { background: color-mix(in srgb, var(--ok) calc(var(--h) * .35%), transparent); font-weight: 600; }
.stats-table tr.avg-row td { background: var(--panel); }
@media (max-width: 700px) {
  .report { padding: 18px 14px; border-radius: 14px; } .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grade { width: 72px; height: 72px; border-radius: 18px; } .report-grade b { font-size: 32px; }
}
@media print {
  .topnav, .s-top, .s-rail, .no-print, .toasts, .preview-note { display: none !important; }
  body, .learner, .s-panel, .page { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .report { border: 0; padding: 0; max-width: none; } .print-only { display: block; }
  .report-grade, .gchip, .meter::before, .stats-table td.heat { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.dash5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } @media (max-width: 700px) { .dash5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.report-table td:nth-child(2) { min-width: 140px; } .report-table td, .report-table th { white-space: nowrap; } .report-table td:nth-child(2) { white-space: normal; }

/* Theme review: shared geometry and responsive navigation. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { width: 1.25em; height: 1.25em; display: inline-block; flex: none; vertical-align: -.22em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-nav i, .s-rail i { display: inline-flex; align-items: center; justify-content: center; }
.hello-icon .icon, .tile i .icon { width: 28px; height: 28px; }
:where(a, button, summary, input, select, textarea):focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
:where(.topnav, .s-top, .s-rail, .kiosk) :focus-visible { outline-color: #ffad70; }
.bubbles input:focus-visible + span, .chip-check input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn, .btn.small, .icon-btn, .back, .tool, .usermenu summary, .att-btn,
.pager a, .pane-switch button, .zoom button, .small-input,
input:not([type=checkbox]):not([type=radio]):not([type=file]), select {
  min-height: 44px;
}
.icon-btn, .back, .usermenu summary { min-width: 44px; }
.btn-row, .inline-form { max-width: 100%; }
.check, .chip-check, .toggle, .seg label, .bubbles label, .linkbtn { min-height: 44px; }
.bubbles span { width: 44px; height: 44px; }
.usermenu .drop { box-shadow: var(--shadow-menu); max-width: calc(100vw - 24px); }
.usermenu .drop a, .usermenu .drop .linkbtn { display: flex; align-items: center; min-height: 44px; }
.topnav { height: auto; min-height: 60px; flex-wrap: wrap; gap: var(--space-3); padding: 8px 24px; }
.topnav .brand, .topnav .tools { flex: none; }
.topnav .menu { flex: 1 1 560px; min-width: 0; flex-wrap: wrap; overflow: visible; }
.menu a { display: flex; align-items: center; min-height: 44px; }
.side { position: static; height: auto; }
.side-nav a { min-height: 44px; }
.s-rail a { color: #b8bec8; }
.table-wrap { width: 100%; min-width: 0; max-width: 100%; }
.table-wrap:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.page, .s-panel, .card, .s-card, .report { overflow-wrap: anywhere; }
:where(.two-col, .s-grid, .watch-grid, .solve-grid, .dash-grid, .row2, .row3) > * { min-width: 0; }
.kv dd, .item-row .grow, .post > div, .lib label span { min-width: 0; }
img, video, iframe { max-width: 100%; }
.att-btn.on.att-지각, .att-btn.on.att-조퇴 { color: #171717; }
td.att-cell.att-지각, td.att-cell.att-조퇴 { color: #9a4b00; }
.grade-A { background: #087d49; }
.grade-C { background: #965900; }
.grade-D { background: #b84308; }
.grade--, .report-grade.grade-- { background: #596170; }
.kiosk .keys button[data-k="확인"] { color: var(--accent-text); }
.kiosk-exit { color: #b8bec8; display: inline-flex; align-items: center; min-height: 44px; }
.kiosk-msg.ok { background: #087d49; }
.kiosk header { flex-wrap: wrap; }
.kiosk .clock { white-space: nowrap; }
@media (max-width: 1100px) {
  .topnav { position: relative; padding: 8px 16px; }
  .topnav .brand { order: 0; }
  .topnav .tools { order: 1; }
  .topnav .menu { order: 2; flex-basis: 100%; gap: var(--space-1); }
  .topnav .tool { display: inline-flex; align-items: center; }
  .topnav .brand span { display: inline; }
  .menu a { padding: 8px 10px; }
  .with-side { min-height: 0; }
  .cap-player { position: static; }
  .with-side .page { padding: 24px 16px 80px; }
}
@media (max-width: 860px) {
  .side-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); overflow: visible; gap: var(--space-1); }
  .side-nav a { white-space: normal; padding: 10px; }
  .side-title { display: block; margin: 0 0 8px; font-size: 16px; }
  .side { padding: 16px; }
  .s-panel { padding-left: 20px; padding-right: 20px; }
  .item-row { flex-wrap: wrap; }
  .item-row .grow { flex-basis: calc(100% - 90px); }
  .part-head .inline-form { width: 100%; }
  .part-head .small-input { flex: 1 1 100px; }
  .watch-grid.with-book .watch-main { position: static; }
}
@media (max-width: 700px) {
  .topnav { padding: 8px 12px; gap: var(--space-2); }
  .topnav .brand { font-size: 18px; }
  .topnav .tools { gap: var(--space-1); flex-wrap: wrap; }
  .topnav .tool { font-size: 12px; padding: 6px; }
  .menu a { flex: 1 1 auto; justify-content: center; font-size: 14px; }
  .brand small { display: none; }
  .s-panel { padding-left: 16px; padding-right: 16px; }
  .s-rail a { margin: 2px; min-width: 0; }
  .table-foot, .save-bar, .report-head, .date-nav { flex-wrap: wrap; }
  .table-foot > *, .save-bar > * { min-width: 0; }
  .item-book select, .item-book input { max-width: 100%; }
  .item-book .inline-form { align-items: stretch; }
  .att-form .memo, .item-row input, .part-title { min-height: 44px !important; }
  .field.compact input, .field.compact select { min-height: 44px; }
  .bubbles { flex-wrap: wrap; }
  .login-card { width: 100%; }
  .kiosk { padding: 16px; }
  .kiosk header { font-size: 18px; }
  .kiosk .clock { font-size: 22px; }
  .kiosk-guide { font-size: 22px; text-align: center; }
  .keys { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 320px); gap: 10px; }
  .kiosk-pad { min-width: 0; }
  .link-row input { min-width: 0; flex-basis: 100%; }
}
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
@media (max-width: 860px) {
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { white-space: normal; min-height: 44px; }
}
@media print {
  .with-side { display: block; }
  .side, .skip-link { display: none !important; }
}

/* Tables keep words whole (no 김/하/늘 one letter per line on phones); a wide table scrolls inside .table-wrap instead. */
table.grid th, table.grid td { overflow-wrap: normal; word-break: keep-all; }
@media (max-width: 700px) {
  .table-wrap > table.grid { min-width: 600px; }
  .table-wrap > table.grid.compact { min-width: 460px; }
  .page-head > .date-nav { flex: 1 1 100%; order: 3; flex-wrap: nowrap; }
  .date-nav form { flex: 1; min-width: 0; }
  .date-nav input { width: 100%; min-width: 0; }
}

/* Top-right tools: one height, icon + label, the account menu as the same kind of pill. */
.tool { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; line-height: 1; }
.tool .icon { width: 16px; height: 16px; }
.usermenu summary { width: auto; min-width: 0; height: 40px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  font-size: var(--font-small); font-weight: 600; color: #e5e7eb; line-height: 1; }
.usermenu summary .icon { width: 16px; height: 16px; }
.usermenu summary .who { max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu summary .caret { font-style: normal; font-size: 10px; color: #9ca3af; }
.usermenu summary:hover, .usermenu[open] summary { border-color: #6b7280; color: #fff; }
@media (max-width: 700px) {
  .tool span, .usermenu summary .who { display: none; }
  .tool, .usermenu summary { padding: 0 10px; min-width: 40px; justify-content: center; }
}
/* 화면으로 보기 */
.view-banner { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px;
  background: #fef3c7; color: #78350f; border-bottom: 1px solid #f59e0b; font-size: var(--font-small); }
.view-banner span { flex: 1; min-width: 200px; }
.view-banner .btn { background: #78350f; color: #fff; border-color: #78350f; }
.icon-btn.view-as { min-width: 32px; min-height: 32px; width: 32px; height: 32px; padding: 0; vertical-align: middle; margin-left: 4px; }
.badge.role-super { background: #111; color: #fff; }
.badge.role-admin { background: var(--accent-soft); color: var(--text); }
.row-edit { display: inline-block; position: relative; }
.row-edit[open] > summary { margin-bottom: 8px; }
.row-edit form { margin-top: 6px; }
/* 관리 모드 스위치 (원장·최고관리자): off = 선생 모드 */
.mode-switch { display: contents; }
.mode-switch .tool { background: none; cursor: pointer; font: inherit; font-size: var(--font-small); }
.mode-switch .switch { width: 30px; height: 18px; border-radius: 9px; background: #4b5563; position: relative; flex: none; }
.mode-switch .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.mode-switch .tool.on .switch { background: var(--accent); }
.mode-switch .tool.on .switch::after { left: 14px; }
td.center, th.center { text-align: center; }
.badge.role-counselor { background: #e0f2fe; color: #075985; }
/* 자격 표시: which capacity a privileged menu/button is used in (최고관리자 / 원장 / 상담) */
.cap { display: inline-flex; align-items: center; font-style: normal; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: -.01em;
  padding: 3px 6px; border-radius: 999px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.cap-super { background: #fde68a; color: #78350f; }
.cap-admin { background: #ffedd5; color: #9a3412; }
.cap-counselor { background: #e0f2fe; color: #075985; }
.cap-teacher { background: #e5e7eb; color: #374151; }
.menu .cap, .topnav .cap { margin-left: 5px; }
.icon-btn.view-as { outline: 2px solid #fde68a; outline-offset: -2px; }
/* The staff bar holds up to 7 menus + 4 tools: keep it on one line on ordinary laptop widths */
@media (min-width: 1001px) and (max-width: 1560px) {
  .topnav { gap: 14px; padding-left: 16px; padding-right: 16px; }
  .topnav .menu { gap: 2px; }
  .topnav .menu a { padding-left: 10px; padding-right: 10px; }
  .topnav .tools { gap: 6px; }
  .topnav .tool { padding: 0 10px; }
  .brand small { display: none; }
}
@media (min-width: 1001px) and (max-width: 1320px) {
  .topnav .tool:not(.on) span, .topnav .tool span { display: none; }
}

/* ---------- 메일 (webmail) ---------- */
.mail-page { max-width: 1440px; }
.mail-app { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.mail-nav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: var(--space-2); }
.mail-compose-btn { justify-content: flex-start; gap: 10px; padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); }
.mail-folders, .mail-boxes { display: flex; flex-direction: column; gap: 1px; }
.mail-folders a, .mail-boxes a, .mail-nav-link { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 0 20px 20px 0; color: var(--text); text-decoration: none; min-height: 36px; }
.mail-folders a:hover, .mail-boxes a:hover, .mail-nav-link:hover { background: var(--line); color: var(--text); }
.mail-folders a.on, .mail-boxes a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.mail-folders a > span, .mail-boxes a > span { flex: 1; min-width: 0; }
.mail-boxes a > span { display: flex; flex-direction: column; line-height: 1.25; }
.mail-boxes a b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.mail-boxes a small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-nav .count { font-style: normal; font-size: 12px; font-weight: 700; }
.mail-nav-title { margin: var(--space-3) 0 2px 14px; font-size: 12px; color: var(--muted); font-weight: 700; }
.mail-nav .hint { margin: var(--space-2) 14px; }
.mail-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 4px 8px 4px 16px; margin-bottom: var(--space-3); box-shadow: var(--shadow); }
.mail-search > .icon { color: var(--muted); flex: none; }
.mail-search input[name=q] { border: 0; outline: 0; background: transparent; min-height: 40px; padding: 0; }
.mail-nav-toggle { display: none; }
.mail-listcard { padding: 0; overflow: hidden; }
.mail-toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); min-height: 48px; }
.mail-toolbar .grow { flex: 1; }
.mail-toolbar .icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; text-decoration: none; font-size: 20px; }
.mail-actions { display: flex; gap: 2px; }
.mail-listcard:not(.has-sel) .mail-actions { visibility: hidden; }
.mail-range { margin-left: auto; color: var(--muted); font-size: var(--font-small); padding: 0 6px; white-space: nowrap; }
.mail-alert { margin: 8px 12px; }
.mail-rows { list-style: none; margin: 0; padding: 0; }
.mail-row { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--line); background: var(--panel); }
.mail-row:last-child { border-bottom: 0; }
.mail-row.unread { background: var(--surface); }
.mail-row.sel { background: var(--accent-soft); }
.mail-row:hover { box-shadow: inset 1px 0 0 var(--line-2), inset -1px 0 0 var(--line-2), 0 1px 3px rgba(16, 24, 40, .12); position: relative; z-index: 1; }
.mail-row .check { justify-self: center; }
.mail-row.on { background: var(--accent-soft); }
.mail-link { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px 14px 10px 4px; color: var(--text); text-decoration: none; min-width: 0; }
.mail-link:hover { color: var(--text); }
.mail-thread .mail-row { grid-template-columns: minmax(0, 1fr); }
.mail-thread .mail-link { padding-left: 16px; }
.mail-who, .mail-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subj b { font-weight: 500; }
.mail-snip { color: var(--muted); }
.mail-row.unread .mail-who, .mail-row.unread .mail-subj b { font-weight: 800; }
.mail-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--font-small); white-space: nowrap; }
.mail-row.unread .mail-meta time { color: var(--text); font-weight: 700; }
.mail-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.star { border: 0; background: transparent; padding: 4px; cursor: pointer; color: var(--line-2); display: inline-grid; place-items: center; }
.star .icon { width: 18px; height: 18px; }
.star:hover { color: var(--muted); }
.star.on { color: var(--accent-ink); }
.star.on .icon { fill: currentColor; }
.mail-status { margin: var(--space-2) 4px; }
/* reading */
.mail-read { padding: 0 0 var(--space-4); overflow: hidden; }
.mail-read .mail-toolbar { padding: 6px 12px; }
.mail-read .mail-toolbar .btn .icon { width: 16px; height: 16px; }
.mail-title { font-size: 22px; margin: var(--space-4) var(--space-5) var(--space-3); overflow-wrap: anywhere; }
.mail-head { display: flex; gap: var(--space-3); align-items: flex-start; padding: 0 var(--space-5); }
.mail-head-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 800; }
.mail-rcpt summary { cursor: pointer; list-style: revert; }
.mail-rcpt dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: var(--font-small); }
.mail-rcpt dt { color: var(--muted); }
.mail-rcpt dd { margin: 0; overflow-wrap: anywhere; }
.mail-atts { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--space-3) var(--space-5) 0; }
.mail-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; font-size: var(--font-small); }
.mail-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mail-chip small { color: var(--muted); flex: none; }
.mail-chip:hover { border-color: var(--accent-ink); color: var(--text); }
.mail-chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; padding: 0 2px; }
.mail-imgnote { margin: var(--space-3) var(--space-5) 0; }
.mail-body { display: block; width: calc(100% - 2 * var(--space-5)); min-height: 120px; border: 0; margin: var(--space-4) var(--space-5) 0; background: var(--surface); }
.mail-quick { padding: var(--space-4) var(--space-5) 0; }
.mail-quick .btn { border-radius: 20px; }
.mail-thread { margin-top: var(--space-4); padding: 0; overflow: hidden; }
.mail-thread h2 { padding: 12px 16px 6px; margin: 0; font-size: 15px; }
/* compose */
.mail-compose { max-width: 960px; margin: 0 auto; padding: 0; overflow: hidden; }
.mail-compose-head { display: flex; align-items: center; gap: var(--space-3); padding: 10px 14px; background: var(--chrome); color: var(--chrome-text); }
.mail-compose-head h1 { flex: 1; font-size: 16px; margin: 0; color: inherit; }
.mail-compose-head .icon-btn { color: var(--chrome-text); display: inline-grid; place-items: center; }
.mail-fields { padding: 0 var(--space-4); }
.mail-field { display: flex; align-items: center; gap: var(--space-3); border-bottom: 1px solid var(--line); min-height: 46px; }
.mail-field > span { width: 76px; flex: none; color: var(--muted); font-size: var(--font-small); }
.mail-field input, .mail-field select { border: 0; outline: 0; padding: 8px 0; min-height: 44px; background: transparent; }
.mail-field input:focus, .mail-field select:focus { outline: 0; }
.mail-field.hidden { display: none; }
.chips-input { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; min-width: 0; cursor: text; }
.chips-input .chip-typing { flex: 1; min-width: 160px; min-height: 30px; padding: 2px 0; }
.addr-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); font-size: var(--font-small); max-width: 100%; }
.addr-chip.bad { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.addr-chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 6px var(--space-4); border-bottom: 1px solid var(--line); background: var(--panel); }
.rte-bar button { border: 0; background: transparent; min-width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text); }
.rte-bar button:hover { background: var(--line); }
.rte-bar .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 6px; }
.rte-color { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; cursor: pointer; font-weight: 800; }
.rte-color input { position: absolute; inset: auto 4px 2px; width: 24px; height: 6px; padding: 0; border: 0; min-height: 0; cursor: pointer; }
.rte { min-height: 300px; max-height: 60vh; overflow: auto; padding: var(--space-4); outline: 0; line-height: 1.65; overflow-wrap: anywhere; }
.rte blockquote { margin: 0 0 0 .6em; padding-left: .8em; border-left: 3px solid var(--line-2); color: var(--muted); }
.rte img { max-width: 100%; }
.drop-zone { margin: 0 var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.drop-zone .mail-atts { margin: 0 0 var(--space-2); }
.drop-zone.over { outline: 2px dashed var(--accent); outline-offset: 4px; background: var(--accent-soft); border-radius: var(--radius-sm); }
.drop-hint { display: flex; align-items: center; gap: 8px; padding: 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); color: var(--muted); cursor: pointer; font-size: var(--font-small); }
.drop-hint:hover { border-color: var(--accent-ink); color: var(--text); }
.mail-compose > .hint { padding: 0 var(--space-4) var(--space-4); }
@media (max-width: 860px) {
  .mail-app { grid-template-columns: 1fr; }
  .mail-nav { display: none; position: fixed; inset: 0 20% 0 0; top: 0; z-index: 50; background: var(--surface); padding: var(--space-4) var(--space-2); overflow-y: auto; box-shadow: var(--shadow-menu); }
  .mail-nav.open { display: flex; }
  .mail-nav-toggle { display: inline-grid; place-items: center; margin-left: -8px; }
  .mail-search { padding-left: 8px; }
  .mail-row { grid-template-columns: 30px 28px minmax(0, 1fr); }
  .mail-link { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who meta" "subj subj"; gap: 2px 8px; padding: 10px 12px 10px 2px; }
  .mail-link .mail-who { grid-area: who; } .mail-link .mail-meta { grid-area: meta; } .mail-link .mail-subj { grid-area: subj; }
  .mail-thread .mail-link { padding-left: 14px; }
  .mail-title { margin: var(--space-3) var(--space-4) var(--space-2); font-size: 19px; }
  .mail-head, .mail-quick { padding-left: var(--space-4); padding-right: var(--space-4); }
  .mail-head > time { display: none; }
  .mail-atts, .mail-imgnote { margin-left: var(--space-4); margin-right: var(--space-4); }
  .mail-body { width: calc(100% - 2 * var(--space-4)); margin: var(--space-3) var(--space-4) 0; }
  .mail-read .mail-toolbar .btn span { display: none; }
  .mail-compose { margin: 0 -16px; border-radius: 0; }
  .mail-fields { padding: 0 var(--space-3); }
  .mail-field > span { width: 58px; }
  .rte { min-height: 220px; padding: var(--space-3); }
  .drop-zone { margin: 0 var(--space-3); }
}

/* Visual refinement — all surfaces and accents follow the shared theme. */
.mail-page { padding-top: 24px; }
.mail-page > .notice-card { border-color: var(--line); border-left: 3px solid var(--accent); background: var(--surface); padding: 14px 18px; margin-bottom: 20px; font-size: var(--font-small); }
.mail-app { grid-template-columns: 224px minmax(0, 1fr); gap: 24px; }
.mail-main { min-width: 0; }
.mail-nav { padding-top: 4px; gap: 12px; }
.mail-compose-btn { border-radius: 16px; min-height: 52px; margin-bottom: 4px; box-shadow: none; }
.mail-folders a, .mail-boxes a, .mail-nav-link { min-height: 44px; border-radius: 10px; }
.mail-nav .count { min-width: 24px; text-align: center; }
.mail-boxes { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.mail-nav-title { letter-spacing: .03em; margin-bottom: 8px; }
.mail-section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 4px 14px; }
.mail-section-head h1 { font-size: 22px; }
.mail-search { border-radius: 12px; box-shadow: none; padding: 4px 16px; margin-bottom: 16px; background: var(--surface); }
.mail-search input[name=q] { flex: 1; width: 0; min-width: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.mail-search:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.mail-listcard { overflow: visible; border-radius: 14px; box-shadow: var(--shadow); }
.mail-listcard .mail-toolbar { position: sticky; top: 0; z-index: 3; background: var(--surface); border-radius: 14px 14px 0 0; }
.mail-toolbar { gap: 4px; padding: 8px 12px; min-height: 60px; }
.mail-toolbar .icon-btn, .star { border-radius: 8px; }
.mail-toolbar .icon-btn:hover, .star:hover { background: var(--line); }
.mail-listcard:not(.has-sel) .mail-actions { display: none; }
.mail-toolbar .check { display: grid; place-items: center; min-width: 36px; }
.mail-row { grid-template-columns: 40px 36px minmax(0, 1fr); min-height: 60px; }
.mail-row:last-child { border-radius: 0 0 14px 14px; }
.mail-link { grid-template-columns: minmax(110px, 22%) minmax(0, 1fr) auto; min-height: 60px; padding-right: 20px; gap: 20px; }
.mail-row.unread { box-shadow: inset 3px 0 var(--accent); }
.mail-row.unread .mail-who { display: flex; align-items: center; gap: 8px; }
.mail-row.unread .mail-who::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.mail-row.sel { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.mail-row:hover { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); box-shadow: inset 0 0 0 1px var(--line-2); }
.mail-row.unread .mail-who, .mail-row.unread .mail-subj b { font-weight: 700; }
.star { width: 36px; height: 44px; }
.star.on { color: var(--accent-ink); }
.mail-alert { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; padding: 10px 12px; }
.mail-status { margin: 14px 4px; line-height: 1.7; }
.mail-empty { padding: 64px 24px; min-height: 240px; }
.mail-empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--panel); color: var(--muted); }
.mail-empty-icon .icon { width: 28px; height: 28px; }
.mail-nav-mobile-head, .mail-nav-backdrop { display: none; }
.mail-read { border-radius: 16px; }
.mail-read .mail-toolbar { background: var(--panel); }
.mail-read .mail-toolbar .btn { background: var(--surface); }
.mail-title { font-size: 26px; margin: 28px 32px 20px; line-height: 1.4; }
.mail-head { padding: 0 32px 20px; border-bottom: 1px solid var(--line); }
.avatar { width: 44px; height: 44px; background: var(--accent-soft); color: var(--accent-ink); }
.mail-head-main > div { margin-bottom: 2px; }
.mail-atts { margin-left: 32px; margin-right: 32px; }
.mail-chip { min-height: 44px; border-color: var(--line); background: var(--panel); border-radius: 10px; }
.mail-chip > .icon:first-child { color: var(--accent-ink); }
.mail-chip > .icon:last-child { width: 16px; }
.mail-imgnote { margin: 20px 32px 0; padding: 8px 12px; background: var(--panel); border-radius: 8px; }
.mail-body { margin: 24px 32px 0; width: calc(100% - 64px); background: var(--surface); }
.mail-quick { padding: 24px 32px 8px; }
.mail-quick .btn { border-radius: 10px; padding-left: 18px; padding-right: 18px; }
.mail-thread h2 { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.mail-compose { max-width: 1040px; border-radius: 16px; box-shadow: var(--shadow-menu); }
.mail-compose-head { padding: 12px 20px; }
.mail-compose-head .primary { padding-left: 20px; padding-right: 20px; }
.mail-fields { padding: 8px 24px 0; }
.mail-field { min-height: 54px; gap: 12px; }
.mail-field:focus-within { box-shadow: 0 1px var(--focus); }
/* Match global input specificity; keep focus visible on the whole field line. */
.mail-compose .mail-field input:not([type=hidden]), .mail-compose .mail-field select { border: 0; border-radius: 0; padding: 8px 0; min-height: 44px; background: transparent; box-shadow: none; outline: none; min-width: 0; }
.mail-field > input, .mail-field > select { flex: 1; width: 0; }
.mail-compose .chips-input .chip-typing { width: 80px; min-width: 60px; min-height: 32px; }
.mail-field > .linkbtn { flex: none; white-space: nowrap; font-size: 12px; }
.addr-chip { background: var(--accent-soft); border-color: var(--accent-soft); padding-left: 10px; overflow-wrap: anywhere; }
.rte-bar { margin-top: 12px; padding: 6px 24px; background: var(--panel); border-top: 1px solid var(--line); }
.rte-bar button, .rte-color { width: 36px; height: 36px; }
.mail-compose .rte-color input { min-height: 0; height: 5px; width: 24px; padding: 0; border: 0; border-radius: 0; }
.rte-color:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.rte { padding: 24px; min-height: 340px; max-height: none; }
.rte:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rte:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.drop-zone { margin: 0 24px; }
.drop-zone .mail-atts:empty, #att-size:empty { display: none; }
.drop-hint { background: var(--panel); min-height: 52px; }
.mail-compose > .hint { padding: 8px 24px 20px; line-height: 1.7; }
@media (max-width: 860px) {
  .mail-app { grid-template-columns: minmax(0, 1fr); }
  .mail-section-head { margin-bottom: 12px; }
  .mail-nav { inset: 0 auto 0 0; width: min(320px, calc(100vw - 48px)); padding: 16px; z-index: 61; border-radius: 0 16px 16px 0; gap: 12px; }
  .mail-nav-mobile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .mail-nav-close { display: grid; place-items: center; }
  .mail-nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: color-mix(in srgb, var(--chrome) 40%, transparent); border: 0; z-index: 60; }
  body.mail-drawer-open { overflow: hidden; }
  .mail-search { padding-left: 8px; }
  .mail-row { grid-template-columns: 40px 40px minmax(0, 1fr); min-height: 80px; }
  .mail-link { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 12px 12px 12px 4px; min-height: 80px; }
  .star { width: 40px; }
  .mail-row .check { width: 40px; display: grid; place-items: center; }
  .mail-toolbar { padding: 6px; gap: 0; }
  .mail-toolbar .icon-btn { width: 44px; min-width: 44px; }
  .mail-range { padding: 0 4px; font-size: 12px; }
  .mail-title { margin: 20px 16px 16px; font-size: 22px; }
  .mail-head { padding: 0 16px 16px; gap: 10px; }
  .mail-head > time { display: block; font-size: 11px; flex: none; }
  .mail-head { flex-wrap: wrap; }
  .mail-head > time { margin-left: 54px; margin-top: -8px; }
  .mail-atts, .mail-imgnote { margin-left: 16px; margin-right: 16px; }
  .mail-body { margin: 20px 16px 0; width: calc(100% - 32px); }
  .mail-quick { padding: 20px 16px 0; gap: 6px; }
  .mail-quick .btn { padding: 8px 12px; }
  .mail-read .mail-toolbar .btn { min-width: 44px; padding: 8px; }
  .mail-compose { margin: 0; }
}
@media (max-width: 600px) {
  .mail-page { padding: 16px 12px 32px; }
  .mail-listcard { border-radius: 12px; }
  .mail-actions { gap: 0; }
  .has-sel .mail-range { display: none; }
  .mail-snip { font-size: 13px; }
  .mail-read { margin: 0 -12px; border-left: 0; border-right: 0; border-radius: 0; }
  .mail-compose { margin: -16px -12px -32px; border: 0; border-radius: 0; min-height: 100dvh; box-shadow: none; }
  .mail-compose-head { position: sticky; top: 0; z-index: 10; padding: 10px 12px; }
  .mail-fields { padding: 4px 16px 0; }
  .mail-field { gap: 8px; }
  .mail-field > span { width: 64px; font-size: 12px; }
  .mail-field > .linkbtn { font-size: 11px; }
  .chips-input { gap: 4px; }
  .addr-chip button, .mail-chip button { min-width: 44px; min-height: 44px; }
  .addr-chip { padding: 0 0 0 8px; border-radius: 12px; }
  .rte-bar { padding: 4px 8px; flex-wrap: nowrap; overflow-x: auto; }
  .rte-bar button, .rte-color { min-width: 44px; width: 44px; height: 44px; flex: none; }
  .rte-bar .sep { margin: 0 2px; flex: none; }
  .rte { padding: 20px 16px; min-height: 40dvh; }
  .drop-zone { margin: 0 16px; }
  .mail-compose > .hint { padding: 8px 16px 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .mail-row, .mail-folders a, .mail-chip { transition: background-color .15s, border-color .15s; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .mail-nav.open { animation: mail-drawer-in .18s ease-out; }
  @keyframes mail-drawer-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
}
.mail-search input[name=q], .mail-search input[name=q]:focus { border: 0; box-shadow: none; outline: 0; background: transparent; padding: 0; }
.mail-search:focus-within { border-color: var(--accent-ink); }
.mail-settings h2 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail-settings .sig-edit { min-height: 110px; max-height: 300px; border: 1px solid var(--line-2); border-radius: var(--radius-control); background: var(--surface); }
.rte .gq-sig { color: var(--muted); }
/* 메일 라벨 */
.lab-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--lab, #9aa1ab); }
.lab-chip { display: inline-block; font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1.5; padding: 0 6px; margin-right: 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--lab, #9aa1ab) 16%, var(--surface)); color: color-mix(in srgb, var(--lab, #9aa1ab) 75%, var(--text)); vertical-align: 1px; }
.lab-gray { --lab: #8a93a0; } .lab-red { --lab: #d92d20; } .lab-orange { --lab: #ef6c00; } .lab-yellow { --lab: #c59a00; } .lab-green { --lab: #15804d; }
.lab-teal { --lab: #0f8b8d; } .lab-blue { --lab: #2e6be6; } .lab-purple { --lab: #7c4dcc; } .lab-pink { --lab: #d63384; }
.mail-labels { display: flex; flex-direction: column; gap: 1px; }
.mail-labels a { display: flex; align-items: center; gap: 12px; padding: 7px 14px; border-radius: 0 20px 20px 0; color: var(--text); text-decoration: none; min-height: 34px; }
.mail-labels a:hover { background: var(--line); }
.mail-labels a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.mail-labels a > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-nav-more { float: right; font-weight: 500; font-size: 12px; margin-right: 12px; }
.mail-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.mail-tabs a { padding: 10px 16px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; font-size: 14px; }
.mail-tabs a.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.mail-tabs .count { font-style: normal; font-size: 11px; background: var(--accent); color: var(--accent-text); border-radius: 9px; padding: 0 6px; }
.mail-labelsel { width: auto; min-height: 32px; padding: 2px 8px; font-size: 13px; }
.mail-labels-page h2 { font-size: 16px; margin: 0; }
.mail-labels-page h3 { font-size: 14px; margin: 8px 0 0; }
.rule-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rule-text { min-width: 0; overflow-wrap: anywhere; }
.label-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.label-row input[name=name] { flex: 1; min-width: 120px; }
.label-row select { width: auto; }

/* ---------- 모바일 상단 바 + 메뉴 서랍 (2026-10-16) ---------- */
.navdrawer { display: contents; }
.m-title, .m-mail, .m-burger, .nav-scrim { display: none; }
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px; }   /* iOS 가 입력할 때 화면을 확대하지 않게 */
  .topnav { flex-wrap: nowrap; height: 56px; min-height: 56px; padding: 0 6px 0 12px; gap: 6px; position: sticky; top: 0; }
  .topnav .brand { flex: none; }
  .topnav .brand span, .topnav .brand small { display: none; }
  .m-title { display: block; flex: 1; min-width: 0; color: #fff; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-mail, .m-burger { display: inline-grid; place-items: center; position: relative; width: 44px; height: 44px; border: 0; border-radius: var(--radius-control);
    background: transparent; color: #fff; cursor: pointer; flex: none; }
  .m-mail:hover, .m-burger:hover { background: var(--chrome-2); color: #fff; }
  .m-mail .icon, .m-burger .icon { width: 22px; height: 22px; }
  .m-mail .nav-badge { position: absolute; top: 4px; right: 2px; }
  .navdrawer { display: flex; flex-direction: column; gap: var(--space-4); position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 320px);
    padding: var(--space-4) var(--space-3) calc(var(--space-5) + env(safe-area-inset-bottom)); background: var(--chrome); overflow-y: auto; z-index: 60;
    transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: -12px 0 32px rgba(0, 0, 0, .35); }
  .navdrawer.open { transform: none; visibility: visible; transition: transform .2s ease; }
  .topnav .navdrawer .menu { order: 0; flex: none; flex-direction: column; flex-wrap: nowrap; gap: 2px; overflow: visible; }
  .topnav .navdrawer .menu a { justify-content: flex-start; font-size: 16px; padding: 10px 14px; flex: none; }
  .topnav .navdrawer .menu .cap, .topnav .navdrawer .tools .cap { display: none; }
  .topnav .navdrawer .tools { order: 1; flex: none; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: var(--space-2); margin: 0;
    padding-top: var(--space-3); border-top: 1px solid #333; }
  .topnav .navdrawer .tool { display: flex; justify-content: flex-start; font-size: 15px; padding: 10px 14px; width: 100%; }
  .topnav .navdrawer .mode-switch, .topnav .navdrawer .mode-switch .tool { width: 100%; }
  .navdrawer .usermenu summary { width: 100%; justify-content: flex-start; display: flex; gap: 8px; padding: 0 14px; }
  .navdrawer .usermenu .who { display: inline; }
  .navdrawer .usermenu .drop { position: static; margin-top: var(--space-2); min-width: 0; box-shadow: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; border: 0; background: rgba(0, 0, 0, .45); }
  .page { padding-left: 12px; padding-right: 12px; }
  .table-wrap { overflow-x: auto; }
  /* 메일 쓰기: 보내는 주소는 한 줄로 줄이고, 서식 도구는 그 줄 안에서 옆으로 */
  .mail-field { min-width: 0; }
  .mail-field select { min-width: 0; width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; padding-right: 24px; }
  .rte-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .rte-bar::-webkit-scrollbar { display: none; }
  .rte-bar > * { flex: none; }
  .mail-compose .rte { min-height: calc(100dvh - 380px); }
  .mail-page { padding-top: var(--space-2); }
}
@media (max-width: 768px) {
  .topnav .navdrawer .tool span, .navdrawer .usermenu summary .who { display: inline; max-width: none; }
  .topnav .navdrawer .tool { gap: 10px; }
  .navdrawer .mode-switch .tool { justify-content: space-between; }
  .page-head .head-right { margin-left: 0; flex-basis: 100%; }
  .page-head > .muted { white-space: normal; }
  .audit-filters { grid-template-columns: minmax(0, 1fr) !important; }
  /* 메일 읽기: 도구 줄은 감싸고, 보낸 사람 주소는 한 줄로 */
  .mail-read .mail-toolbar { flex-wrap: wrap; row-gap: 4px; }
  .mail-read .mail-toolbar .grow { flex-basis: 100%; height: 0; }
  .mail-read .mail-toolbar .btn { flex: 1 1 0; justify-content: center; }
  .mail-read .mail-toolbar .btn span { display: inline; }
  .mail-head-main > div:first-child { display: flex; flex-direction: column; min-width: 0; }
  .mail-head-main > div:first-child .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .mail-rcpt summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-head > time { display: none; }
  .mail-labelsel { max-width: 110px; }
  /* 메일 목록: 여러 통을 고르면 나오는 도구가 화면 밖으로 밀리지 않게 */
  .mail-listcard .mail-toolbar { flex-wrap: wrap; row-gap: 2px; padding: 4px 6px; }
  .mail-listcard .mail-actions { flex-wrap: wrap; gap: 0; min-width: 0; }
  .mail-listcard:not(.has-sel) .mail-actions { display: none; }
  .mail-listcard .mail-toolbar .icon-btn { width: 40px; height: 40px; }
  .mail-main, .mail-listcard, .mail-search { min-width: 0; max-width: 100%; }
  .mail-app { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .navdrawer { transition: none !important; } }

/* ---------- 메일: 휴대폰 목록 (네이버 메일·그룹웨어 앱처럼, 2026-10-16) ---------- */
.m-mailhead, .m-pills, .mail-fab, .mail-chips, .mail-tcount, .m-only { display: none; }
@media (max-width: 768px) {
  .mail-page { padding: 0 0 96px; }
  .mail-main > .mail-section-head, .mail-listcard .mail-tabs { display: none; }
  .mail-search { display: none; margin: 0 12px 8px; }
  body.m-search-open .mail-search { display: flex; }
  .mail-search .mail-nav-toggle { display: none; }
  .m-mailhead { display: flex; align-items: center; gap: 2px; padding: 6px 6px 2px 4px; }
  .m-mailhead h1 { flex: 1; min-width: 0; margin: 0; font-size: 21px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-mailhead h1 b { color: var(--accent-ink); font-weight: 700; margin-left: 4px; }
  .m-mailhead .icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; }
  .m-mailhead .icon-btn .icon { width: 22px; height: 22px; }
  .m-only { display: inline-grid; }
  .m-pills { display: flex; gap: 8px; overflow-x: auto; padding: 6px 12px 12px; scrollbar-width: none; }
  .m-pills::-webkit-scrollbar { display: none; }
  .m-pills a { flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border: 1px solid var(--line-2);
    border-radius: 20px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap; }
  .m-pills a.on { border: 2px solid var(--accent); color: var(--accent-ink); padding: 0 15px; }
  .m-pills a .dot { position: absolute; top: 5px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .m-pills a.plus { width: 38px; padding: 0; justify-content: center; font-size: 22px; font-weight: 400; color: var(--muted); }
  .mail-listcard { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .mail-listcard .mail-toolbar { display: none; }
  .mail-listcard.has-sel .mail-toolbar { display: flex; position: fixed; left: 8px; right: 8px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
    background: var(--chrome); border-radius: 16px; padding: 6px 8px; box-shadow: var(--shadow-menu); }
  .mail-listcard.has-sel .mail-toolbar .icon-btn { color: #fff; }
  .mail-listcard.has-sel .mail-toolbar .mail-labelsel { background: var(--chrome-2); color: #fff; border-color: #444; }
  .mail-listcard.has-sel .mail-toolbar .mail-range, .mail-listcard.has-sel .mail-toolbar [form=mail-refresh], .mail-listcard.has-sel .mail-toolbar > a { display: none; }
  .mail-listcard.has-sel .mail-all { order: -1; }
  .mail-row { grid-template-columns: minmax(0, 1fr) 40px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; }
  .mail-row:hover { box-shadow: none; }
  .mail-row .check { display: none; }
  .mail-listcard.selecting .mail-row { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .mail-listcard.selecting .mail-row .check { display: grid; }
  .mail-row .star { order: 3; align-self: start; margin-top: 34px; }
  .mail-row.sel { background: var(--accent-soft); }
  .mail-link { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who meta" "subj tc" "chips chips"; gap: 4px 8px; padding: 14px 0 14px 16px; min-height: 76px; }
  .mail-listcard.selecting .mail-link { padding-left: 4px; }
  .mail-link .mail-who { grid-area: who; font-size: 16px; }
  .mail-link .mail-meta { grid-area: meta; font-size: 13px; }
  .mail-link .mail-subj { grid-area: subj; font-size: 15px; }
  .mail-link .mail-snip, .mail-link .mail-subj .lab-chip { display: none; }
  .mail-tcount { display: inline-grid; grid-area: tc; justify-self: end; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e8f0fe; color: #1a56db; font-size: 12px; font-weight: 700; }
  .mail-chips { display: flex; grid-area: chips; flex-wrap: wrap; gap: 4px; }
  .mail-chips .lab-chip { margin: 0; font-size: 12px; padding: 1px 8px; }
  .mail-row.unread { box-shadow: none; }
  .mail-listcard.selecting .mail-row.unread .mail-who::before { display: none; }
  .mail-fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30; width: 58px; height: 58px;
    border-radius: 50%; background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 18px rgba(255, 106, 0, .4); }
  .mail-fab .icon { width: 24px; height: 24px; }
  .mail-listcard.has-sel ~ .mail-fab, body.nav-open .mail-fab, body.mail-drawer-open .mail-fab { display: none; }
  .mail-read { max-width: 100%; overflow: hidden; }
  .mail-read .mail-toolbar .icon-btn { width: 38px; min-width: 38px; height: 40px; }
  .mail-read .mail-labelsel { max-width: 88px; }
  .mail-status { padding: 0 12px; }
  .mail-nav .mail-compose-btn { display: none; }
  .mail-page .mail-compose { margin: 0; border-radius: 0; }
  .mail-page > .mail-read, .mail-page > .mail-thread, .mail-page > .notice-card { margin-left: 0; margin-right: 0; }
}
td.mail-count { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.mail-who-note { display: inline-flex; align-items: center; min-height: 40px; flex: 1; min-width: 140px; }
tr.host-row td { background: var(--panel); }
/* mail.gqmath.com: 메일 전용 상단 바 */
.topnav.mailonly .menu a { font-size: 15px; }
.topnav.mailonly .brand span { display: inline; }

/* ---------- 그룹웨어식 메일 틀 (기본 뼈대 — 꾸밈은 아래 gw 디자인 블록) ---------- */
body.mailgw { background: var(--surface); }
.gw-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.gw-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 18px; }
.gw-brand img { width: 30px; height: 30px; border-radius: 8px; }
.gw-brand b { color: var(--accent); font-weight: 900; letter-spacing: -.02em; }
.gw-title { display: none; }
.gw-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.gw-tool { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; }
.gw-tool:hover { background: var(--panel); color: var(--text); }
.mailgw .usermenu summary { border-color: var(--line-2); color: var(--text); }
.gw-rail { position: fixed; top: 56px; left: 0; bottom: 0; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; background: var(--panel); border-right: 1px solid var(--line); z-index: 20; overflow-y: auto; }
.gw-rail-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 8px 0; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.gw-rail-item .icon { width: 24px; height: 24px; }
.gw-rail-item:hover { background: var(--line); color: var(--text); }
.gw-rail-item.on { color: var(--accent-ink); }
.gw-rail-item.on .icon { background: var(--accent); color: #fff; border-radius: 50%; padding: 8px; width: 40px; height: 40px; box-sizing: border-box; }
.gw-dot { position: absolute; top: 6px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; }
.gw-main { margin-left: 76px; }
.gw-tabbar { display: none; }
.mailgw .mail-page { max-width: none; padding: 0; }
.mailgw .mail-app { grid-template-columns: 260px minmax(0, 1fr); gap: 0; align-items: stretch; min-height: calc(100vh - 56px); }
.gw-side { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface); }
.gw-compose { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 12px; }
.gw-compose-btn { justify-content: center; }
.gw-folders, .gw-tree { display: flex; flex-direction: column; gap: 1px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.gw-folders a, .gw-tree a { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px calc(10px + var(--depth, 0) * 16px); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; min-height: 36px; }
.gw-folders a > span, .gw-tree a > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-folders a:hover, .gw-tree a:hover { background: var(--panel); }
.gw-folders a.on, .gw-tree a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.gw-side .count { font-style: normal; font-size: 12px; font-weight: 700; color: #1a56db; }
.gw-side .muted-count { color: var(--muted); }
.gw-tree-title { display: flex; align-items: center; justify-content: space-between; margin: 8px 6px 2px 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gw-boxes a > span { display: flex; flex-direction: column; line-height: 1.25; }
.gw-boxes small { color: var(--muted); font-size: 11.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.gw-pill { border: 1px solid var(--line-2); background: var(--surface); border-radius: 14px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; margin: 6px 10px; }
.gw-side-foot { padding: 10px; font-size: 12.5px; color: var(--muted); }
.gw-storage { display: flex; justify-content: space-between; margin-bottom: 8px; }
.gw-side-links { display: flex; gap: 4px; flex-wrap: wrap; }
.gw-side-links a { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.gw-side-links a:hover { background: var(--panel); color: var(--text); }
.gw-list { padding: 14px 20px 40px; min-width: 0; }
.gw-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gw-head h1 { margin: 0; font-size: 20px; white-space: nowrap; }
.gw-head h1 b { color: var(--accent-ink); margin-left: 4px; }
.gw-search { flex: 1; max-width: 520px; margin: 0 0 0 auto !important; }
.gw-listcard { padding: 0; overflow: visible; border-radius: 12px; }
.gw-toolbar { position: sticky; top: 56px; z-index: 5; background: var(--surface); flex-wrap: wrap; gap: 6px; }
.mailgw .mail-listcard:not(.has-sel) .mail-actions { visibility: visible; opacity: .55; }
.gw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.gw-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; padding: 6px 9px; border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; list-style: none; }
.gw-btn:hover { background: var(--panel); }
.gw-btn .icon { width: 17px; height: 17px; }
.gw-menu { position: relative; }
.gw-menu summary::-webkit-details-marker { display: none; }
.gw-menu-pop { position: absolute; top: 36px; left: 0; z-index: 20; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-menu); padding: 6px; display: flex; flex-direction: column; }
.gw-menu-pop button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.gw-menu-pop button:hover { background: var(--panel); }
.gw-view { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.gw-sel { width: auto; min-height: 32px; padding: 2px 8px; font-size: 13px; }
.mailgw .mail-row { grid-template-columns: 32px 30px 28px minmax(0, 1fr); background: var(--surface); }
.mailgw .mail-row.unread { background: var(--surface); }
.mailgw .mail-row:not(.unread) .mail-link { color: #4a5160; }
.gw-env { display: inline-grid; place-items: center; color: var(--muted); }
.gw-env .icon { width: 16px; height: 16px; }
.mail-row.unread .gw-env { color: var(--accent); }
.mailgw .mail-link { grid-template-columns: 190px minmax(0, 1fr) auto; padding: 9px 14px 9px 2px; }
.gw-dense .mailgw .mail-link, body.gw-dense .mail-link { padding-top: 4px; padding-bottom: 4px; }
.gw-where { color: var(--muted); font-size: 12.5px; margin-right: 6px; }
.gw-size { color: var(--muted); font-size: 12px; min-width: 52px; text-align: right; }
.d-narrow { display: none; }
.gw-empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.gw-empty-art .icon { width: 72px; height: 72px; color: #cfd4dc; }
@media (max-width: 768px) {
  .gw-top { height: 52px; }
  .gw-word { display: none; }
  .gw-title { display: block; flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gw-tool span { display: none; }
  .gw-rail { display: none; }
  .gw-main { margin-left: 0; padding-bottom: 64px; }
  .gw-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line); }
  .gw-tabbar > a, .gw-more summary { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; position: relative; list-style: none; cursor: pointer; }
  .gw-tabbar > a.on { color: var(--accent-ink); }
  .gw-tabbar .icon { width: 22px; height: 22px; }
  .gw-tabbar .nav-badge { position: absolute; top: 4px; left: calc(50% + 4px); }
  .gw-more { flex: 1; display: flex; }
  .gw-more summary::-webkit-details-marker { display: none; }
  .gw-more-menu { position: fixed; right: 8px; bottom: 66px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-menu); padding: 6px; display: flex; flex-direction: column; min-width: 160px; }
  .gw-more-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
  .mailgw .mail-app { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .gw-side { position: fixed; height: auto; top: 0; }
  .gw-head, .gw-tabs, .gw-view .gw-sel, .gw-density, .gw-env, .gw-size, .gw-where, .d-wide { display: none !important; }
  .d-narrow { display: inline; }
  .gw-list { padding: 0 0 40px; }
  .mailgw .mail-row { grid-template-columns: minmax(0, 1fr) 40px; }
  .mailgw .mail-listcard.selecting .mail-row { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .mailgw .mail-link { grid-template-columns: minmax(0, 1fr) auto; }
  .mail-fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .mail-listcard.has-sel .mail-toolbar { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
.gw-boxname { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

/* Mailplug-inspired light shell. Keep phone interaction layouts in the global sheet. */
body.mailgw { color-scheme: light; }
.mailgw :is(a,button,input,select,summary,[contenteditable]):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.mailgw .icon { stroke-linecap: round; stroke-linejoin: round; }
.gw-rail { background: var(--surface); gap: 6px; }
.gw-rail-item { font-weight: 400; min-height: 66px; justify-content: center; }
.gw-rail-item.on .icon { width: 44px; height: 44px; padding: 11px; box-shadow: 0 2px 5px #ff6a0026; }
.gw-dot { background: var(--accent); width: 5px; height: 5px; right: 10px; }
.gw-side { background: var(--panel); gap: 0; padding: 16px 12px; }
.gw-compose { gap: 8px; margin: 0 4px 12px; }
.gw-compose .btn { min-height: 44px; padding: 10px 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.gw-compose-btn { background: var(--accent); border-color: var(--accent); color: white; }
.gw-compose-btn:hover { background: var(--accent-ink); color: white; }
.gw-compose-btn .icon { display: none; }
.gw-folders a, .gw-tree a { min-height: 40px; border-radius: 0 24px 24px 0; font-weight: 400; }
.gw-folders a.on, .gw-tree a.on { background: var(--line); color: var(--text); font-weight: 600; }
.gw-side .count { color: var(--blue); min-width: 0; font-weight: 500; }
.gw-tree-title { color: var(--text); font-weight: 400; font-size: 13px; margin: 8px 4px; }
.gw-tree .lab-dot { width: 4px; height: 4px; margin: 0 8px; border-radius: 50%; background: var(--muted); flex: none; }
.gw-tree .icon { flex: none; width: 18px; height: 18px; }
.gw-tree .icon.tree-toggle { cursor: pointer; border-radius: 4px; transition: transform .15s; }
.gw-tree .icon.tree-toggle[aria-expanded=false] { transform: rotate(-90deg); }
.gw-side-foot { margin-top: auto; padding-top: 24px; }
.gw-storage b { color: var(--blue); font-weight: 400; }
.gw-pill { color: var(--muted); border-color: var(--line-2); }
.gw-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; min-height: 420px; font-size: 15px; }
.gw-empty-art .icon { width: 96px; height: 96px; overflow: visible; }
.gw-empty p { margin: 0; }
.gw-menu summary { flex-direction: row-reverse; }
.gw-btn { border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); min-height: 32px; padding: 4px 10px; }
.gw-btn:hover { border-color: var(--muted); background: var(--panel); }
.gw-actions { gap: 7px; }
.gw-actions > .gw-btn .icon { display: none; }
.gw-move { width: auto; max-width: 180px; min-height: 32px; border-radius: 4px; font-size: 13px; padding: 4px 8px; }
.gw-menu-pop button { color: var(--text); }
.gw-density[aria-pressed=true] { color: var(--accent-ink); background: var(--accent-soft); }
.mailgw .mail-read, .mailgw .mail-compose { border-radius: 12px; box-shadow: none; border-color: var(--line); margin: 24px; overflow: hidden; }
.mailgw .mail-read .mail-toolbar, .mailgw .mail-compose-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 20px; }
.mailgw .mail-title { font-size: 23px; line-height: 1.5; overflow-wrap: anywhere; }
.mailgw .mail-head { background: var(--panel); border-radius: 8px; }
.mailgw .mail-head-main, .mailgw .mail-head dd { min-width: 0; overflow-wrap: anywhere; }
.mailgw .avatar { background: var(--accent-soft); color: var(--accent-ink); }
.mailgw .mail-body { width: 100%; border: 0; background: var(--surface); }
.mailgw .mail-chip { border-color: var(--line); border-radius: 6px; max-width: 100%; }
.mailgw .mail-chip span { overflow-wrap: anywhere; min-width: 0; }
.mailgw .rte-bar { background: var(--panel); border-color: var(--line); flex-wrap: wrap; }
.mailgw .rte { min-height: 320px; padding: 24px; overflow-wrap: anywhere; }
.mailgw .chips-input:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.mailgw .addr-chip { background: var(--accent-soft); color: var(--accent-ink); border-radius: 16px; }
.mailgw .drop-zone { margin: 16px 20px; border: 1px dashed var(--line-2); border-radius: 8px; background: var(--panel); }
.mailgw .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.mailgw .mail-labels-page { gap: 24px; }
.mailgw .mail-labels-page .card { border-radius: 12px; box-shadow: none; border-color: var(--line); }
.mailgw .rule-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.mailgw .label-row { flex-wrap: wrap; }
@media (min-width: 769px) {
  .mailgw .mail-app { grid-template-columns: 250px minmax(0,1fr); }
  .mailgw .mail-nav { display: flex; position: sticky; top: 56px; height: calc(100vh - 56px); width: auto; inset-inline: auto; box-shadow: none; border-radius: 0; }
  .mailgw .mail-nav-mobile-head { display: none; }
  .gw-list { padding: 22px 24px 32px; }
  .gw-head { min-height: 44px; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
  .gw-head h1 { font-size: 18px; font-weight: 600; }
  .gw-head h1 b { color: var(--blue); font-size: 15px; font-weight: 400; }
  .gw-boxname { font-size: 12px; max-width: 180px; }
  .gw-search { flex: 0 1 300px; background: var(--panel); border: 0; border-radius: 24px; padding: 0 14px; }
  .gw-search input[name=q] { min-height: 38px; font-size: 13px; }
  .gw-refresh { border: 1px solid var(--line-2); border-radius: 50%; }
  .mailgw .gw-listcard { border: 0; border-radius: 0; box-shadow: none; }
  .mailgw .gw-listcard .gw-toolbar { top: 56px; border-radius: 0; padding: 8px 0 14px; gap: 8px; min-height: 54px; }
  .gw-sel { border: 0; background: transparent; min-height: 32px; }
  .mail-range { font-size: 11px; color: var(--muted); }
  .mailgw .mail-row { min-height: 44px; grid-template-columns: 28px 28px 26px minmax(0,1fr); box-shadow: none; border-bottom: 1px solid var(--line); border-radius: 0; }
  .mailgw .mail-row:hover { background: var(--panel); box-shadow: none; }
  .mailgw .mail-row.sel { background: var(--accent-soft); }
  .mailgw .mail-link { min-height: 44px; grid-template-columns: minmax(100px,17%) minmax(0,1fr) auto; grid-template-areas: none; gap: 14px; padding: 10px 4px; font-size: 14px; }
  .mailgw .mail-link :is(.mail-who,.mail-subj,.mail-meta) { grid-area: auto; }
  .mailgw .mail-row.unread .mail-who::before { display: none; }
  .mailgw .mail-row.unread .mail-who, .mailgw .mail-row.unread .mail-subj b { font-weight: 600; }
  .mailgw .mail-snip, .mailgw .mail-tcount, .mailgw .mail-chips { display: none; }
  .mailgw .mail-meta { gap: 12px; font-size: 12px; justify-content: flex-end; }
  .mailgw .mail-meta time { min-width: 106px; text-align: right; font-weight: 400; }
  .mailgw .gw-size { min-width: 64px; }
  .mailgw .gw-env { color: var(--line-2); }
  .mailgw .unread .gw-env { color: var(--accent); }
  body.mailgw.gw-dense .mail-row, body.mailgw.gw-dense .mail-link { min-height: 34px; }
  body.mailgw.gw-dense .mail-link { padding-top: 5px; padding-bottom: 5px; }
  .mailgw .mail-thread .mail-row { grid-template-columns: minmax(0,1fr); }
  .mailgw .mail-page > .page-head, .mailgw .mail-page > .mail-labels-page, .mailgw .mail-page > p.small { margin: 24px; }
}
@media (min-width: 769px) and (max-width: 1150px) {
  .gw-boxname, .mail-range { display: none; }
  .gw-view { flex: 1; justify-content: flex-end; }
  .mailgw .mail-meta { gap: 6px; }
  .mailgw .gw-size { min-width: 48px; }
}
@media (max-width: 768px) {
  .mailgw .gw-main, .mailgw .mail-page { min-width: 0; max-width: 100%; }
  .gw-side { height: 100dvh; }
  .gw-more summary { width: 100%; min-height: 58px; }
  .gw-more[open] summary { color: var(--accent-ink); background: var(--accent-soft); }
  .gw-more-menu { max-height: min(60dvh,420px); overflow-y: auto; bottom: calc(66px + env(safe-area-inset-bottom)); }
  .gw-more-menu a:hover { background: var(--panel); }
  .gw-tabbar > a.on { color: var(--accent); }
  .mailgw .gw-tabbar .nav-badge { max-width: 30px; overflow: hidden; font-size: 9px; }
  .mailgw .mail-listcard.has-sel .mail-toolbar { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); max-height: 45dvh; overflow: auto; }
  .mailgw .mail-listcard.has-sel .mail-toolbar .gw-move { color: var(--text); background: var(--surface); border-color: var(--line-2); }
  .mailgw .gw-actions { gap: 4px; }
  .mailgw .gw-btn { min-height: 40px; }
  .mailgw .mail-listcard.has-sel .gw-view { display: none; }
  .mailgw .gw-menu-pop { position: static; min-width: 160px; box-shadow: none; }
  body.mailgw.m-search-open .gw-head { display: flex !important; margin: 8px 12px; }
  body.mailgw.m-search-open .gw-head > :not(.mail-search) { display: none; }
  body.mailgw.m-search-open .gw-search { display: flex; max-width: 100%; margin: 0 !important; }
  .mailgw .mail-read, .mailgw .mail-compose { margin: 8px; }
  .mailgw .mail-title { font-size: 20px; }
  .mailgw .mail-head { flex-wrap: wrap; }
  .mailgw .mail-head > time { width: 100%; }
  .mailgw .mail-field { flex-wrap: wrap; min-width: 0; }
  .mailgw .mail-field > :is(input,select,.chips-input) { min-width: 0; max-width: 100%; }
  .mailgw .chip-typing { min-width: 80px; }
  .mailgw .rte { padding: 16px; min-height: 260px; }
  .mailgw .mail-labels-page { display: grid; grid-template-columns: minmax(0,1fr); }
  .mailgw .label-row > input { flex: 1 1 130px; min-width: 0; }
  .mailgw .label-row > select { width: auto; }
  .mailgw .row2 { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) { .gw-tree .icon.tree-toggle { transition: none; } }
.mailgw .gw-tree a[hidden] { display: none; }
/* 통합 후 손본 것 */
@media (min-width: 769px) {
  .mailgw .mail-listcard:not(.has-sel) .gw-actions { visibility: visible; display: flex; opacity: .55; }
  .mailgw .mail-listcard:not(.has-sel) .gw-actions > * { pointer-events: none; }
}
.mailgw .mail-compose-head h1, .mailgw .mail-compose-head .icon-btn { color: var(--text); }
.mailgw .gw-search input[name=q], .mailgw .gw-search input[name=q]:focus { border: 0; box-shadow: none; outline: 0; background: transparent; }
/* 메일 자동완성 드롭다운 */
.sg-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.chips-input .sg-wrap { flex: 1 1 160px; }
.sg-wrap > input { flex: 1; min-width: 0; }
.sg-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; margin: 0; padding: 6px; list-style: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-menu); max-height: 320px; overflow-y: auto; min-width: 260px; }
.sg-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; min-height: 44px; }
.sg-item.on, .sg-item:hover { background: var(--accent-soft); }
.sg-av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--accent-ink); font-weight: 800; font-size: 13px; }
.sg-av.dom { background: #e8f0fe; color: #1a56db; }
.sg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sg-txt b, .sg-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-txt b { font-weight: 600; font-size: 14px; }
.sg-txt small { color: var(--muted); font-size: 12.5px; }
.sg-txt mark { background: none; color: var(--accent-ink); font-weight: 800; }
.sg-n { flex: none; color: var(--muted); font-size: 12px; }

/* 개발 관리 (admin/devlog*.html) */
:root { --warn-bg: #fff4d6; --warn: #a15c00; --info-bg: #e8efff; --err-line: #f3b4ae; --err-row: #fff7f6; --warn-row: #fffbef; }
.badge.dl-pass { background: var(--ok-bg); color: var(--ok); }
.badge.dl-fail { background: var(--err); color: var(--surface); }
.badge.dl-warn { background: var(--warn-bg); color: var(--warn); }
.badge.dl-skip, .badge.dl-pending, .badge.dl-aborted { background: var(--line); color: var(--muted); }
.badge.dl-running { background: var(--info-bg); color: var(--blue); }
.badge.red-soft { background: var(--err-bg); color: var(--err); }
.ok-text { color: var(--ok); }
.err-box { border-color: var(--err-line); background: var(--err-bg); }
.err-box h2 { margin-top: 0; color: var(--err); }
.dl-meta .kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; margin: 0; }
.dl-meta .kv dt { color: var(--muted); font-size: var(--font-small); }
.dl-meta .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
table.devlog-checks tr.err td { background: var(--err-row); }
table.devlog-checks tr.warn td { background: var(--warn-row); }
table.grid td.detail pre, details.card pre { white-space: pre-wrap; max-height: 320px; overflow: auto; font-size: 12px; background: var(--panel); padding: 8px; border-radius: 8px; }
.dl-card-head { padding: 16px 16px 0; }
@media (max-width: 640px) { .dl-meta .kv { grid-template-columns: 1fr; } .dl-meta .kv dt { margin-top: 6px; } }
.dl-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
table.devlog tr.err td { background: var(--err-row); }
.dl-days { display: flex; flex-wrap: wrap; gap: 6px; }
.dl-day { display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: var(--font-small); min-width: 92px; }
.dl-day.bad { border-color: var(--err-line); background: var(--err-bg); }
.dl-day i { color: var(--err); font-style: normal; font-weight: 700; }
.dl-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.dl-shots a { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
.dl-shots img { width: 100%; height: 120px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.dl-events { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
