@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

:root {
  --bg: #eef3f1;
  --ink: #122033;
  --muted: #66758a;
  --accent: #1d4ed8;
  --card: #fff;
  --line: #e1e7f0;
  --danger: #b42318;
  --nav: #0e1c33;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.02em;
}

a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

.skip { position: absolute; left: -999px; background: #fff; padding: .5rem .75rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 5; }

body.app { min-height: 100vh; }
body.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 20% 0%, #1e4b8f 0%, #0b1730 62%);
}

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #123f3c;
  color: #d7ece8;
}
.mast-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 64px;
  padding: 0 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand strong { color: #fff; font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.brand span { color: #9ec9c3; font-size: .82rem; letter-spacing: .08em; }
.menu {
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
.menu-group { position: relative; flex: 0 0 auto; }
.menu-group > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-width: 168px;
  height: 112px;
  padding: .85rem 1.2rem .7rem;
  color: #e7f4f1;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 4px solid transparent;
}
.menu svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu .caret { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.menu-group > a span { display: inline-flex; align-items: center; gap: .2rem; }
.menu-group > a:hover,
.menu-group:focus-within > a { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.menu-group.on > a { background: rgba(255,255,255,.12); color: #fff; border-bottom-color: #8fd3c4; }
.menu-drop {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 180px;
  padding: .35rem 0;
  background: #0e3331;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  z-index: 30;
}
.menu-group:hover .menu-drop,
.menu-group:focus-within .menu-drop { display: block; }
.menu-drop a {
  display: block;
  padding: .75rem 1.1rem;
  color: #d7ece8;
  font-weight: 700;
  text-decoration: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.menu-drop a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.menu-drop a.on { color: #fff; background: rgba(255,255,255,.12); border-left-color: #8fd3c4; }
.mast-end { display: flex; align-items: center; gap: .75rem; }
.pub { color: #d7f5ef; font-weight: 700; font-size: .9rem; white-space: nowrap; text-decoration: none; }
.pub:hover { color: #fff; text-decoration: none; }
.who p { margin: 0; color: #fff; font-weight: 700; font-size: .9rem; line-height: 1.2; white-space: nowrap; }
.who span { display: block; color: #9ec9c3; font-size: .75rem; }
.mast .btn.secondary {
  background: transparent;
  color: #d7e2f2;
  border-color: rgba(255,255,255,.18);
  white-space: nowrap;
}
.mast .btn.secondary:hover { color: #fff; border-color: #fff; }

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
  max-width: none;
  margin: 0 auto;
  padding: 1.75rem 2rem 3rem;
}
body.app main { padding: 0; max-width: none; margin: 0; min-width: 0; }
.sidenav {
  position: sticky;
  top: 192px;
  background: #fff;
  border: 1px solid var(--line);
}
.sidenav-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .85rem;
  padding: 1.6rem 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.sidenav-icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #e5f3f0;
  color: #0f5c56;
}
.sidenav-icon svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidenav-head strong { font-size: 1.55rem; font-weight: 800; letter-spacing: -.04em; }
.sidenav a {
  display: block;
  padding: 1.15rem 1.35rem;
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.sidenav a:hover { background: #e5f3f0; text-decoration: none; }
.sidenav a.on { color: #fff; background: #14635f; }
.searchbox {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: 1rem 1.05rem;
  background: #fff;
  border: 1px solid var(--line);
}
.searchbox label { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 12rem; margin: 0; font-size: .88rem; }
.search-actions { display: flex; align-items: center; gap: .8rem; }
.searchbox .btn { background: #14635f; border-color: #14635f; }
.searchbox .btn:hover { background: #0f514e; }
.search-actions a { font-weight: 700; color: #4d635f; }
main { padding: 1.5rem; min-width: 0; }

.card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.6rem 1.45rem 1.3rem;
  box-shadow: 0 24px 60px rgba(6, 16, 36, .35);
}
body.gate a { color: #1d4ed8; }
body.gate h1, body.gate .eyebrow { color: #122033; }

h1 { margin: 0 0 .9rem; font-size: 2.15rem; font-weight: 800; letter-spacing: -.045em; line-height: 1.2; }
h2 { margin: 0 0 .85rem; font-size: 1.25rem; font-weight: 800; }
.eyebrow { margin: 0 0 .35rem; color: #1d4ed8; font-weight: 800; font-size: .85rem; letter-spacing: .08em; }
.lead { color: #4d5e74; margin-top: 0; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-head h1 { margin: 0; }

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.35rem 1.45rem;
  margin-bottom: .9rem;
  box-shadow: 0 1px 2px rgba(16, 32, 51, .04);
}
.narrow { max-width: 44rem; }
.filterbar { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.filterbar input, .filterbar select { width: auto; min-width: 12rem; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: .9rem; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1rem 1rem;
  box-shadow: 0 1px 2px rgba(16, 32, 51, .04);
}
.stat span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat b { display: block; margin-top: .2rem; font-size: 1.85rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }

.agenda, .plain, .links, .flashes { list-style: none; margin: 0; padding: 0; }
.agenda li, .links li {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
}
.agenda li:last-child, .links li:last-child { border-bottom: 0; }
.agenda li .btn, .links li .btn { margin-left: auto; }
.agenda li p { margin: 0; color: #4d5e74; font-variant-numeric: tabular-nums; }
.agenda span, .plain span { display: block; color: var(--muted); font-size: .88rem; }
.plain li { padding: .4rem 0; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field.check { flex-direction: row; align-items: center; }
label { font-weight: 700; font-size: 1rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="date"], input[type="time"], input[type="search"], select, textarea {
  border: 1px solid #c5d0e0;
  border-radius: 8px;
  padding: .85rem .95rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}
textarea { min-height: 11rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .15);
}

.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.logo-preview {
  display: grid; place-items: center; min-height: 120px; margin: .5rem 0;
  padding: 1rem; border: 1px dashed #c5d0e0; border-radius: 8px; background: #f7f9fc;
}
.logo-preview img { display: block; max-width: 100%; max-height: 96px; object-fit: contain; }
.logo-empty { font-size: 1.6rem; font-weight: 800; letter-spacing: -.04em; color: #222; }
.hero-preview {
  display: grid; place-items: center; min-height: 140px; margin: .5rem 0;
  border: 1px dashed #c5d0e0; border-radius: 8px; background: #f7f9fc; overflow: hidden;
}
.hero-preview img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.logo-form { display: grid; gap: .5rem; margin-bottom: .5rem; }
.logo-form input[type="file"] { font: inherit; }
.address-field { gap: .5rem; border: 0; padding: 0; min-width: 0; }
.address-field legend { padding: 0; margin-bottom: .3rem; font-weight: 700; font-size: 1rem; }
.postcode-row { display: flex; gap: .5rem; }
.postcode-row input { width: 10rem; flex: none; }
.address-field input[readonly] { background: #f7f9fc; cursor: default; }
.split { display: grid; gap: 1rem; }
.stack { display: grid; gap: .9rem; align-content: start; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: .7rem 1.15rem;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { color: #fff; text-decoration: none; background: #1e40af; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #c5d0e0; }
.btn.secondary:hover { color: #1d4ed8; border-color: #1d4ed8; background: #fff; }
.btn.danger { background: #fff; color: var(--danger); border-color: #f0c9c6; }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); background: #fff; }
.btn.small { min-height: 32px; padding: .3rem .65rem; font-size: .86rem; }
.row-actions, .toolbar, .add-line { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar { margin-bottom: .75rem; }
.toolbar input, .toolbar select { width: auto; min-width: 11rem; }
.filters { display: flex; gap: .35rem; margin-bottom: .75rem; flex-wrap: wrap; }
.filters a {
  text-decoration: none;
  border: 1px solid #d5deea;
  border-radius: 999px;
  padding: .28rem .75rem;
  color: #3d4e66;
  background: #fff;
  font-weight: 700;
  font-size: .88rem;
}
.filters a:hover { color: #1d4ed8; border-color: #1d4ed8; text-decoration: none; }
.filters a.on { background: #122033; color: #fff; border-color: #122033; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .95rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .9rem; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
tbody tr:hover td { background: #f7f9fc; }
.panel { overflow-x: auto; }
.panel table { display: table; width: 100%; min-width: 560px; }

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: .12rem .55rem;
  font-size: .75rem;
  background: #e7eefc;
  color: #1d4ed8;
  font-weight: 800;
}
.badge.enrolled { background: #e5f6ee; color: #146c43; }
.badge.paused, .badge.late { background: #fff6e8; color: #9a6700; }
.weekboard {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.weekboard section {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem .7rem .85rem;
  box-shadow: 0 1px 2px rgba(16, 32, 51, .04);
}
.weekboard h2 {
  margin: 0 0 .65rem;
  padding-bottom: .45rem;
  border-bottom: 2px solid #14635f;
  color: #123f3c;
  font-size: 1rem;
}
.slot {
  display: grid;
  gap: .12rem;
  margin-top: .5rem;
  padding: .65rem .7rem;
  border-radius: 10px;
  background: #f4faf8;
  color: inherit;
  text-decoration: none;
}
.slot:hover { background: #e5f3f0; text-decoration: none; }
.slot strong { font-size: .98rem; letter-spacing: -.02em; }
.slot span, .slot em { color: #4d635f; font-size: .84rem; font-style: normal; font-variant-numeric: tabular-nums; }
.slot.off { background: #f6f7f8; }
.slot.off strong { color: #6b7280; }
.sheet { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.sheet > li {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) auto;
  gap: .35rem 1.2rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(16, 32, 51, .04);
}
.sheet-title {
  display: block;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.03em;
  text-decoration: none;
}
a.sheet-title:hover { color: #14635f; text-decoration: none; }
.sheet-sub, .sheet-meta { display: block; color: #4d635f; font-size: .92rem; }
.sheet-meta { margin: 0; }
.sheet .row-actions { justify-content: flex-end; }
.sheet .memo-input { width: 100%; min-width: 0; }
.sheet + .btn { margin-top: .9rem; }
li.mark-absent { background: #fff5f5; }
li.mark-late { background: #fffaf1; }
.badge.left, .badge.absent { background: #fdecec; color: var(--danger); }

.meta { display: grid; grid-template-columns: 5.5rem 1fr; gap: .45rem .75rem; margin: 0 0 1rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.meta-line { margin: -.2rem 0 .7rem; color: var(--muted); font-size: .88rem; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.checklist li:last-child { border-bottom: 0; }
.checklist span { font-weight: 700; font-size: .82rem; }
.check-ok span { color: #146c43; }
.check-miss span { color: var(--danger); }
.excerpt {
  display: block;
  max-width: 28rem;
  margin-top: .15rem;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memo { white-space: pre-wrap; background: #f6f8fb; border-radius: 10px; padding: .8rem; }
.note { background: #fff6e8; border-radius: 10px; padding: .7rem .8rem; color: #7a5b16; }
.empty { color: var(--muted); }
.error { color: var(--danger); margin: 0; font-size: .9rem; }

.flashes { margin: 0 0 .8rem; }
.flash { border-radius: 10px; padding: .7rem .9rem; margin-bottom: .4rem; }
.flash.success { background: #e8f6ee; color: #146c43; }
.flash.error { background: #fdecec; color: var(--danger); }

.days ul { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.days li {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .7rem;
  background: #fff;
}
.roll { display: flex; gap: .7rem; flex-wrap: wrap; }
.roll label { font-weight: 600; display: inline-flex; gap: .3rem; align-items: center; }
tr.mark-absent td { background: #fff5f5; }
tr.mark-late td { background: #fffaf1; }
.memo-input { min-width: 8rem; }

:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }

@media (min-width: 900px) { .split { grid-template-columns: 1.15fr .85fr; } }

@media (max-width: 980px) {
  .mast-bar { padding: .45rem .9rem; }
  .menu { justify-content: flex-start; }
  .menu-group > a { min-width: 108px; height: 80px; font-size: .88rem; }
  .menu-drop { left: 0; transform: none; }
  .shell { grid-template-columns: 1fr; padding: 1rem; }
  .sidenav { position: static; }
  .who span { display: none; }
  .split-fields, .stats { grid-template-columns: 1fr; }
  .weekboard { grid-template-columns: repeat(7, minmax(132px, 1fr)); overflow-x: auto; }
  .sheet > li { grid-template-columns: 1fr; }
  main { padding-left: 1rem; padding-right: 1rem; }
}
