@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
  --bg-0: #08111f;
  --bg-1: #0d1728;
  --panel: #121c2e;
  --panel-2: #182438;
  --line: #2a3954;
  --line-soft: rgba(255,255,255,.06);
  --text: #eef3fb;
  --muted: #93a4bd;
  --accent: #1fb89a;
  --accent-soft: rgba(31,184,154,.14);
  --accent-strong: #14a085;
  --warn: #e2b039;
  --danger: #e5677a;
  --ok: #35c8a0;
  --shadow: 0 16px 40px rgba(0,0,0,.28);
  --radius: 14px;
  --sidebar: 248px;
  --font: "Pretendard", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 8% -10%, rgba(31,184,154,.12), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(70,120,200,.08), transparent 50%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Shell */
.shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}
.topbar { display: none; }
.nav-backdrop { display: none; }

.sidebar {
  flex: 0 0 var(--sidebar);
  width: var(--sidebar);
  border-right: 1px solid var(--line);
  background: rgba(8, 15, 28, .96);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 30;
}
.brand-block { padding: 0 6px 4px; }
.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -.03em;
  color: var(--text);
  margin: 0;
}
.side-brand { color: var(--accent); }
.brand-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.side-nav a {
  display: block;
  color: var(--text);
  padding: 11px 13px;
  border-radius: 11px;
  text-decoration: none;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  font-weight: 650;
  font-size: .9rem;
  transition: .15s ease;
}
.side-nav a:hover {
  background: rgba(255,255,255,.04);
  border-color: rgba(31,184,154,.4);
  text-decoration: none;
}
.side-nav a.active {
  background: var(--accent-soft);
  border-color: rgba(31,184,154,.55);
  color: #8aecd4;
}
.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.side-user {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
}
.side-user strong {
  color: var(--text);
  font-size: .88rem;
}
.warn-text { color: var(--danger); }

.main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 28px 32px 48px;
}
.main > .card,
.main > .hero,
.main > .grid,
.main > .plan-grid { width: 100%; }

/* Auth */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(700px 360px at 20% 10%, rgba(31,184,154,.16), transparent 60%),
    radial-gradient(600px 320px at 90% 20%, rgba(70,120,200,.12), transparent 55%),
    linear-gradient(180deg, #07101c, #0b1524);
}
.auth-admin {
  background:
    radial-gradient(700px 360px at 80% 10%, rgba(226,176,57,.12), transparent 60%),
    radial-gradient(600px 320px at 10% 30%, rgba(31,184,154,.08), transparent 55%),
    linear-gradient(180deg, #070d16, #0c1420);
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(16, 24, 38, .94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.auth-kicker {
  display: inline-block;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: 10px;
}
.auth-admin .auth-kicker { color: var(--warn); }
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  letter-spacing: -.03em;
}
.auth-card > p {
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.55;
  font-size: .92rem;
}
.auth-foot {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

/* Content */
.hero {
  background: linear-gradient(135deg, rgba(22,33,52,.96), rgba(14,22,36,.94));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  letter-spacing: -.03em;
  font-weight: 780;
}
.hero p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .92rem; }

.grid { display: grid; gap: 16px; width: 100%; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

.card {
  background: rgba(16, 25, 40, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px;
  min-width: 0;
  box-shadow: 0 1px 0 var(--line-soft);
}
.card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card h2, .card h3 {
  margin: 0 0 14px;
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.stat-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.stat-value {
  font-size: 1.55rem;
  font-weight: 780;
  margin-top: 8px;
  letter-spacing: -.03em;
}
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.error { color: var(--danger); margin: 0 0 12px; }
.ok { color: var(--ok); margin: 0 0 12px; }

label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: #0a1322;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s ease;
}
textarea { line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(31,184,154,.65); }
.form-row { display: grid; gap: 12px; margin-bottom: 12px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: var(--text);
  font-weight: 500;
}
.cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101a2b;
  color: var(--text);
  font-weight: 600;
  font-size: .86rem;
  cursor: pointer;
}
.cat-option:has(input:checked) {
  border-color: rgba(31,184,154,.7);
  background: rgba(31,184,154,.12);
  color: #9ff0dc;
}
.cat-option input { accent-color: var(--accent-strong); }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: .9rem;
  background: linear-gradient(180deg, #28c9aa, var(--accent-strong));
  color: #04231d;
  transition: filter .15s ease, transform .1s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: #152033;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.warn { background: var(--warn); color: #2a1c00; }
.btn.danger { background: var(--danger); color: white; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid rgba(42,57,84,.85);
  vertical-align: top;
  font-size: .88rem;
}
th {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 750;
  border: 1px solid transparent;
}
.pill.P0 { background: rgba(31,184,154,.15); color: #35c8a0; border-color: rgba(31,184,154,.35); }
.pill.P1 { background: rgba(74,163,226,.15); color: #6cbcf0; border-color: rgba(74,163,226,.35); }
.pill.P2 { background: rgba(226,176,57,.15); color: #e2b039; border-color: rgba(226,176,57,.35); }
.pill.P3 { background: rgba(147,164,189,.15); color: #93a4bd; border-color: rgba(147,164,189,.35); }
.pill.Drop { background: rgba(107,114,128,.15); color: #9ca3af; border-color: rgba(107,114,128,.35); }
.tag {
  display: inline-block;
  padding: 2px 7px;
  margin: 0 4px 4px 0;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: .72rem;
}
.hint-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(31,184,154,.35);
  border-radius: 10px;
  background: rgba(31,184,154,.1);
  color: #b7f3e5;
  font-size: .9rem;
  line-height: 1.45;
}
.snippet-box {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1626;
  color: #c5d2e6;
  font-size: .9rem;
  line-height: 1.5;
  max-height: 7.5em;
  overflow: auto;
  white-space: pre-wrap;
}
.session-stats {
  text-align: right;
  margin-top: 4px;
}
.tag.src-category { color: #9ff0dc; background: rgba(31,184,154,.14); }
.tag.src-manual { color: #f0d39f; background: rgba(240,211,159,.14); }
.tag.src-seed { color: #9fc5f0; background: rgba(159,197,240,.14); }
.kw-add-form label { font-weight: 600; }
.kw-list { max-height: 360px; overflow: auto; }
.kw-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.score { font-variant-numeric: tabular-nums; font-weight: 700; }
.url { word-break: break-all; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.plan-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: rgba(18, 28, 44, .9);
}
.plan-card.current {
  border-color: rgba(31,184,154,.55);
  box-shadow: 0 0 0 1px rgba(31,184,154,.25);
}
.plan-card h3 { margin: 0 0 6px; }
.price { font-size: 1.45rem; font-weight: 800; margin: 10px 0 12px; }

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 750;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
}
.status-pill.status-new { color: #93a4bd; }
.status-pill.status-drafted { color: #6cbcf0; border-color: rgba(74,163,226,.35); }
.status-pill.status-commented { color: #35c8a0; border-color: rgba(31,184,154,.35); }
.status-pill.status-skipped { color: #e5677a; border-color: rgba(229,103,122,.35); }
.status-pill.status-pending { color: #93a4bd; }
.status-pill.status-submitted { color: #e2b039; border-color: rgba(226,176,57,.35); }
.status-pill.status-confirmed { color: #35c8a0; border-color: rgba(31,184,154,.35); }
.status-pill.status-rejected { color: #e5677a; border-color: rgba(229,103,122,.35); }

.wallet-box {
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: #0a1322;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9rem;
}
.admin-user-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.admin-user-form select,
.admin-user-form input { width: auto; min-width: 0; padding: 6px 8px; font-size: .8rem; }

.prospect-row.active td { background: rgba(31,184,154,.08); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(460px, 100%);
  background: #121a2b; border-left: 1px solid var(--line);
  z-index: 50; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: start;
  padding: 18px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drawer-body { padding: 18px; overflow: auto; }

.work-options { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 4px; }
.work-options label {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; color: var(--text); font-size: .9rem;
}
.phrase-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); border-radius: 999px; padding: 6px 10px;
  font-size: .78rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.shortcut-help kbd, .work-body kbd, .hint kbd {
  display: inline-block; min-width: 1.2em; padding: 1px 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  background: #0b1220; font-size: .75rem;
}
.work-body { min-height: 100vh; }
.work-shell { width: 100%; max-width: none; margin: 0; padding: 18px 24px 40px; }
.work-top {
  display: flex; justify-content: space-between; gap: 16px; align-items: end;
  margin-bottom: 16px; flex-wrap: wrap;
}
.work-top h1 { margin: 4px 0 0; font-size: 1.45rem; }
.work-top-right { display: grid; gap: 8px; justify-items: end; }
.work-progress { min-width: 220px; }
.work-progress .bar {
  height: 8px; border-radius: 999px; background: #1a2436; overflow: hidden; margin-top: 6px;
}
.work-progress .bar i {
  display: block; height: 100%; background: linear-gradient(90deg, #1fb89a, #4aa3e2);
}
.work-check { margin: 0; color: var(--muted); font-size: .85rem; display: inline-flex; gap: 6px; align-items: center; }
.work-main { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
.work-queue h3 { margin: 0 0 10px; font-size: 1rem; }
.queue-list { display: grid; gap: 8px; max-height: 70vh; overflow: auto; }
.queue-item {
  text-align: left; appearance: none; cursor: pointer;
  background: #0b1220; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; display: grid; gap: 4px; color: var(--text);
}
.queue-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(31,184,154,.35); }
.queue-title {
  font-size: .9rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.work-stage h2 { margin: 8px 0 6px; font-size: 1.25rem; line-height: 1.35; }
.stage-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-hero {
  width: 100%; margin: 14px 0 8px; border: 0; cursor: pointer;
  border-radius: 14px; padding: 16px 18px; font-size: 1.05rem; font-weight: 800;
  background: linear-gradient(135deg, #28c9aa, #148f78); color: #04231d;
}
.btn-hero:hover { filter: brightness(1.05); }
.stage-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.work-empty { padding: 28px; }
.hint { margin: 0 0 14px; }
.shortcut-line { margin-top: 16px; }

.theme-admin .side-brand { color: var(--warn); }
.theme-admin .side-nav a.active {
  background: rgba(226,176,57,.12);
  border-color: rgba(226,176,57,.45);
  color: #f0d089;
}

/* Guide / FAQ */
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.guide-toc a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: .84rem;
  font-weight: 650;
  text-decoration: none;
}
.guide-toc a:hover {
  border-color: rgba(31,184,154,.45);
  color: #8aecd4;
  text-decoration: none;
}
.guide-section {
  margin-bottom: 14px;
}
.guide-section h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
.guide-section h3 {
  margin: 0 0 6px;
  font-size: .95rem;
}
.guide-section > p,
.guide-block p,
.faq-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: .92rem;
}
.guide-list,
.guide-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.65;
  font-size: .92rem;
}
.guide-list li + li,
.guide-steps li + li { margin-top: 6px; }
.guide-block + .guide-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.guide-section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .84em;
  padding: 1px 6px;
  border-radius: 6px;
  background: #0a1322;
  border: 1px solid var(--line);
  color: #c9d7ef;
}
.faq-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  padding: 0 14px;
  margin-bottom: 8px;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-weight: 700;
  font-size: .92rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 700;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p {
  padding: 0 0 14px;
}

@media (max-width: 1200px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 22px 18px 40px; }
}

@media (max-width: 900px) {
  .work-main { grid-template-columns: 1fr; }
  .queue-list { max-height: 220px; }
  .work-shell { padding: 12px 14px 32px; }
  .work-top-right { justify-items: start; width: 100%; }
  .work-progress { min-width: 0; width: 100%; }
}

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 15, 28, .96);
    backdrop-filter: blur(8px);
  }
  .topbar-plan {
    margin-left: auto;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
  }
  .nav-toggle {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel-2);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-content: center;
    gap: 5px;
    padding: 0;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 86vw);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .2s ease;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 25;
  }
  .nav-backdrop[hidden] { display: none !important; }
  .main { padding: 16px 14px 48px; width: 100%; flex: 1 1 auto; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .form-row.cols-2, .plan-grid { grid-template-columns: 1fr; }
  .hero { padding: 16px; }
  .hero h1 { font-size: 1.25rem; }
  .card { padding: 14px; }
  .stat-value { font-size: 1.3rem; }
  .actions .btn { flex: 1 1 auto; }
  table { min-width: 560px; }
  .admin-user-form { flex-direction: column; align-items: stretch; }
  .admin-user-form select, .admin-user-form input { width: 100%; }
  .drawer { width: 100%; }
}

@media (max-width: 560px) {
  .grid.stats { gap: 10px; }
  .price { font-size: 1.25rem; }
  th, td { font-size: .82rem; padding: 8px 6px; }
}
