:root {
  --navy: #1f3a5f;
  --navy-dark: #152a45;
  --blue: #1f5fa8;
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #dde3eb;
  --text: #1c2533;
  --muted: #6b778a;
  --ok-bg: #e6f4ec; --ok: #1d6b43;
  --err-bg: #fbeaea; --err: #a52a2a;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Malgun Gothic', '맑은 고딕', -apple-system, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* ── 버튼 ── */
.btn {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: #eef2f7; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #18508f; }
.btn.danger { color: var(--err); border-color: #e3b8b8; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; padding: 10px; font-size: 15px; }
.linkbtn { background: none; border: 0; color: #cfe0f5; font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }

/* ── 로그인 ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px;
  /* 공항 계류장 사진 위에 남색 반투명 막을 얹어 카드 글씨가 잘 보이게 한다 */
  background: linear-gradient(120deg, rgba(21, 42, 69, .55) 0%, rgba(21, 42, 69, .15) 60%, rgba(21, 42, 69, .35) 100%),
              url("login-bg.jpg") center 70% / cover no-repeat fixed, var(--navy); }
.login-page .login-card { background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); }
@media (max-width: 820px) { .login-page { background-attachment: scroll; } }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 32px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-mark { display: inline-block; background: var(--navy); color: #fff; font-weight: 700;
  letter-spacing: 2px; padding: 6px 14px; border-radius: 6px; margin-bottom: 12px; }
.login-brand h1 { font-size: 20px; }
.login-brand p { margin: 6px 0 0; color: var(--muted); }
.login-card label { display: block; margin-bottom: 14px; font-weight: 600; }
.login-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; line-height: 1.6; }
.signup-link { margin-top: 10px; text-align: center; }
.signup-card { max-width: 440px; margin: 24px 0; }
.signup-card .form label { margin-bottom: 12px; font-weight: 400; }
.signup-card .form label small { color: var(--muted); font-size: 12px; }
.signup-card .section-title { margin: 14px 0 10px; }
.consent { background: #f6f8fb; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px;
  margin: 8px 0 16px; font-size: 13px; }
.consent ul { margin: 6px 0 10px; padding-left: 18px; color: var(--muted); line-height: 1.6; }
.consent label.check { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 600; }
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--err);
  color: #fff; font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px; }
.pending-card { border-color: #f2c14e; background: #fffaf0; margin-bottom: 18px; }
.pending-card h2 { margin: 0 0 12px; }
.approve-form { display: inline-flex; gap: 6px; align-items: center; }
.approve-form select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12px; }

/* ── 상단바·레이아웃 ── */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--navy); color: #fff; padding: 0 20px; height: 52px; }
.brand { font-weight: 700; font-size: 16px; }
.brand span { font-weight: 400; font-size: 12px; color: #a9c1de; margin-left: 10px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.who a { color: #cfe0f5; }
.shell { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 210px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; }
.nav-group { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .5px;
  margin: 14px 10px 6px; }
.nav-group:first-child { margin-top: 2px; }
.sidebar a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--text); font-size: 14.5px; }
.sidebar a:hover { background: #eef2f7; text-decoration: none; }
.sidebar a.active { background: #e3ecf8; color: var(--blue); font-weight: 700; }
.content { flex: 1; min-width: 0; padding: 24px 28px 40px; }

/* ── 페이지 머리·툴바 ── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.page-head h1 .sub { font-size: 16px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.count { color: var(--muted); font-size: 13px; }
.back { display: inline-block; font-size: 13px; margin-bottom: 6px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.search { display: flex; gap: 6px; }
.search input { width: 260px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ── 표 ── */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; }
table.data th { background: #f0f3f8; text-align: left; font-weight: 700; padding: 10px 12px;
  border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: bottom; word-break: keep-all; }
table.data th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
table.data td { padding: 9px 12px; border-bottom: 1px solid #edf0f4; vertical-align: top; white-space: nowrap; }
table.audit td:last-child { white-space: normal; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
/* 전체 항목 목록: 옆으로 스크롤, 첫 열(번호) 고정, 구역 머리줄 */
table.data.wide th { white-space: nowrap; word-break: normal; }
table.data.wide tr.group-row th.grp { text-align: center; background: #e3ecf8; color: var(--navy);
  border-left: 2px solid #fff; font-size: 12px; padding: 6px 12px; }
table.data .sticky-col { position: sticky; left: 0; z-index: 2; background: #fff;
  box-shadow: 2px 0 0 var(--line); }
table.data th.sticky-col { background: #f0f3f8; z-index: 3; }
tr.clickable:hover td.sticky-col { background: #f6f9fd; }
td.note-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f6f9fd; }
td.empty { text-align: center; color: var(--muted); padding: 36px; }
.row-actions { white-space: nowrap; text-align: right; }

/* ── 배지 ── */
.vis, .role, .act { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.vis-public { background: #e6f0fb; color: #1f5fa8; }
.vis-org { background: #fdf0e1; color: #a5600f; }
.role { background: rgba(255, 255, 255, .15); }
.content .role-admin { background: #ede7f6; color: #5b3d8f; }
.content .role-editor { background: #e6f4ec; color: #1d6b43; }
.content .role-viewer { background: #eef1f5; color: #4a5568; }
.act-insert { background: #e6f4ec; color: #1d6b43; }
.act-update { background: #e6f0fb; color: #1f5fa8; }
.act-delete { background: var(--err-bg); color: var(--err); }

/* ── 카드·상세 ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card.note { margin-top: 16px; }
.card.note ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
dl.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 24px; margin: 0; }
dl.fields dt { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
dl.fields dd { margin: 0; font-size: 15px; white-space: pre-wrap; }
.span-all { grid-column: 1 / -1; }
.section-title { grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: var(--navy);
  border-bottom: 2px solid #e3ecf8; padding-bottom: 6px; margin-top: 8px; }
.section-title:first-child { margin-top: 0; }
.topbar .role-admin { background: #f2c14e; color: #3b2a00; font-weight: 700; }
.meta-line { color: var(--muted); font-size: 12px; margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 폼 ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; }
.form label { display: block; }
.form label > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form input:not([type=radio]):not([type=file]), .form select, .form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.form input[readonly] { background: #f3f5f9; color: var(--muted); }
.form.narrow { max-width: 460px; }
.form.narrow label { margin-bottom: 14px; }
.req { color: var(--err); margin-left: 3px; }
.vis-choice { border: 1px solid var(--line); border-radius: 6px; margin: 18px 0 0; padding: 10px 14px; }
.vis-choice legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.vis-choice label { display: inline-block; margin-right: 18px; }
.vis-choice small { display: block; color: var(--muted); margin-top: 6px; }
.form-actions { margin-top: 18px; display: flex; gap: 8px; }

/* ── 알림 ── */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }

/* ── 엑셀 업로드 ── */
.steps { display: grid; gap: 22px; }
.step { display: flex; gap: 14px; }
.step-no { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.step p { margin: 0 0 10px; color: var(--muted); }
.step input[type=file] { display: block; margin-bottom: 4px; }
.step .btn.primary { margin-top: 14px; }

/* ── 변경 이력 ── */
ul.changes { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ul.changes li { margin-bottom: 2px; }
.clab { color: var(--muted); margin-right: 6px; }
del { color: var(--err); }
ins { color: var(--ok); text-decoration: none; font-weight: 600; }

/* ── 그래프 ── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card h2 { margin: 0; font-size: 15px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.chart-controls select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 380px; }
.chart-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* ── 삭제 확인창 ── */
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { background: #8a2121; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 25, 40, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-backdrop[hidden] { display: none; }
.modal { background: #fff; border-radius: 10px; padding: 22px 24px; width: 100%; max-width: 400px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.modal p { margin: 8px 0 20px; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── 오류 ── */
.error-card { text-align: center; max-width: 420px; margin: 40px auto; }
.error-code { font-size: 40px; font-weight: 700; color: var(--navy); }

/* ── 좁은 화면 ── */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group { display: none; }
  .content { padding: 16px; }
  .chart-grid { grid-template-columns: 1fr; }
  .who span:first-child { display: none; }
  .search input { width: 100%; }
}
