:root {
  --bg: #0f1420; --panel: #171e2e; --panel-2: #1d2638; --line: #2a3550;
  --text: #e6ebf5; --muted: #8b96ad; --accent: #6366f1; --accent-2: #818cf8;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p { margin-top: 0; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px; }
.login-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-card button { width: 100%; margin-top: 18px; padding: 11px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-card button:disabled { opacity: .6; cursor: wait; }

/* shell */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { font-weight: 700; font-size: 16px; }
.brand span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
nav a:hover { background: var(--panel-2); }
nav a.active { background: var(--accent); color: #fff; }
nav a.disabled { color: var(--muted); pointer-events: none; }
nav .nav-section { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 14px 10px 4px; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; font-size: 13px; }
.lang-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; }
.lang-row select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 13px; }
.sidebar-foot button { width: 100%; margin-top: 10px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.sidebar-foot button:hover { border-color: var(--bad); color: var(--bad); }

/* content */
main { padding: 26px 30px; max-width: 1060px; }
h2 { margin: 0 0 18px; font-size: 19px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .num { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.stat .lbl { font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
pre.payload { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.bar-select { display: flex; gap: 8px; margin-bottom: 14px; }
.bar-select button { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font-size: 13px; }
.bar-select button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty { color: var(--muted); padding: 22px; text-align: center; }
.clickable { cursor: pointer; color: var(--accent-2); }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
a.back { color: var(--accent-2); text-decoration: none; font-size: 13px; display: inline-block; margin-bottom: 12px; }

/* buttons & forms (C3) */
.primary-btn { padding: 9px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.primary-btn:hover { background: var(--accent-2); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }
.danger-btn { padding: 4px 12px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.danger-btn:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.armed { border-color: var(--bad) !important; color: var(--bad) !important; font-weight: 700; }
.danger-btn:disabled { opacity: .35; cursor: default; }
.copy-input { width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.prompt-box { min-height: 220px; white-space: pre-wrap; resize: vertical; }
.check-line { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 14px; }
.check-line input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.check-line select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.current-plan { border-color: var(--accent); }

/* integration guide (keys page + overview hint) */
.guide-box { border-left: 3px solid var(--accent); }

/* login resend-code link */
.linklike { background: none; border: none; padding: 6px 0; margin-top: 2px; color: #6366f1; font-size: 13px; text-decoration: underline; cursor: pointer; }
.linklike:disabled { color: #9ca3af; cursor: default; text-decoration: none; }
.guide-box h3 { margin: 0 0 8px; font-size: 15px; }
.guide-details { margin-top: 12px; }
.guide-details summary { cursor: pointer; color: var(--accent-2); font-size: 13px; }
.guide-details pre { margin-top: 10px; }
.guide-link { display: inline-block; margin-top: 8px; color: var(--accent-2); text-decoration: none; font-weight: 600; }
