:root {
  color-scheme: light;
  --canvas: #f7f5f2;
  --paper: #fff;
  --ink: #211f1d;
  --muted: #746d67;
  --line: #e8e1da;
  --orange: #c65d1a;
  --orange-dark: #a9470e;
  --orange-soft: #fff1e6;
  --green: #16865c;
  --green-soft: #e9f7f1;
  --red: #bf3b31;
  --red-soft: #fff0ee;
  --shadow: 0 16px 45px rgba(67, 45, 28, .08);
  font-family: Inter, Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.boot-spinner, .spinner { border: 2px solid #ead8c8; border-top-color: var(--orange); border-radius: 50%; animation: spin .75s linear infinite; }
.boot-spinner { width: 34px; height: 34px; margin: 30vh auto; }
.spinner { width: 15px; height: 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-visual { padding: 54px; color: #fff; background: linear-gradient(145deg, #8f3f0d, #c65d1a 58%, #e48942); display: flex; flex-direction: column; justify-content: space-between; }
.logo { display: inline-flex; align-items: center; gap: 11px; font-weight: 850; letter-spacing: -.03em; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--orange); background: #fff; }
.auth-copy { max-width: 560px; }
.auth-copy h1 { margin: 0; font-size: clamp(38px, 5vw, 67px); line-height: 1.06; letter-spacing: -.06em; }
.auth-copy p { margin: 22px 0 0; color: rgba(255,255,255,.76); line-height: 1.7; }
.auth-visual small { color: rgba(255,255,255,.62); }
.auth-main { display: grid; place-items: center; padding: 36px; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { margin: 0 0 8px; font-size: 29px; letter-spacing: -.045em; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.field { display: block; margin: 16px 0; }
.field > span { display: block; margin: 0 0 8px 2px; color: var(--muted); font-size: 11px; font-weight: 750; }
.field input, .field select { width: 100%; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: var(--paper); }
.field input:focus, .field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(198,93,26,.1); }
.primary, .secondary, .danger, .ghost { min-height: 42px; padding: 0 16px; border-radius: 8px; border: 0; font-weight: 800; cursor: pointer; }
.primary { color: #fff; background: var(--orange); }
.primary:hover { background: var(--orange-dark); }
.primary.wide { width: 100%; min-height: 48px; margin-top: 10px; }
.secondary { color: var(--orange-dark); background: var(--orange-soft); }
.danger { color: var(--red); background: var(--red-soft); }
.ghost { color: var(--muted); background: transparent; }
button:disabled { opacity: .5; cursor: wait; }
.form-error { min-height: 18px; margin: 10px 0; color: var(--red); font-size: 12px; }
.form-success { padding: 12px 14px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 12px; line-height: 1.55; }
.auth-links { display: flex; justify-content: space-between; margin-top: 20px; color: var(--orange-dark); font-size: 12px; }
.turnstile { min-height: 1px; margin-top: 14px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; border-right: 1px solid var(--line); background: var(--paper); }
.sidebar .logo { margin: 0 10px 30px; }
.sidebar .logo-mark { color: #fff; background: var(--orange); }
.nav-label { margin: 26px 11px 8px; color: #a59b93; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.nav-link { display: flex; align-items: center; min-height: 42px; margin: 3px 0; padding: 0 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.nav-link:hover, .nav-link.active { color: var(--orange-dark); background: var(--orange-soft); }
.sidebar-user { position: absolute; left: 20px; right: 20px; bottom: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.content { min-width: 0; padding: 32px clamp(20px, 4vw, 58px) 72px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 31px; }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.045em; }
.topbar-actions { display: flex; gap: 8px; }
.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(4, 1fr); }
.metric, .card { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 8px 25px rgba(67,45,28,.035); }
.metric { padding: 20px; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 10px; font-size: 27px; letter-spacing: -.045em; }
.card { padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 15px; }
.inline-form { display: grid; grid-template-columns: 1fr 1.25fr auto; gap: 10px; }
.inline-form input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; }
.inline-form input:focus { border-color: var(--orange); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 10px; color: var(--muted); font-size: 10px; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 14px 10px; border-bottom: 1px solid #f0ebe7; vertical-align: middle; }
td select, .quota-input { max-width: 130px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; }
.status.completed, .status.active-user { color: var(--green); background: var(--green-soft); }
.status.queued, .status.active { color: var(--orange-dark); background: var(--orange-soft); }
.status.failed, .status.suspended { color: var(--red); background: var(--red-soft); }
.rank { color: var(--orange-dark); font-weight: 850; }
.muted { color: var(--muted); }
.empty { padding: 34px; color: var(--muted); text-align: center; font-size: 12px; }
.key-reveal { margin: 14px 0; padding: 14px; border: 1px dashed var(--orange); border-radius: 8px; color: var(--orange-dark); background: var(--orange-soft); font: 11px/1.6 ui-monospace, monospace; overflow-wrap: anywhere; }
.split { grid-template-columns: 1fr 1fr; }
.security-list { margin: 0; padding: 0; list-style: none; }
.security-list li { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.security-list li:last-child { border-bottom: 0; }
.security-list li > span:last-child { display: flex; align-items: center; gap: 12px; }
.text-danger { padding: 0; border: 0; color: var(--red); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.notice { padding: 13px 15px; border-radius: 9px; color: var(--orange-dark); background: var(--orange-soft); font-size: 12px; line-height: 1.6; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
@media (max-width: 960px) { .metrics { grid-template-columns: repeat(2, 1fr); } .split { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .auth-page { grid-template-columns: 1fr; } .auth-visual { display: none; } .auth-main { padding: 28px 20px; }
  .shell { display: block; } .sidebar { position: static; width: 100%; height: auto; padding: 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .logo { margin: 0 0 12px; } .sidebar nav { display: flex; gap: 4px; overflow-x: auto; } .nav-label, .sidebar-user { display: none; }
  .nav-link { white-space: nowrap; } .content { padding: 24px 14px 60px; } .metrics { grid-template-columns: 1fr 1fr; }
  .inline-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1.5s !important; scroll-behavior: auto !important; } }
