:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --sidebar: #111b27;
  --sidebar-soft: #192534;
  --text: #18202a;
  --muted: #68727e;
  --line: #e2e1dc;
  --line-strong: #d4d2cc;
  --orange: #ff5a2a;
  --orange-dark: #e94818;
  --orange-soft: #fff1ea;
  --green: #16834a;
  --green-soft: #eaf7ef;
  --blue: #2466c8;
  --blue-soft: #edf4ff;
  --amber: #b97800;
  --amber-soft: #fff6df;
  --red: #c83c37;
  --red-soft: #fff0ee;
  --radius: 12px;
  --shadow: 0 12px 30px rgba(22, 27, 34, 0.055);
}

* { box-sizing: border-box; }
html, body { min-width: 1180px; min-height: 100%; }
body {
  margin: 0;
  font-family: Pretendard, Inter, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* Login */
#login-view { display: grid; place-items: center; padding: 40px; background: var(--sidebar); }
.login-shell {
  width: min(1040px, 92vw);
  min-height: 610px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(0,0,0,.28);
}
.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 64px;
  color: #fff;
  background:
    radial-gradient(circle at 80% 12%, rgba(255,90,42,.28), transparent 30%),
    linear-gradient(155deg, #172331, #0d1520 70%);
}
.brand-kicker { margin-bottom: 22px; color: #ff8b66; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.login-brand-panel h1 { margin: 0; font-size: 38px; line-height: 1.25; letter-spacing: -.045em; }
.login-brand-panel p { max-width: 410px; margin: 24px 0 0; color: #aab4c0; font-size: 15px; line-height: 1.8; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 66px; background: #fff; }
.login-logo, .sidebar-logo { display: flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.04em; }
.login-logo { margin-bottom: 46px; font-size: 22px; }
.logo-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--orange); color: #fff; font-size: 15px; font-weight: 900; }
.login-card h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.login-subtitle { margin: 9px 0 28px; color: var(--muted); font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
.input-label { margin-top: 6px; color: #47515d; font-size: 13px; font-weight: 700; }
input, select, textarea {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input, select { padding: 0 12px; }
textarea { padding: 12px; line-height: 1.65; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,90,42,.12); }
#login-form input { height: 48px; }
.login-help { min-height: 20px; margin: 14px 0 0; color: var(--red); font-size: 13px; }

/* App shell */
#admin-view { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.sidebar {
  position: relative;
  z-index: 5;
  width: 248px;
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: #eaf0f6;
  background: var(--sidebar);
}
.sidebar-logo { padding: 0 8px; font-size: 22px; color: #fff; }
.sidebar-caption { margin: 7px 0 24px 52px; color: #788697; font-size: 9px; letter-spacing: .16em; }
.sidebar-menu { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; padding-right: 2px; }
.menu-label { margin: 18px 12px 6px; color: #687587; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.menu-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  color: #b8c3cf;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: .16s ease;
}
.menu-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.menu-item.active { color: #fff; background: var(--orange); box-shadow: 0 7px 18px rgba(255,90,42,.2); }
.nav-icon { width: 20px; color: currentColor; font-size: 15px; text-align: center; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: #fff; color: var(--orange); font-size: 10px; text-align: center; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer .status-dot { width: 9px; height: 9px; border-radius: 50%; background: #3ac776; box-shadow: 0 0 0 4px rgba(58,199,118,.12); }
.sidebar-footer div { display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer strong { color: #eaf0f6; font-size: 12px; }
.sidebar-footer small { color: #748294; font-size: 10px; }
.admin-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.admin-header {
  height: 78px;
  flex: 0 0 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
}
.header-left h2 { margin: 1px 0 0; font-size: 24px; letter-spacing: -.045em; }
.eyebrow { margin: 0; color: #9a958d; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.header-right { display: flex; align-items: center; gap: 11px; }
.server-health { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #39434e; font-size: 12px; font-weight: 700; }
.server-health i { width: 8px; height: 8px; border-radius: 50%; background: #1ba257; }
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #384553; color: #fff; font-size: 12px; font-weight: 800; }
.user-info { display: flex; min-width: 70px; flex-direction: column; line-height: 1.25; }
.user-info span { font-size: 12px; font-weight: 700; }
.user-info .user-email { color: var(--muted); font-size: 10px; font-weight: 500; }
.content-area { flex: 1; overflow: auto; padding: 28px 30px 42px; }
.content-panel { position: relative; max-width: 1560px; min-height: 100%; margin: 0 auto; }
.content-panel > * + * { margin-top: 16px; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.section-header h3 { margin: 0; font-size: 26px; letter-spacing: -.045em; }
.section-sub { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.section-meta, .updated-at { color: var(--muted); font-size: 12px; }
.header-actions, .filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.header-actions input[type="search"] { width: 230px; }
.filter-bar select { min-width: 130px; }

/* Controls */
.primary-btn, .ghost-btn, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 750;
  transition: .16s ease;
}
.primary-btn { border: 1px solid var(--orange); background: var(--orange); color: #fff; }
.primary-btn:hover { border-color: var(--orange-dark); background: var(--orange-dark); }
.ghost-btn { border: 1px solid var(--line-strong); background: #fff; color: #39434e; }
.ghost-btn:hover { border-color: #b9b6af; background: #f7f6f2; }
.text-btn { min-height: auto; padding: 0; background: none; color: var(--muted); font-size: 12px; }
.small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.danger { color: var(--red); border-color: #e9b8b5; }
.muted-text { color: var(--muted); }

/* Dashboard */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.metric-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.metric-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: var(--orange-soft); color: var(--orange); font-size: 18px; font-weight: 900; }
.metric-delta { color: var(--green); font-size: 11px; font-weight: 800; }
.metric-value { margin-top: 13px; font-size: 29px; font-weight: 800; letter-spacing: -.04em; }
.metric-value small { margin-left: 3px; font-size: 12px; font-weight: 600; }
.metric-label { margin-top: 3px; color: var(--muted); font-size: 12px; }
.card-block { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.card-header { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.card-header h4 { margin: 0; font-size: 14px; }
.flow-grid { display: grid; grid-template-columns: 1.35fr repeat(4, 1fr); }
.flow-cell { min-height: 58px; display: flex; align-items: center; gap: 9px; padding: 0 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.flow-cell:nth-child(5n) { border-right: 0; }
.flow-cell:nth-last-child(-n+5) { border-bottom: 0; }
.flow-cell.header { min-height: 40px; color: var(--muted); font-size: 11px; font-weight: 700; }
.flow-cell strong { font-size: 19px; }
.flow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.flow-dot.orange { background: var(--orange); }
.flow-dot.amber { background: #efa70b; }
.flow-dot.green { background: var(--green); }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-lists .card-block { min-height: 290px; }
.compact-dashboard-data .card-block { min-height: 245px; }
.attention-list { padding: 0 18px; }
.attention-item { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--line); font-size: 12px; }
.attention-item:last-child { border-bottom: 0; }
.attention-item strong { display: block; margin-bottom: 3px; font-size: 12px; }
.attention-item small { color: var(--muted); }

/* Tables */
.table-wrapper { width: 100%; overflow-x: auto; }
.admin-table { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { background: #faf9f6; }
th { color: #59636f; font-size: 11px; font-weight: 800; white-space: nowrap; }
th, td { height: 48px; padding: 10px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #fffaf7; }
tbody tr.is-selected { background: var(--orange-soft); }
.table-empty-cell { height: 120px; color: #969da5; text-align: center; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.user-cell img, .avatar-fallback { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; object-fit: cover; background: #edeae4; }
.avatar-fallback { display: grid; place-items: center; color: #6c737b; font-size: 11px; font-weight: 800; }
.user-cell strong { display: block; margin-bottom: 2px; }
.user-cell small { color: var(--muted); font-size: 10px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 23px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-gray { background: #f0f1f2; color: #65707c; }
.badge-orange { background: var(--orange-soft); color: var(--orange-dark); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.sport-badge.taekwondo { background: var(--green-soft); color: var(--green); }
.sport-badge.arm-wrestling { background: var(--orange-soft); color: var(--orange-dark); }
.record-win { color: var(--green); }
.record-loss { color: var(--orange-dark); }

/* Detail panels */
.detail-drawer {
  position: fixed;
  z-index: 20;
  top: 78px;
  right: 0;
  bottom: 0;
  width: 430px;
  overflow-y: auto;
  padding: 26px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 50px rgba(18,24,31,.12);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { margin: 0; font-size: 20px; }
.drawer-close { width: 34px; height: 34px; border-radius: 8px; background: #f3f2ef; color: #56606b; font-size: 18px; }
.member-hero { display: flex; align-items: center; gap: 14px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.member-hero img, .member-hero .avatar-fallback { width: 70px; height: 70px; flex-basis: 70px; }
.member-hero h4 { margin: 0 0 4px; font-size: 18px; }
.member-hero p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-section { margin-top: 22px; }
.detail-section h5 { margin: 0 0 12px; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 650; word-break: break-all; }
.mini-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; }
.mini-row:last-child { border-bottom: 0; }
.mini-row small { color: var(--muted); }
.operations-layout { display: grid; grid-template-columns: minmax(690px, 1.25fr) minmax(360px, .75fr); align-items: start; gap: 16px; }
.operation-detail { min-height: 420px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.operation-detail .empty-state, .inquiry-detail .empty-state { min-height: 380px; display: grid; place-items: center; padding: 30px; color: #959ca4; text-align: center; }
.battle-detail-head { padding: 20px; border-bottom: 1px solid var(--line); }
.battle-detail-head h4 { margin: 7px 0 5px; font-size: 17px; }
.battle-detail-head p { margin: 0; color: var(--muted); font-size: 11px; }
.score-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 20px; background: #faf9f6; text-align: center; }
.score-board strong { display: block; font-size: 14px; }
.score-board .score { font-size: 28px; font-weight: 900; }
.battle-matches { padding: 10px 18px 18px; }
.battle-match-row { display: grid; grid-template-columns: 24px 1fr auto 1fr auto; align-items: center; gap: 8px; min-height: 46px; border-bottom: 1px solid var(--line); font-size: 11px; }

/* Support */
.support-layout { min-height: 650px; display: grid; grid-template-columns: minmax(330px, .42fr) minmax(500px, .58fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.inquiry-list { border-right: 1px solid var(--line); }
.inquiry-item { width: 100%; min-height: 91px; display: block; padding: 15px 17px; border-bottom: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; }
.inquiry-item:hover { background: #fbfaf7; }
.inquiry-item.active { background: var(--orange-soft); box-shadow: inset 3px 0 var(--orange); }
.inquiry-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inquiry-top strong { font-size: 13px; }
.inquiry-item p { margin: 7px 0 0; overflow: hidden; color: #3f4853; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-item small { color: var(--muted); font-size: 10px; }
.inquiry-detail { min-width: 0; padding: 22px 26px 28px; }
.inquiry-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.inquiry-meta h4 { margin: 0 0 6px; font-size: 17px; }
.inquiry-meta p { margin: 0; color: var(--muted); font-size: 11px; }
.inquiry-content { min-height: 125px; padding: 22px 0; border-bottom: 1px solid var(--line); color: #343d47; font-size: 13px; line-height: 1.75; white-space: pre-line; }
.reply-form { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; margin-top: 20px; }
.reply-form textarea { min-height: 150px; grid-row: span 2; }
.reply-actions { display: flex; align-items: end; gap: 8px; }

/* Content cards */
.notice-list, .faq-list, .terms-container { display: flex; flex-direction: column; gap: 10px; }
.notice-card, .faq-card, .term-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.notice-card { padding: 18px; }
.notice-title-row, .faq-head, .term-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.notice-card h5, .faq-card h4, .term-card h4 { margin: 0; font-size: 14px; }
.notice-card time { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.notice-card p { margin: 12px 0 0; color: #4b5560; font-size: 12px; line-height: 1.65; white-space: pre-line; }
.notice-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 14px; }
.faq-card { padding: 18px; }
.faq-card .faq-answer { margin: 13px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: #4d5661; font-size: 12px; line-height: 1.65; white-space: pre-line; }
.faq-actions { display: flex; gap: 7px; }
.term-header { min-height: 58px; padding: 0 18px; }
.term-body { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-top: 1px solid var(--line); }
.term-content-input { min-height: 220px; }
.term-body .term-save { align-self: flex-end; width: auto; }

/* Banner */
.banner-thumb-button { position: relative; width: 150px; height: 58px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #f0eee9; }
.banner-thumb-button img { width: 100%; height: 100%; object-fit: cover; }
.banner-thumb-fallback { display: none; color: var(--muted); font-size: 10px; }
.banner-thumb-button.is-broken .banner-thumb-fallback { display: grid; height: 100%; place-items: center; }

/* Modal */
.modal-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 30px; background: rgba(9,15,22,.62); }
.modal-content { width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; border-radius: 14px; background: #fff; box-shadow: 0 26px 90px rgba(0,0,0,.3); }
.modal-header { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-close { width: 34px; height: 34px; border-radius: 8px; background: #f1f0ed; color: #5b6570; font-size: 21px; }
.modal-body { padding: 22px; }
.form-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.form-group label { color: #47515d; font-size: 12px; font-weight: 750; }
.form-group textarea { min-height: 130px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.modal-actions .primary-btn { width: auto; }
.image-modal-content { width: min(980px, 94vw); }
.banner-image-preview { padding: 20px; }
.banner-image-preview img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }
.empty-state { color: #949ba3; font-size: 12px; }
.loading-indicator { padding: 24px; color: var(--muted); font-size: 12px; }

@media (max-width: 1320px) {
  .sidebar { width: 218px; flex-basis: 218px; }
  .operations-layout { grid-template-columns: 1fr; }
  .operation-detail { min-height: 340px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
