:root {
    color-scheme: dark;
    --bg: #0d1117;
    --bg-secondary: #151b23;
    --bg-tertiary: #1a222d;
    --bg-hover: #1c2631;
    --bg-input: #0a0e14;
    --bg-table-header: #151b23;
    --bg-alert-success: #12281b;
    --bg-alert-error: #2d1618;
    --header-bg: rgba(13,17,23,0.85);
    --header-border: #212830;
    --nav-bg: rgba(13,17,23,0.92);
    --text: #e6edf3;
    --text-secondary: #c9d4de;
    --text-tertiary: #aab4c0;
    --text-muted: #8b96a5;
    --text-faint: #6e7a89;
    --text-hover: #f0f6fc;
    --border: #212830;
    --border-hover: #2e3947;
    --border-strong: #3d4a5c;
    --border-input: #2e3947;
    --accent: #2f81f7;
    --accent-hover: #58a6ff;
    --accent-bg: rgba(47,129,247,0.13);
    --success: #3fb950;
    --success-bg: rgba(46,160,67,0.14);
    --danger: #f85149;
    --danger-bg: rgba(248,81,73,0.13);
    --warning: #d29922;
    --warning-bg: rgba(210,153,34,0.13);
    --info-bg: rgba(47,129,247,0.13);
    --btn-primary: #2f81f7;
    --btn-primary-hover: #58a6ff;
    --focus-ring: rgba(88,166,255,0.35);
    --footer-border: #212830;
    --shadow-sm: 0 1px 2px rgba(1,4,9,0.5);
    --shadow-md: 0 10px 28px rgba(1,4,9,0.55);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-mono: 'Cascadia Mono', 'SF Mono', Consolas, 'Courier New', monospace;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f6;
    --bg-hover: #e9edf2;
    --bg-input: #ffffff;
    --bg-table-header: #f1f3f6;
    --bg-alert-success: #eaf7ee;
    --bg-alert-error: #fdeeee;
    --header-bg: rgba(255,255,255,0.85);
    --header-border: #e2e5ea;
    --nav-bg: rgba(255,255,255,0.92);
    --text: #14181f;
    --text-secondary: #39424f;
    --text-tertiary: #4b5563;
    --text-muted: #67707c;
    --text-faint: #98a1ad;
    --text-hover: #0b0f14;
    --border: #e2e5ea;
    --border-hover: #c8cfd8;
    --border-strong: #aab4c0;
    --border-input: #d7dde4;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-bg: rgba(37,99,235,0.09);
    --success: #16a34a;
    --success-bg: rgba(22,163,74,0.09);
    --danger: #dc2626;
    --danger-bg: rgba(220,38,38,0.08);
    --warning: #b45309;
    --warning-bg: rgba(180,83,9,0.09);
    --info-bg: rgba(37,99,235,0.09);
    --btn-primary: #2563eb;
    --btn-primary-hover: #1d4ed8;
    --focus-ring: rgba(37,99,235,0.25);
    --footer-border: #e2e5ea;
    --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
    --shadow-md: 0 10px 26px rgba(16,24,40,0.09);
}

* { margin:0; padding:0; box-sizing:border-box; }
::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-faint); }
html { scroll-behavior:smooth; }
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif; background:var(--bg); color:var(--text); min-height:100vh; transition:background 0.25s,color 0.25s; font-size:14px; line-height:1.5; }
a { color:var(--accent); text-decoration:none; }
a:hover { color:var(--accent-hover); }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
::selection { background:var(--accent-bg); }

/* ---------- Header ---------- */
.header { background:var(--header-bg); backdrop-filter:blur(10px); border-bottom:1px solid var(--header-border); position:sticky; top:0; z-index:110; }
.header-inner { max-width:1200px; margin:0 auto; padding:12px 30px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.header-logo { display:flex; align-items:center; gap:11px; }
.header-logo .icon { width:34px; height:34px; border-radius:9px; display:flex; align-items:center; justify-content:center; background:#374151; box-shadow:inset 0 1px 0 rgba(255,255,255,0.08); }
.pick-swing { animation:pick 1.2s ease-in-out infinite; transform-origin:50% 85%; }
@keyframes pick { 0%,100% { transform:rotate(-16deg); } 50% { transform:rotate(16deg); } }
.header h1 { font-size:17px; font-weight:700; letter-spacing:-0.2px; line-height:1.2; }
.header h1 span { color:var(--text-muted); font-weight:600; }
.header-right { display:flex; align-items:center; gap:10px; }
.user-chip { display:inline-flex; align-items:center; gap:8px; padding:3px 12px 3px 4px; background:var(--bg-tertiary); border:1px solid var(--border); border-radius:999px; }
.user-chip .avatar { width:24px; height:24px; border-radius:50%; background:var(--accent-bg); color:var(--accent); display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; }
.user-chip .uname { font-size:12px; color:var(--text-muted); font-weight:500; }
.theme-toggle { width:34px; height:34px; display:flex; align-items:center; justify-content:center; background:var(--bg-tertiary); border:1px solid var(--border); border-radius:8px; color:var(--text-muted); cursor:pointer; transition:background 0.15s,border-color 0.15s,color 0.15s; }
.theme-toggle:hover { color:var(--text-hover); border-color:var(--border-strong); background:var(--bg-hover); }
.theme-toggle svg { width:16px; height:16px; }
.theme-toggle .icon-sun { display:none; }
[data-theme="light"] .theme-toggle .icon-sun { display:block; }
[data-theme="light"] .theme-toggle .icon-moon { display:none; }

/* ---------- Nav ---------- */
.nav { position:sticky; top:54px; z-index:100; background:var(--nav-bg); backdrop-filter:blur(8px); border-bottom:1px solid var(--border); }
.nav-inner { max-width:1200px; margin:0 auto; padding:6px 30px; display:flex; gap:4px; overflow-x:auto; scrollbar-width:none; }
.nav-inner::-webkit-scrollbar { display:none; }
.nav a { position:relative; color:var(--text-muted); padding:7px 14px; font-size:13px; font-weight:500; border-radius:8px; white-space:nowrap; transition:color 0.15s,background 0.15s; }
.nav a:hover { color:var(--text-hover); background:var(--bg-hover); }
.nav a.active { color:var(--accent); background:var(--accent-bg); }
.nav a.active::after { content:""; position:absolute; left:14px; right:14px; bottom:0; height:2px; border-radius:2px; background:var(--accent); }
.engine-toolbar[data-state="running"] .only-stopped { display:none; }
.engine-toolbar[data-state="stopped"] .only-running { display:none; }
.engine-toolbar button:disabled { opacity:0.6; cursor:not-allowed; }
.nav a.nav-exit { margin-left:auto; display:flex; align-items:center; gap:5px; }
.nav a.nav-exit svg { width:14px; height:14px; }
.nav a.nav-exit:hover { color:var(--danger); background:none; }

/* ---------- Layout ---------- */
.container { max-width:1200px; margin:0 auto; padding:26px 30px 60px; }

.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1 { font-size:22px; font-weight:700; letter-spacing:-0.3px; }
.page-head p { font-size:13px; color:var(--text-muted); margin-top:3px; }
.page-head-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }

/* ---------- Cards ---------- */
.card { background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius-md); padding:22px 24px; margin-bottom:20px; box-shadow:var(--shadow-sm); }
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.card h2 { font-size:15px; font-weight:650; color:var(--text); letter-spacing:-0.1px; }
.card-sub { font-size:12px; color:var(--text-muted); margin-top:2px; }
.card-foot { display:flex; justify-content:flex-end; margin-top:16px; color:var(--text-faint); font-size:11px; flex-wrap:wrap; gap:4px 14px; }

/* ---------- Stats ---------- */
.stats-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-bottom:22px; }
.stat-card { text-align:center; padding:18px 14px 16px; margin:0; transition:transform 0.15s,box-shadow 0.15s,border-color 0.15s; }
.stat-card:hover { transform:translateY(-2px); border-color:var(--border-strong); box-shadow:var(--shadow-md); }
.stat-icon { width:36px; height:36px; margin:0 auto 10px; border-radius:10px; display:flex; align-items:center; justify-content:center; }
.stat-icon svg { width:18px; height:18px; }
.stat-icon.blue { color:var(--accent); background:var(--accent-bg); }
.stat-icon.green { color:var(--success); background:var(--success-bg); }
.stat-icon.orange { color:var(--warning); background:var(--warning-bg); }
.stat-icon.red { color:var(--danger); background:var(--danger-bg); }
.stat-num { font-size:26px; font-weight:700; line-height:1.2; font-variant-numeric:tabular-nums; letter-spacing:-0.4px; }
.stat-num-sm { font-size:20px; letter-spacing:-0.2px; }
.stat-num.blue { color:var(--accent); }
.stat-num.green { color:var(--success); }
.stat-num.orange { color:var(--warning); }
.stat-num.red { color:var(--danger); }
.stat-label { font-size:11px; color:var(--text-muted); margin-top:7px; text-transform:uppercase; letter-spacing:0.8px; font-weight:600; }

/* ---------- Badges ---------- */
.badge { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:0.4px; white-space:nowrap; background:var(--bg-tertiary); color:var(--text-muted); border:1px solid var(--border); }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:0.9; }
.badge-ok { background:var(--success-bg); color:var(--success); border-color:transparent; }
.badge-fail { background:var(--danger-bg); color:var(--danger); border-color:transparent; }
.badge-idle { background:rgba(100,110,125,0.14); color:var(--text-muted); border-color:transparent; }
.badge-info { background:var(--info-bg); color:var(--accent); border-color:transparent; }
.badge-warn { background:var(--warning-bg); color:var(--warning); border-color:transparent; }

/* ---------- Buttons ---------- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; padding:7px 14px; border:1px solid var(--border-strong); border-radius:8px; background:var(--bg-tertiary); color:var(--text-secondary); cursor:pointer; font-size:13px; font-weight:500; font-family:inherit; white-space:nowrap; transition:background 0.15s,border-color 0.15s,color 0.15s,transform 0.1s,box-shadow 0.15s; }
.btn:hover { background:var(--bg-hover); border-color:var(--border-hover); color:var(--text-hover); }
.btn:active { transform:translateY(1px); }
.btn:disabled { opacity:0.55; cursor:not-allowed; }
.btn svg { width:14px; height:14px; flex:none; }
.btn-primary { background:var(--btn-primary); border-color:transparent; color:#fff; }
.btn-primary:hover { background:var(--btn-primary-hover); border-color:transparent; color:#fff; }
.btn-outline { background:transparent; }
.btn-danger { background:var(--danger-bg); border-color:rgba(248,81,73,0.35); color:var(--danger); }
.btn-danger:hover { background:rgba(248,81,73,0.22); border-color:var(--danger); color:var(--danger); }
.btn-success { background:var(--success-bg); border-color:rgba(63,185,80,0.35); color:var(--success); }
.btn-success:hover { background:rgba(63,185,80,0.22); border-color:var(--success); color:var(--success); }
.btn-sm { padding:4px 10px; font-size:12px; border-radius:6px; }
.btn-sm svg { width:12px; height:12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
thead th { padding:10px 14px; text-align:left; background:var(--bg-tertiary); font-weight:600; color:var(--text-muted); font-size:11px; text-transform:uppercase; letter-spacing:0.6px; border-bottom:1px solid var(--border); white-space:nowrap; }
tbody td { padding:11px 14px; border-bottom:1px solid var(--border); font-size:13px; color:var(--text-secondary); vertical-align:middle; }
tbody tr:last-child td { border-bottom:none; }
tbody tr:hover td { background:var(--bg-hover); }
.mono { font-family:var(--font-mono); font-size:12px; }
.muted { color:var(--text-muted); }
.cell-err { color:var(--danger); font-size:11px; margin-top:4px; }
.cell-inline { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.actions-cell { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }

/* ---------- Forms ---------- */
.form-group { margin-bottom:14px; }
.form-group label { display:block; color:var(--text-muted); font-size:12px; font-weight:600; margin-bottom:6px; }
.form-input { width:100%; padding:8px 12px; background:var(--bg-input); border:1px solid var(--border-input); border-radius:8px; color:var(--text-secondary); font-size:13px; font-family:inherit; outline:none; transition:background 0.2s,border-color 0.2s,box-shadow 0.2s; }
.form-input::placeholder { color:var(--text-faint); }
.form-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--focus-ring); }
select.form-input { appearance:none; padding-right:32px; background-image:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b96a5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; cursor:pointer; }
textarea.form-input { resize:vertical; }
.form-hint { font-size:11px; color:var(--text-faint); margin-top:5px; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; align-items:end; }
.grid-2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }

/* ---------- Add-form (special) ---------- */
.keygen-row { display:flex; gap:12px; align-items:flex-end; padding-bottom:23px; }
.keygen-field { flex:1 1 auto; min-width:0; position:relative; }
.keygen-label { display:block; color:var(--text-muted); font-size:12px; font-weight:600; margin-bottom:6px; }
.keygen-input-wrap { position:relative; }
.keygen-input { height:38px; padding-right:56px; }
.keygen-count { position:absolute; right:11px; top:50%; transform:translateY(-50%); font-family:var(--font-mono); font-size:10.5px; color:var(--text-faint); pointer-events:none; }
.keygen-field .field-error { position:absolute; top:100%; left:0; right:0; margin-top:0; }
.keygen-btn { flex:none; height:38px; min-width:180px; padding:0 20px; justify-content:center; }
@media (max-width:600px) { .keygen-row { flex-direction:column; align-items:stretch; } .keygen-field { flex:1 1 auto; } .keygen-btn { width:100%; } }
.add-grid { display:grid; grid-template-columns:190px minmax(0,1fr) minmax(0,1fr) auto; gap:14px; align-items:end; }
.add-grid label { display:block; color:var(--text-muted); font-size:12px; font-weight:600; margin-bottom:6px; }
.add-grid .btn { align-self:end; padding:8px 16px; }
.chip-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:10px; }
.chip-row-label { font-size:11px; color:var(--text-faint); margin-right:2px; }
.chip { padding:3px 11px; border-radius:999px; border:1px solid var(--border); background:var(--bg-tertiary); color:var(--text-muted); font-family:var(--font-mono); font-size:11px; cursor:pointer; transition:border-color 0.15s,color 0.15s,background 0.15s; }
.chip:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-bg); }
.preview { margin-top:12px; font-family:var(--font-mono); font-size:12px; color:var(--success); min-height:16px; white-space:pre-wrap; word-break:break-all; }
.hint-box { margin-top:14px; border-top:1px dashed var(--border); padding-top:12px; }
.hint-box summary { cursor:pointer; font-size:12px; color:var(--text-muted); font-weight:600; list-style:none; }
.hint-box summary::before { content:"\25B8"; display:inline-block; margin-right:6px; transition:transform 0.15s; color:var(--text-faint); }
.hint-box[open] summary::before { transform:rotate(90deg); }
.hint-box summary:hover { color:var(--text-secondary); }
.hint-box p { font-size:12px; color:var(--text-faint); margin-top:10px; line-height:1.65; }
.hidden-input { display:none; }
@media (max-width:900px) { .add-grid { grid-template-columns:1fr 1fr; } .add-grid .btn { width:100%; } }
@media (max-width:600px) { .add-grid { grid-template-columns:1fr; } }

/* ---------- Import panels ---------- */
.import-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:stretch; }
.import-panel { display:flex; flex-direction:column; gap:12px; padding:18px; background:var(--bg-tertiary); border:1px solid var(--border); border-radius:var(--radius-md); }
.import-panel-head { display:flex; gap:10px; align-items:flex-start; }
.import-panel-head h3 { font-size:13px; font-weight:650; letter-spacing:-0.1px; }
.import-ico { width:30px; height:30px; flex:none; border-radius:8px; display:flex; align-items:center; justify-content:center; }
.import-ico svg { width:15px; height:15px; }
.import-ico.blue { color:var(--accent); background:var(--accent-bg); }
.import-ico.orange { color:var(--warning); background:var(--warning-bg); }
.import-ico.green { color:var(--success); background:var(--success-bg); }
.import-panel textarea { flex:1; min-height:110px; resize:vertical; }
.import-btn { justify-content:center; margin-top:auto; }
@media (max-width:900px) { .import-grid { grid-template-columns:1fr; } }

.switch { position:relative; display:inline-flex; align-items:center; cursor:pointer; user-select:none; flex:none; }
.switch input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; z-index:1; }
.switch-track { position:relative; width:38px; height:22px; flex:none; background:var(--border-input); border-radius:999px; transition:background 0.2s; }
.switch-track::after { content:""; position:absolute; top:3px; left:3px; width:16px; height:16px; background:#fff; border-radius:50%; transition:transform 0.2s; box-shadow:0 1px 2px rgba(0,0,0,0.4); }
.switch input:checked + .switch-track { background:var(--btn-primary); }
.switch input:checked + .switch-track::after { transform:translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow:0 0 0 3px var(--focus-ring); }
.switch input:active + .switch-track::after { transform:scale(1.1); }
.switch input:checked:active + .switch-track::after { transform:translateX(16px) scale(1.1); }
.switch-label { font-size:13px; color:var(--text-secondary); }
.switch-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); margin-bottom:18px; }
.switch-row-title { font-size:13px; font-weight:600; color:var(--text-secondary); margin-bottom:2px; }
.input-suffix { position:relative; display:flex; align-items:center; }
.input-suffix .form-input { padding-right:34px; }
.input-suffix span { position:absolute; right:12px; font-size:13px; color:var(--text-faint); pointer-events:none; }

/* ---------- Toolbar / pagination ---------- */
.toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.toolbar .spacer { flex:1; }
.pagination { display:flex; gap:6px; justify-content:center; margin-top:16px; flex-wrap:wrap; align-items:center; }
.page-btn { min-width:32px; height:32px; padding:0 10px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:8px; font-size:13px; color:var(--text-secondary); background:var(--bg-tertiary); transition:border-color 0.15s,color 0.15s,background 0.15s; }
.page-btn:hover { border-color:var(--border-strong); color:var(--text-hover); }
.page-btn.active { background:var(--btn-primary); border-color:var(--btn-primary); color:#fff; }
.page-btn.disabled { opacity:0.45; pointer-events:none; }

/* ---------- Empty / alerts ---------- */
.empty { text-align:center; padding:44px 20px; color:var(--text-faint); font-size:13px; }
.empty svg { width:30px; height:30px; margin-bottom:10px; opacity:0.5; }
.alert { padding:12px 16px; border-radius:var(--radius-md); font-size:13px; margin-bottom:16px; border-left-width:3px; }
.alert-success { background:var(--bg-alert-success); border:1px solid var(--success); border-left-color:var(--success); color:var(--success); }
.alert-error { background:var(--bg-alert-error); border:1px solid var(--danger); border-left-color:var(--danger); color:var(--danger); }

/* ---------- Inline field validation ---------- */
.form-input.invalid { border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-bg); }
.field-error { display:flex; align-items:center; gap:5px; margin-top:6px; font-size:11.5px; color:var(--danger); }
.field-error[hidden] { display:none; }
.field-error svg { width:12px; height:12px; flex:none; }

/* ---------- API key credential card ---------- */
.kr-card { background:var(--bg-secondary); border:1px solid rgba(63,185,80,0.45); border-radius:var(--radius-lg); margin-bottom:20px; overflow:hidden; box-shadow:var(--shadow-sm); }
.kr-head { display:flex; align-items:center; gap:10px; padding:12px 18px; background:var(--bg-alert-success); border-bottom:1px solid rgba(63,185,80,0.22); }
.kr-title { display:inline-flex; align-items:center; gap:9px; font-size:13px; font-weight:650; color:var(--success); }
.kr-check { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%; background:var(--success); color:#fff; flex:none; }
.kr-check svg { width:12px; height:12px; }
.kr-name { margin-left:auto; font-family:var(--font-mono); font-size:11.5px; color:var(--text-muted); background:rgba(255,255,255,0.04); border:1px solid var(--border); padding:3px 11px; border-radius:999px; max-width:60%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kr-body { display:flex; flex-wrap:wrap; }
.kr-qr { flex:0 0 216px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px 16px 16px; border-right:1px solid var(--border); }
.kr-qr-frame { background:#fff; padding:10px; border-radius:var(--radius-md); box-shadow:var(--shadow-sm); line-height:0; }
.kr-qr-frame img, .kr-qr-frame svg { width:168px; height:168px; display:block; }
.kr-qr-cap { margin-top:10px; font-size:11px; color:var(--text-faint); text-align:center; max-width:176px; line-height:1.45; }
.kr-key { flex:1 1 260px; display:flex; flex-direction:column; justify-content:center; gap:11px; padding:20px 18px; min-width:0; }
.kr-key-label { display:flex; align-items:center; gap:8px; font-size:11px; font-weight:650; text-transform:uppercase; letter-spacing:0.6px; color:var(--text-muted); }
.kr-key-label .once { text-transform:none; letter-spacing:0; font-weight:500; color:var(--warning); background:var(--warning-bg); border:1px solid rgba(210,153,34,0.3); padding:2px 9px; border-radius:999px; font-size:10px; }
.kr-key-block { font-family:var(--font-mono); font-size:13px; color:var(--text); background:var(--bg-input); border:1px solid var(--border-input); border-radius:var(--radius-sm); padding:12px 14px; word-break:break-all; line-height:1.55; cursor:text; }
.kr-key-block:focus, .kr-key-block:hover { border-color:var(--border-hover); }
.kr-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.kr-foot { display:flex; align-items:center; gap:8px; padding:9px 18px; border-top:1px solid var(--border); background:var(--bg-tertiary); font-size:11px; color:var(--text-faint); }
.kr-foot svg { width:12px; height:12px; flex:none; opacity:0.7; }
@media (max-width:640px) {
    .kr-qr { flex:1 1 100%; border-right:0; border-bottom:1px solid var(--border); }
    .kr-name { max-width:100%; }
}

/* ---------- Modal dialog ---------- */
.modal-overlay { position:fixed; inset:0; background:rgba(1,4,9,0.66); backdrop-filter:blur(3px); display:flex; align-items:center; justify-content:center; z-index:100; padding:20px; }
.modal { background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-md); width:100%; max-width:620px; max-height:calc(100vh - 40px); overflow:auto; animation:modal-in 0.16s ease-out; }
@keyframes modal-in { from { opacity:0; transform:translateY(10px) scale(0.985); } to { opacity:1; transform:none; } }
.modal-head { display:flex; align-items:center; gap:10px; padding:13px 16px; border-bottom:1px solid var(--border); }
.modal-title { display:inline-flex; align-items:center; gap:9px; font-size:13.5px; font-weight:650; color:var(--text); }
.modal-check { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:50%; background:var(--success); color:#fff; flex:none; }
.modal-check svg { width:12px; height:12px; }
.modal-pill { margin-left:auto; font-family:var(--font-mono); font-size:11.5px; color:var(--text-muted); background:var(--bg-tertiary); border:1px solid var(--border); padding:3px 11px; border-radius:999px; max-width:45%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.modal-close { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; background:none; border:0; color:var(--text-muted); border-radius:var(--radius-sm); cursor:pointer; flex:none; }
.modal-close svg { width:15px; height:15px; }
.modal-close:hover { color:var(--text); background:var(--bg-hover); }
.modal-body { display:flex; padding:0; }
.modal-body .kr-key { padding:18px 16px 18px 18px; }
.modal-body .kr-qr { flex:0 0 188px; border-right:0; border-left:1px solid var(--border); padding:18px 18px 14px; }
.modal-body .kr-qr-frame svg, .modal-body .kr-qr-frame img { width:132px; height:132px; }
.modal-foot { display:flex; align-items:center; gap:12px; padding:11px 16px; border-top:1px solid var(--border); background:var(--bg-tertiary); }
.modal-note { flex:1; display:flex; align-items:center; gap:8px; font-size:11px; color:var(--text-faint); line-height:1.45; min-width:0; }
.modal-note svg { width:13px; height:13px; flex:none; opacity:0.75; }
@media (max-width:560px) {
    .modal-body { flex-direction:column-reverse; }
    .modal-body .kr-qr { flex:1 1 auto; border-left:0; border-bottom:1px solid var(--border); }
    .modal-pill { max-width:100%; }
}

/* ---------- Footer ---------- */
.footer { text-align:center; padding:28px 24px 44px; color:var(--text-faint); font-size:11px; border-top:1px solid var(--footer-border); margin-top:24px; }

/* ---------- Auth (login) ---------- */
.auth-container { display:flex; justify-content:center; align-items:center; min-height:calc(100vh - 140px); padding:24px; }
.auth-card { background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius-lg); padding:34px 36px; width:100%; max-width:390px; box-shadow:var(--shadow-md); }
.auth-header { text-align:center; margin-bottom:26px; }
.auth-logo { width:52px; height:52px; border-radius:14px; background:linear-gradient(135deg,#2f81f7,#1f5fc4); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; box-shadow:0 4px 14px rgba(31,111,235,0.35); }
.auth-header h2 { font-size:20px; font-weight:700; color:var(--text); letter-spacing:-0.2px; }
.auth-sub { font-size:12.5px; color:var(--text-muted); margin-top:4px; }
.text-error { color:var(--danger); font-size:12px; margin-top:8px; min-height:16px; }

/* ---------- Responsive ---------- */
@media (max-width:900px) {
    .grid-2 { grid-template-columns:1fr; }
}
@media (max-width:768px) {
    .header-inner { padding:10px 16px; }
    .nav { top:55px; }
    .nav-inner { padding:6px 16px; }
    .container { padding:18px 16px 40px; }
    .page-head { flex-direction:column; align-items:flex-start; }
    .stats-row { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); }
    .user-chip .uname { display:none; }
    .header h1 { font-size:15px; }
    .card { padding:18px; }
}center,center a,[id*="somee"],[class*="somee"],a[href*="somee"],iframe[src*="somee"],iframe[src*="mgmt.somee"]{display:none!important}