/* ============================================================
   Magnific Admin — soft blush light theme + optional dark mode
   ============================================================ */
:root {
  --bg: #FBF7F9;
  --bg-2: #F5EEF2;
  --surface: #FFFFFF;
  --surface-2: #FDF6FA;
  --border: #F0E4EC;
  --border-2: #EAD9E5;
  --text: #1A1420;
  --muted: #8A7F88;
  --muted-2: #B5A9B2;
  --primary: #FF6FA5;
  --primary-2: #FF9CC4;
  --primary-ink: #6E1840;
  --accent-bg: #FFE9F2;
  --grad: linear-gradient(135deg, #FF6FA5, #FF9CC4);
  --green: #16a34a;
  --green-bg: #e7f7ee;
  --red: #e5484d;
  --red-bg: #fdeeee;
  --lilac-bg: #efeafe;
  --mint-bg: #e4f7f0;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(24,18,28,0.04), 0 8px 24px rgba(120,60,90,0.05);
  --shadow-soft: 0 1px 2px rgba(24,18,28,0.04);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html[data-theme="dark"] {
  --bg: #14101a;
  --bg-2: #1a151f;
  --surface: #1c1722;
  --surface-2: #221b29;
  --border: #2c2533;
  --border-2: #382f40;
  --text: #f3edf5;
  --muted: #a99fb0;
  --muted-2: #7c7184;
  --primary: #FF80B0;
  --primary-2: #FFA6CC;
  --primary-ink: #2a0f1c;
  --accent-bg: #3a2330;
  --grad: linear-gradient(135deg, #FF6FA5, #FF9CC4);
  --green: #4ade80;
  --green-bg: rgba(74,222,128,0.13);
  --red: #ff7a7d;
  --red-bg: rgba(255,122,125,0.13);
  --lilac-bg: #2c2540;
  --mint-bg: #1d3630;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 10px 30px rgba(0,0,0,0.35);
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex: 0 0 250px; background: var(--surface);
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 6px 16px rgba(255,111,165,0.45);
}
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--primary-ink); }
html[data-theme="dark"] .nav-item.active { color: var(--primary-2); }
.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar-foot {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.logout { color: var(--muted); font-size: 13px; }
.logout:hover { color: var(--primary); }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--border-2); }
.theme-toggle svg { width: 17px; height: 17px; }

/* main */
.main { flex: 1; padding: 32px 40px 60px; max-width: 1440px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; gap: 16px; }
h1 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); margin: 6px 0 0; }
.page-actions { display: flex; gap: 10px; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; min-height: 116px; box-shadow: var(--shadow-soft); }
.stat .label { color: var(--muted); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.stat .value { font-size: 33px; font-weight: 700; margin-top: 12px; letter-spacing: -0.02em; }
.stat .value.green { color: var(--green); }
.stat .value.red { color: var(--red); }
.stat .hint { color: var(--muted-2); font-size: 12px; margin-top: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; box-shadow: var(--shadow-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.card-body { padding: 18px 22px; }
.card-body.tight { padding: 0; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; padding: 13px 22px; border-bottom: 1px solid var(--border); }
td { padding: 14px 22px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }

/* pills / badges */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-bad { background: var(--red-bg); color: var(--red); }
.pill-mut { background: var(--bg-2); color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; background: var(--lilac-bg); color: #6d4fb3; font-weight: 600; }
html[data-theme="dark"] .badge { color: #c4b3f0; }

/* buttons / forms */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .12s; }
.btn:hover { background: var(--bg-2); border-color: var(--primary-2); }
.btn-primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 6px 16px rgba(255,111,165,0.40); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-danger { color: var(--red); border-color: var(--red-bg); background: var(--red-bg); }
.btn-danger:hover { filter: brightness(0.98); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input, select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--border-2); color: var(--text); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 13.5px; }
textarea { font-family: var(--mono); font-size: 12px; min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-bg); }
.field { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.form-row > div { flex: 1; min-width: 150px; }

/* flash */
.flash { padding: 11px 16px; border-radius: 11px; margin-bottom: 18px; font-size: 13px; border: 1px solid transparent; font-weight: 500; }
.flash-ok { background: var(--green-bg); color: var(--green); }
.flash-err { background: var(--red-bg); color: var(--red); }

/* misc */
.kvs { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; }
.kvs .k { color: var(--muted); }
.empty { color: var(--muted); padding: 42px; text-align: center; }
.json { background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; padding: 14px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow: auto; }
.dl-link { color: var(--primary); word-break: break-all; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ---------- Test Panel ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 13px; margin-bottom: 22px; }
.tab { padding: 9px 20px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border: none; background: none; font-family: inherit; }
.tab.active { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-soft); }
html[data-theme="dark"] .tab.active { color: var(--primary-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; transition: .12s; }
.asset-card:hover { border-color: var(--primary-2); transform: translateY(-2px); }
.asset-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-bg); }
.asset-thumb { width: 100%; height: 120px; object-fit: cover; background: var(--bg-2); display: block; }
.asset-thumb.placeholder { display: grid; place-items: center; color: var(--muted-2); font-size: 26px; }
.asset-meta { padding: 10px 12px; }
.asset-meta .name { font-weight: 600; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.asset-meta .sub { display: flex; gap: 6px; align-items: center; margin-top: 7px; }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 11px; cursor: pointer; transition: .12s; }
.option:hover { border-color: var(--primary-2); }
.option.selected { border-color: var(--primary); background: var(--accent-bg); }
.option .radio { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--border-2); flex: 0 0 18px; display: grid; place-items: center; }
.option.selected .radio { border-color: var(--primary); }
.option.selected .radio::after { content: ""; width: 9px; height: 9px; border-radius: 999px; background: var(--primary); }
.option .opt-label { font-weight: 600; font-size: 13.5px; }
.option .opt-sub { color: var(--muted); font-size: 12px; }

.dl-result { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 11px; margin-top: 10px; background: var(--surface-2); }
.dl-result.fail { background: var(--red-bg); }
.step-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--accent-bg); border-top-color: var(--primary); border-radius: 999px; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- API Docs ---------- */
.doc-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 22px; }
.doc-hero .card { margin: 0; }
.codeline { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.codeline .val { flex: 1; }
.copy-btn { border: 1px solid var(--border-2); background: var(--surface); color: var(--muted); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; font-weight: 600; cursor: pointer; font-family: inherit; flex: 0 0 auto; }
.copy-btn:hover { color: var(--primary); border-color: var(--primary-2); }
.copy-btn.done { color: var(--green); border-color: var(--green); }

.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.toc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text); }
.toc-chip:hover { border-color: var(--primary-2); }

.m { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.03em; }
.m-get { background: var(--mint-bg); color: #0f8a5f; }
.m-post { background: var(--accent-bg); color: var(--primary-ink); }
.m-put, .m-patch { background: var(--lilac-bg); color: #6d4fb3; }
.m-delete { background: var(--red-bg); color: var(--red); }

/* rendered markdown */
.prose { font-size: 14px; line-height: 1.65; }
.prose h1 { font-size: 24px; margin: 0 0 6px; }
.prose h2 { font-size: 18px; margin: 30px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.prose h3 { font-size: 15px; margin: 24px 0 10px; display: flex; align-items: center; gap: 10px; scroll-margin-top: 20px; }
.prose h3 .path { font-family: var(--mono); font-size: 14px; }
.prose p, .prose li { color: var(--text); }
.prose blockquote { margin: 0 0 14px; padding: 12px 16px; background: var(--accent-bg); border-radius: 10px; color: var(--primary-ink); }
.prose a { color: var(--primary); font-weight: 600; }
.prose code { background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-family: var(--mono); font-size: 12.5px; }
.prose pre { position: relative; background: #1c1722; border: 1px solid var(--border-2); border-radius: 11px; padding: 14px 16px; overflow: auto; }
.prose pre code { background: none; border: none; padding: 0; color: #f3edf5; font-size: 12.5px; }
html[data-theme="dark"] .prose pre { background: #0e0b13; }
.prose table { margin: 12px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.prose th, .prose td { padding: 9px 14px; }
.prose pre .code-copy { position: absolute; top: 8px; right: 8px; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,20,32,0.45); backdrop-filter: blur(3px); display: none; place-items: center; z-index: 60; padding: 20px; }
.modal-overlay.open { display: grid; }
.modal { width: 540px; max-width: 100%; max-height: 88vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); animation: pop .14s ease; text-align: left; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close { border: none; background: none; cursor: pointer; font-size: 24px; line-height: 1; color: var(--muted); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-section + .modal-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-bg), var(--bg) 60%); }
.login-card { width: 372px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; padding-bottom: 6px; }
.login-card h2 { text-align: center; margin: 6px 0 4px; font-size: 20px; font-weight: 700; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13px; }
