:root {
  --bg: #252c3b;
  --bg-deep: #1d2330;
  --sidebar: #303949;
  --topbar: #1f2634;
  --panel: #343d4d;
  --panel-soft: #3a4454;
  --panel-hover: #414c5e;
  --ink: #edf1f7;
  --muted: #9ea9b9;
  --line: #465164;
  --line-soft: rgba(255,255,255,.07);
  --accent: #58c7bb;
  --accent-strong: #3eb6aa;
  --primary: #5867d8;
  --success: #33c86b;
  --warning: #f0b94c;
  --danger: #ef6470;
  --sidebar-width: 180px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #7ddbd2; }

.app-shell { min-height: 100vh; display: flex; background: var(--bg); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar);
  border-right: 1px solid #3b4657;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.sidebar-brand {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid #3c4657;
}
.brand-mark {
  width: 29px;
  height: 29px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #153230;
  font-weight: 900;
  font-size: 14px;
}
.brand-copy strong { display: block; color: var(--accent); font-size: 12px; letter-spacing: .06em; }
.brand-copy small { display: block; margin-top: 1px; color: #8390a3; font-size: 8px; letter-spacing: .08em; }
.sidebar-label { padding: 20px 15px 7px; color: #748196; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.sidebar-nav { display: grid; gap: 2px; padding: 0 7px; }
.sidebar-nav a, .sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 4px;
  color: #aab5c5;
  font-size: 11px;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a:hover, .sidebar-footer a:hover { background: #3b4658; color: #fff; }
.sidebar-nav a.active { background: #3b4658; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon { width: 17px; text-align: center; color: #7d8b9f; font-size: 13px; }
.sidebar-nav a.active .nav-icon { color: var(--accent); }
.sidebar-footer { margin-top: auto; padding: 9px 7px 13px; border-top: 1px solid #3c4657; }
.version { color: #748196; font-size: 9px; padding: 4px 10px 7px; }

.workspace { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar {
  height: 58px;
  background: var(--topbar);
  border-bottom: 1px solid #354052;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.menu-toggle { border: 0; background: transparent; color: #fff; font-size: 18px; padding: 7px 9px; margin-right: 9px; cursor: pointer; }
.topbar-title { font-size: 12px; font-weight: 700; color: #dfe5ee; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 7px; color: #b9c3d2; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(51,200,107,.12); }
.content-area { max-width: none; margin: 0; padding: 16px 18px 34px; }

h1 { margin: 0 0 14px; font-size: 19px; line-height: 1.3; font-weight: 700; color: #f2f5f9; }
h2 { margin: 0 0 12px; font-size: 14px; line-height: 1.35; font-weight: 700; color: #f0f3f8; }
h3 { margin: 0 0 10px; font-size: 13px; color: #eef2f7; }
p { margin: 8px 0; }

section, .auth-card {
  background: var(--panel);
  border: 1px solid #414c5e;
  border-radius: 4px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: none;
}
section > h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.auth-card { max-width: 430px; margin: 68px auto; }
.auth-card.wide { max-width: 720px; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative;
  min-height: 82px;
  padding: 14px 15px;
  background: var(--panel);
  border: 1px solid #414c5e;
  border-radius: 4px;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .75; }
.card span { display: block; color: var(--muted); font-size: 10px; }
.card strong { display: block; margin-top: 6px; color: #fff; font-size: 20px; line-height: 1.2; font-weight: 700; }
.card small { display: block; margin-top: 4px; color: #9ba7b8; font-size: 10px; }

form { display: grid; gap: 10px; }
.settings-grid { grid-template-columns: repeat(5, minmax(120px, 1fr)); align-items: end; }
.settings-grid button { min-height: 36px; }
.settings-grid > a { align-self: center; padding: 8px; }
label { display: grid; gap: 5px; color: #cbd3de; font-weight: 600; font-size: 10px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #465266;
  border-radius: 3px;
  padding: 8px 9px;
  color: #edf1f7;
  background: #3b4555;
  font: inherit;
  outline: none;
  min-height: 34px;
}
input::placeholder, textarea::placeholder { color: #7e899a; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(88,199,187,.1); }
textarea { min-height: 82px; resize: vertical; }
select option { background: #303948; color: #fff; }

button, .wallet-btn {
  border: 0;
  border-radius: 3px;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .wallet-btn:hover { filter: brightness(1.08); color: #fff; }
.wallet-btn { margin: 7px 0; }
.small { min-height: 28px; padding: 5px 9px; font-size: 10px; background: var(--success); }

.table-wrap { overflow: auto; border: 1px solid #434e60; border-radius: 3px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; background: var(--panel); }
th, td { padding: 9px 10px; border-bottom: 1px solid #465163; text-align: left; white-space: nowrap; font-size: 10px; }
th { background: #303847; color: #cbd3df; font-weight: 700; letter-spacing: .01em; }
td { color: #dce2eb; }
tbody tr:nth-child(even) { background: #394353; }
tbody tr:hover { background: var(--panel-hover); }
tbody tr[onclick] { cursor: pointer; }
tfoot th, tfoot td { background: #303847; color: #fff; font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-form { grid-template-columns: 1fr 1fr; }
.grid-form .full { grid-column: 1 / -1; }
.info-list { display: grid; gap: 7px; margin-bottom: 14px; }
.info-list div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.flash { margin-bottom: 12px; padding: 9px 11px; border-radius: 3px; border: 1px solid #74663a; background: #554b2e; color: #ffe8a6; }
.hint { color: var(--muted); font-size: 10px; }
.role-badge { display: inline-block; padding: 4px 8px; border-radius: 3px; background: #304e52; color: #79ded2; font-size: 10px; font-weight: 700; }
.notice { margin: 10px 0; padding: 10px 11px; border: 1px dashed #59657a; border-radius: 3px; background: #343d4d; color: #bdc7d5; }
.check { display: flex; align-items: center; gap: 7px; }
.check input { width: auto; min-height: 0; }

.org-tree { list-style: none; padding-left: 16px; }
.org-tree li { margin: 6px 0; padding-left: 10px; border-left: 1px solid #596579; }
.org-tree summary { cursor: pointer; padding: 7px 0; color: #e7ebf2; }
.org-tree small { margin-left: 7px; color: #929daf; }

.guest-header { height: 58px; display: flex; align-items: center; padding: 0 24px; background: var(--topbar); border-bottom: 1px solid #354052; }
.guest-brand { display: flex; align-items: center; gap: 9px; color: var(--accent); }
.guest-main { max-width: 760px; margin: 0 auto; padding: 18px; }
.guest-footer { padding: 14px; text-align: center; color: #778397; font-size: 9px; }

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .workspace { width: 100%; margin-left: 0; }
  .content-area { padding: 13px; }
  .two-col, .grid-form, .settings-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  h1 { font-size: 17px; }
  section { padding: 12px; }
  .topbar { padding: 0 9px; }
  table { min-width: 640px; }
}

/* v0.2.3 navigation split and readable typography */
body { font-size: 15px; }
.sidebar { --sidebar-width: 210px; }
.brand-copy strong { font-size: 14px; }
.brand-copy small { font-size: 10px; }
.sidebar-label { font-size: 10px; }
.sidebar-nav a, .sidebar-footer a { min-height: 44px; font-size: 14px; }
.nav-icon { font-size: 16px; }
.version { font-size: 11px; }
.topbar-title { font-size: 15px; }
.topbar-user { font-size: 14px; }
h1 { font-size: 27px; margin-bottom: 18px; }
h2 { font-size: 19px; }
h3 { font-size: 17px; }
section, .auth-card { padding: 20px; margin: 16px 0; border-radius: 6px; }
.card { min-height: 106px; padding: 18px; border-radius: 6px; }
.card span { font-size: 14px; }
.card strong { font-size: 26px; }
.card small { font-size: 13px; }
label { font-size: 14px; }
input, select, textarea { min-height: 42px; padding: 10px 12px; font-size: 15px; }
button, .wallet-btn { min-height: 42px; padding: 10px 15px; font-size: 14px; }
.small { min-height: 34px; font-size: 13px; }
th, td { padding: 12px 13px; font-size: 14px; }
.hint, .role-badge { font-size: 13px; }
.content-area { padding: 22px 24px 40px; }
.member-search-grid { grid-template-columns: 1.25fr .7fr 1fr .7fr auto auto; align-items: end; }
.reset-link { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 12px; }
.section-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.section-heading h2 { margin:0; border:0; padding:0; }
.action-row { display:flex; gap:10px; flex-wrap:wrap; }
@media (max-width: 1250px) { .member-search-grid { grid-template-columns: repeat(2, minmax(180px,1fr)); } }
@media (max-width: 900px) { .member-search-grid { grid-template-columns: 1fr; } }
:root { --sidebar-width: 210px; }

/* v0.2.4 member mobile-first interface */
.member-app .content-area { padding-bottom: 92px; }
.member-page { max-width: 1120px; margin: 0 auto; }
.member-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.member-hero h1 { margin:2px 0 8px; }
.member-eyebrow { margin:0; color:var(--accent); font-size:12px; font-weight:800; letter-spacing:.12em; }
.member-profile-link { display:inline-flex; align-items:center; min-height:38px; padding:8px 13px; border:1px solid var(--line); border-radius:10px; color:var(--ink); background:var(--panel); }
.member-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.member-metrics.single { grid-template-columns:minmax(0,420px); }
.member-metric { min-height:116px; padding:18px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(160deg,var(--panel),var(--panel-soft)); }
.member-metric.primary { border-color:rgba(88,199,187,.45); }
.member-metric.warning { border-color:rgba(240,185,76,.42); }
.member-metric span { display:block; color:var(--muted); font-size:14px; }
.member-metric strong { display:block; margin-top:10px; color:#fff; font-size:24px; line-height:1.2; }
.member-metric small { display:block; margin-top:6px; color:#aeb8c7; font-size:13px; }
.member-quick-actions { display:flex; gap:10px; flex-wrap:wrap; margin:14px 0 18px; }
.member-action { flex:1; min-width:180px; min-height:48px; display:flex; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:12px; color:var(--ink); background:var(--panel); font-weight:700; }
.member-action.main { background:var(--accent); color:#163330; border-color:transparent; }
.member-section { border-radius:16px; }
.member-section-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.member-section-title h2 { margin:0; padding:0; border:0; }
.mobile-list { display:none; }
.mobile-record { position:relative; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:15px 0; border-bottom:1px solid var(--line-soft); }
.mobile-record:last-child { border-bottom:0; }
.mobile-record.stacked { display:block; }
.record-main { min-width:0; }
.record-main strong,.record-value strong { display:block; color:#fff; font-size:15px; }
.record-main small,.record-value small,.mobile-record small { display:block; margin-top:4px; color:var(--muted); font-size:12px; }
.record-value { text-align:right; }
.record-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:7px; color:#cbd3de; }
.record-row:last-child { margin-bottom:0; }
.money-row { margin-top:10px; }
.money-row strong { color:#fff; font-size:17px; }
.rank-record { padding-left:42px; }
.rank-number { position:absolute; left:0; width:28px; height:28px; display:grid; place-items:center; border-radius:9px; background:rgba(88,199,187,.12); color:var(--accent); font-weight:800; }
.status-chip { padding:4px 8px; border-radius:999px; background:rgba(240,185,76,.14); color:#ffd27a; font-size:11px; font-weight:800; }
.status-chip.paid { background:rgba(51,200,107,.14); color:#72e49b; }
.empty-state { padding:22px 8px; color:var(--muted); text-align:center; }
.commission-total { margin-top:14px; padding:16px; border-radius:14px; background:#2b3443; border:1px solid var(--line); }
.commission-total span { color:var(--muted); font-size:13px; }
.commission-total strong { display:block; margin-top:6px; font-size:22px; color:#fff; }
.commission-total small { display:block; margin-top:4px; color:var(--accent); font-size:14px; }
.profile-summary { display:flex; align-items:center; gap:14px; margin-bottom:20px; }
.profile-avatar { width:54px; height:54px; display:grid; place-items:center; border-radius:18px; background:rgba(88,199,187,.14); color:var(--accent); font-size:22px; font-weight:900; }
.profile-summary strong { display:block; font-size:20px; }
.profile-summary small { display:block; margin-top:4px; color:var(--muted); }
.mobile-form { gap:14px; }
.member-save-btn { width:100%; margin-top:4px; }
.member-bottom-nav { display:none; }

@media (max-width: 900px) {
  .member-app .sidebar { display:none; }
  .member-app .workspace { width:100%; margin-left:0; }
  .member-app .menu-toggle { display:none; }
  .member-app .topbar { height:52px; padding:0 16px; }
  .member-app .topbar-title { font-size:14px; }
  .member-app .content-area { padding:18px 14px 92px; }
  .member-app .desktop-only { display:none !important; }
  .member-app .mobile-list { display:block; }
  .member-metrics { grid-template-columns:1fr 1fr; }
  .member-metric { min-height:104px; padding:15px; border-radius:14px; }
  .member-metric strong { font-size:20px; }
  .member-section { margin:12px 0; padding:16px; border-radius:15px; }
  .member-bottom-nav { position:fixed; left:0; right:0; bottom:0; z-index:80; display:grid; grid-template-columns:repeat(4,1fr); min-height:68px; padding:8px 10px calc(8px + env(safe-area-inset-bottom)); background:rgba(31,38,52,.97); border-top:1px solid var(--line); backdrop-filter:blur(16px); }
  .member-bottom-nav a { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; color:#8f9bad; font-size:11px; }
  .member-bottom-nav a span { font-size:18px; line-height:1; }
  .member-bottom-nav a b { font-weight:700; }
  .member-bottom-nav a.active { color:var(--accent); }
}
@media (max-width: 560px) {
  .member-hero { margin-bottom:14px; }
  .member-hero h1 { font-size:24px; }
  .member-profile-link { min-height:36px; padding:7px 11px; }
  .member-metrics { gap:9px; }
  .member-metric { min-height:98px; padding:13px; }
  .member-metric span { font-size:12px; }
  .member-metric strong { margin-top:8px; font-size:18px; word-break:keep-all; }
  .member-metric small { font-size:11px; }
  .member-action { min-width:100%; }
  .member-section-title h2 { font-size:18px; }
  .mobile-record { padding:14px 0; }
  .record-main strong,.record-value strong { font-size:14px; }
}

.status-badge{display:inline-block;padding:4px 9px;border-radius:999px;font-size:13px;font-weight:700}.status-badge.active{background:#153f32;color:#65e6b2}.status-badge.suspended{background:#502229;color:#ff9aa8}.account-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}.account-actions form{margin:0}.danger-btn{background:#a9384b!important;color:#fff!important;border-color:#c64b60!important}.flash.error{background:#5b2028;color:#ffd5da;border:1px solid #a94051;padding:14px;border-radius:10px;margin-bottom:14px}
