@font-face {
  font-family: "Pretendard";
  src: url("fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #f2f4f6;
  --surface: #ffffff;
  --field: #f2f4f6;
  --field-hover: #e5e8eb;
  --text: #191f28;
  --secondary: #4e5968;
  --muted: #616c79;
  --line: #e5e8eb;
  --accent: #2272eb;
  --accent-text: #ffffff;
  --accent-soft: #e8f3ff;
  --accent-soft-text: #1b64da;
  --danger: #d22030;
  --ok-bg: #e5f7ee;
  --ok-text: #0a7a4b;
  --warn-bg: #fff3e0;
  --warn-text: #a85400;
  --bad-bg: #ffeeee;
  --neutral-bg: #f2f4f6;
  --nw-green: #00c73c;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #17171c;
    --surface: #212127;
    --field: #2c2c35;
    --field-hover: #3c3c47;
    --text: #f2f2f5;
    --secondary: #c3c3cc;
    --muted: #a0a0ad;
    --line: #34343d;
    --accent: #4d97fb;
    --accent-text: #0b1a2e;
    --accent-soft: #1d3250;
    --accent-soft-text: #8dbdff;
    --danger: #ff7b82;
    --ok-bg: #143a2a;
    --ok-text: #6fdcaa;
    --warn-bg: #43301a;
    --warn-text: #f6bf72;
    --bad-bg: #472226;
    --neutral-bg: #2c2c35;
  }
}

/* 기본 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  letter-spacing: -.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-soft-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.35; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; margin: 32px 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 전체 틀과 메뉴 */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }
.content { flex: 1; min-width: 0; }
main { max-width: 1000px; margin: 0 auto; padding: 40px 32px 72px; }
.brand { font-size: 19px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.sidebar {
  position: sticky; top: 0; flex: 0 0 236px; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 24px 14px 18px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar-head { padding: 0 10px; }
.sidebar-body { flex: 1; display: flex; flex-direction: column; }
.menu-toggle { display: none; }
.menu { display: flex; flex-direction: column; gap: 2px; padding-bottom: 20px; }
.menu-group { margin: 22px 10px 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.menu a {
  padding: 10px; border-radius: 10px; font-weight: 500; color: var(--secondary);
  transition: background-color .12s;
}
.menu a:hover { background: var(--field); color: var(--text); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 700; }
.account { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); }
.account p { margin: 0; }
.account-name { font-weight: 600; }
.account-email { font-size: 12.5px; color: var(--muted); margin-bottom: 8px !important; }
.plain-head { display: flex; justify-content: space-between; align-items: center; max-width: 420px; margin: 0 auto; padding: 48px 0 0; }
.banner { position: relative; background: var(--warn-bg); color: var(--warn-text); padding: 10px 46px; font-size: 14px; font-weight: 500; text-align: center; }

/* 카드와 글자 */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }
.card { background: var(--surface); border-radius: 20px; padding: 24px; margin-bottom: 12px; }
main > h1 + :not(.hint), main > .hint + .card, main > .hint + form, main > .hint + .table-wrap { margin-top: 20px; }
.card > h2 { margin-top: 0; }
.form-stack > label:first-of-type { margin-top: 0; }
.narrow { max-width: 420px; margin: 32px auto; padding: 32px 28px; }
.empty { text-align: center; color: var(--muted); }
.hint, .meta { color: var(--muted); font-size: 14px; margin: 4px 0; }
.rule.muted { opacity: .6; }
.rule-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-head h2 { margin: 0; font-size: 17px; }
.rule p { margin: 6px 0; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--neutral-bg); color: var(--secondary); font-size: 12.5px; font-weight: 600;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.bad { background: var(--bad-bg); color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
td.actions { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.flash { position: relative; padding: 14px 46px 14px 18px; border-radius: 14px; margin: 0 0 16px; font-weight: 500; }
.dismiss {
  position: absolute; top: 50%; right: 10px; width: 30px; height: 30px; padding: 0; transform: translateY(-50%);
  background: none; color: inherit; font-size: 20px; font-weight: 400; line-height: 1; opacity: .65;
}
.dismiss:hover { background: none; opacity: 1; }
.flash.error { background: var(--bad-bg); color: var(--danger); }
.flash.success { background: var(--ok-bg); color: var(--ok-text); }
.flash { transition: opacity .4s ease; }
.flash.fading { opacity: 0; }
.notice code { display: block; font-size: 18px; margin: 8px 0; user-select: all; }

/* 입력 */
label { display: block; font-size: 14px; font-weight: 600; color: var(--secondary); margin: 18px 0 6px; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  width: 100%; padding: 13px 16px; font: inherit; color: var(--text);
  background: var(--field); border: 1px solid transparent; border-radius: 12px;
  transition: background-color .12s, border-color .12s;
}
input:not([type=checkbox]):not([type=radio]):focus, textarea:focus, select:focus {
  background: var(--surface); border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: 0;
}
::placeholder { color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 24px 0 0; }
legend { font-weight: 600; padding: 0; }
.condition { background: var(--field); border-radius: 14px; padding: 16px; margin: 10px 0; }
.condition input:not([type=checkbox]):not([type=radio]), .condition textarea, .condition select { background: var(--surface); }
.condition-title { font-weight: 600; font-size: 14px; color: var(--secondary); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--text); margin: 6px 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form > div { flex: 1 1 200px; }
.inline-form label { margin-top: 0; }

/* 버튼 */
button, .button {
  display: inline-block; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--secondary);
  background: var(--field); border: 0; border-radius: 10px; cursor: pointer; text-align: center;
  transition: background-color .12s, filter .12s;
}
button:hover, .button:hover { background: var(--field-hover); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); padding: 11px 18px; }
button.primary:hover, .button.primary:hover { background: var(--accent); filter: brightness(.94); }
button.danger { color: var(--danger); background: var(--bad-bg); }
button.danger:hover { background: var(--bad-bg); filter: brightness(.97); }
button.link { background: none; color: var(--muted); padding: 0; font-size: 13.5px; font-weight: 500; }
button.link:hover { background: none; color: var(--text); }
button.full, .button.full { width: 100%; margin-top: 24px; padding: 14px; font-size: 16px; border-radius: 14px; }
.button.full { display: block; text-align: center; box-sizing: border-box; }
/* 카드 맨 위에 오는 버튼은 위쪽 여백 없이 카드 안쪽 여백만으로 위아래를 맞춘다. */
.card > .full:first-child { margin-top: 0; }

/* 로그인 전 화면 */
.top-bar {
  display: flex; justify-content: center; align-items: center;
  height: 84px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-bar img { display: block; height: 43px; width: auto; }
.login-card {
  max-width: 560px; margin: 40px auto; padding: 48px 40px 40px; border-radius: 28px;
  text-align: center; box-shadow: 0 2px 16px rgba(0, 0, 0, .04);
}
.login-logo { display: block; width: 112px; height: auto; margin: 0 auto 28px; }
.login-card h1 { font-size: 32px; margin: 0 0 10px; }
.login-sub { margin: 0 0 36px; font-size: 17px; color: var(--muted); }
.login-foot { margin: 20px 0 0; font-size: 14.5px; color: var(--muted); }
.login-or { margin: 28px 0 0; font-size: 14px; color: var(--muted); }
.login-form { text-align: left; }
.button.naverworks {
  display: flex; justify-content: center; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 14px 20px; border-radius: 20px;
  background: var(--nw-green); color: #fff; font-size: 18px; font-weight: 700;
}
.button.naverworks:hover { background: var(--nw-green); filter: brightness(.95); text-decoration: none; }
.nw-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: #fff; color: var(--nw-green); font-size: 18px; font-weight: 800; line-height: 1;
}
@media (max-width: 560px) {
  .top-bar { height: 68px; }
  .login-card { margin: 20px auto; padding: 36px 20px 28px; border-radius: 22px; }
  .login-logo { width: 88px; margin-bottom: 20px; }
  .login-card h1 { font-size: 26px; }
  .login-sub { font-size: 15.5px; margin-bottom: 28px; }
  .button.naverworks { min-height: 56px; font-size: 16.5px; border-radius: 16px; }
}
.hint.or { text-align: center; margin: 16px 0 0; }
button:disabled, button:disabled:hover { opacity: .4; cursor: not-allowed; filter: none; }

/* 숫자 묶음 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { margin: 0; padding: 20px; }
.stat strong { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13.5px; }

/* 표 */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 20px; padding: 8px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 13px 10px; vertical-align: middle; }
th { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr + tr td { border-top: 1px solid var(--line); }
.nowrap { white-space: nowrap; }
.clip { max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-wide { max-width: 180px; }
.subject-cell { min-width: 190px; overflow-wrap: break-word; }
.cell-note { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.detail { font-size: 13px; color: var(--muted); min-width: 260px; }

/* 공유 메일 */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 14px; }
.tab {
  max-width: 100%; padding: 8px 14px; border-radius: 999px; overflow-wrap: anywhere;
  background: var(--surface); color: var(--secondary); font-size: 14px; font-weight: 600;
}
.tab:hover { color: var(--text); text-decoration: none; background: var(--field-hover); }
.tab[aria-current="page"] { background: var(--text); color: var(--surface); }
.tab-count { margin-left: 3px; font-weight: 500; opacity: .7; font-variant-numeric: tabular-nums; }
.tab-detail { margin: 0 0 8px 2px; }
.search { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.search input:not([type=checkbox]):not([type=radio]) { flex: 1 1 200px; width: auto; margin: 0; background: var(--surface); }
.search button, .search .button { background: var(--surface); padding: 13px 18px; border-radius: 12px; }
.search button:hover, .search .button:hover { background: var(--field-hover); }
.date-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 20px; }
.date-filter > div { flex: 0 1 180px; min-width: 140px; }
.date-filter label { margin-top: 0; }
.date-filter input:not([type=checkbox]):not([type=radio]) { background: var(--surface); padding: 11px 14px; }
.date-filter button, .date-filter .button { background: var(--surface); padding: 13px 18px; border-radius: 12px; }
.date-filter button:hover, .date-filter .button:hover { background: var(--field-hover); }
.bulk-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; margin: 20px 2px 12px; }
.bulk-bar .actions { margin-top: 0; }
.count { margin: 0; }
.check-cell { width: 38px; padding-right: 0; }
.check-cell input { display: block; }
.mail-title a { color: var(--text); font-weight: 600; }
.mail-title a:hover { color: var(--accent-soft-text); }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination .button { background: transparent; min-width: 38px; }
.pagination .button:hover { background: var(--field-hover); }
.pagination .current, .pagination .current:hover { background: var(--text); color: var(--surface); cursor: default; }
.mail-subject { font-size: 21px; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; margin-top: 12px; }

/* 좁은 화면 */
@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar {
    position: sticky; z-index: 10; height: auto; max-height: 100vh; padding: 0;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
  .menu-toggle { display: inline-block; }
  .sidebar-body { display: none; padding: 0 8px 14px; }
  .sidebar.open .sidebar-body { display: flex; }
  .menu-group { margin-top: 14px; }
  .account { padding: 12px 10px 0; }
  .plain-head { max-width: none; padding: 20px 16px 0; }
  main { padding: 24px 16px 56px; }
  .banner { padding: 8px 46px 8px 16px; font-size: 13.5px; text-align: left; }
  h1 { font-size: 23px; }
  .page-head { flex-direction: column; }
  .card { padding: 20px; }
  .narrow { margin: 16px auto; padding: 24px 20px; }
}
@media (max-width: 560px) {
  /* 좁은 화면에서는 표 칸이 글자를 쪼개므로 메일마다 세로로 쌓는다. */
  .mail-table thead th:not(.check-cell) { display: none; }
  .mail-table thead th.check-cell { border-bottom: 0; }
  .mail-table thead tr { display: block; border-bottom: 1px solid var(--line); }
  .mail-table tbody tr { display: grid; grid-template-columns: 42px 1fr; padding: 10px 0; }
  .mail-table tbody tr + tr { border-top: 1px solid var(--line); }
  .mail-table tbody tr + tr td { border-top: 0; }
  .mail-table tbody td { display: block; grid-column: 2; order: 2; padding: 1px 12px 1px 0; font-size: 13.5px; color: var(--muted); }
  .mail-table tbody td:empty { display: none; }
  .mail-table tbody td.check-cell { grid-column: 1; grid-row: 1 / span 5; order: 0; padding: 3px 0 0 12px; }
  .mail-table tbody td.mail-title { order: 1; font-size: 15px; color: var(--text); }
  .mail-table tbody td.empty { grid-column: 1 / -1; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
