:root {
    color-scheme: dark;
    --bg: #06111f;
    --card: rgba(15, 23, 42, .82);
    --card-2: rgba(15, 23, 42, .58);
    --border: rgba(148, 163, 184, .18);
    --text: #e5edf8;
    --muted: #93a4b8;
    --cyan: #22d3ee;
    --blue: #3b82f6;
    --danger: #fb7185;
    --success: #34d399;
    --shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(34, 211, 238, .18), transparent 30%), var(--bg);
    color: var(--text);
}
a { color: inherit; }
.bg-glow {
    position: fixed;
    inset: auto -120px -180px auto;
    width: 420px;
    height: 420px;
    background: rgba(59, 130, 246, .18);
    filter: blur(90px);
    pointer-events: none;
}
.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 60px;
}
.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.eyebrow {
    display: inline-flex;
    padding: 7px 12px;
    border: 1px solid rgba(34, 211, 238, .32);
    border-radius: 999px;
    color: var(--cyan);
    background: rgba(34, 211, 238, .08);
    font-size: 13px;
    font-weight: 700;
}
h1 { margin: 14px 0 8px; font-size: clamp(32px, 6vw, 58px); line-height: .95; letter-spacing: -0.045em; }
h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -.025em; }
p { margin: 0; color: var(--muted); line-height: 1.65; }
.card {
    position: relative;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(15, 23, 42, .92), rgba(15, 23, 42, .72));
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.login-card { width: min(520px, 100%); margin: 20px auto; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: #cbd5e1; font-weight: 700; font-size: 14px; }
input, textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .18);
    background: rgba(2, 6, 23, .45);
    color: var(--text);
    border-radius: 16px;
    padding: 13px 14px;
    outline: none;
    font: inherit;
}
input:focus, textarea:focus { border-color: rgba(34, 211, 238, .56); box-shadow: 0 0 0 4px rgba(34, 211, 238, .08); }
textarea { resize: vertical; }
.checkline { display: flex; align-items: center; gap: 10px; }
.checkline input { width: auto; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 16px;
    padding: 12px 16px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #031625; background: linear-gradient(135deg, var(--cyan), #60a5fa); }
.btn-secondary { color: #dbeafe; background: rgba(59, 130, 246, .18); border: 1px solid rgba(96, 165, 250, .25); }
.btn-ghost { color: #dbeafe; background: rgba(148, 163, 184, .1); border: 1px solid rgba(148, 163, 184, .18); }
.btn-danger { color: #ffe4e6; background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .24); }
.alert {
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    background: rgba(148, 163, 184, .1);
}
.alert-success { border-color: rgba(52, 211, 153, .26); color: #bbf7d0; }
.alert-error { border-color: rgba(251, 113, 133, .32); color: #fecdd3; }
.muted { color: var(--muted); }
.small { color: var(--muted); font-size: 13px; }
.mt-12 { margin-top: 12px; }
.hero-card { overflow: hidden; min-height: 260px; }
.status-dot {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 28px rgba(52, 211, 153, .8);
    margin-bottom: 22px;
}
.hero-actions, .row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 12px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 20px;
}
.plate-list { display: grid; gap: 12px; }
.plate-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, .14);
    background: rgba(2, 6, 23, .24);
    border-radius: 22px;
    padding: 16px;
}
.plate-text { font-size: 24px; letter-spacing: .02em; }
.plate-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.empty {
    border: 1px dashed rgba(148, 163, 184, .24);
    border-radius: 20px;
    padding: 26px;
    color: var(--muted);
    text-align: center;
}
.codeblock {
    display: block;
    margin-top: 12px;
    padding: 14px;
    overflow-x: auto;
    border-radius: 16px;
    background: rgba(2, 6, 23, .5);
    border: 1px solid rgba(148, 163, 184, .16);
    color: #bfdbfe;
    line-height: 1.55;
}
code { color: #bfdbfe; }
@media (max-width: 860px) {
    .two { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; }
    .plate-card { grid-template-columns: 1fr; }
    .plate-actions { justify-content: flex-start; }
    .section-head { flex-direction: column; }
    .btn { width: 100%; }
}

body.modal-open { overflow: hidden; }
.kgm-modal[hidden] { display: none; }
.kgm-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: center;
    padding: 18px;
}
.kgm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .76);
    backdrop-filter: blur(8px);
}
.kgm-dialog {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    height: min(840px, calc(100vh - 36px));
    border: 1px solid rgba(148, 163, 184, .22);
    background: #0f172a;
    border-radius: 26px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, .55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.kgm-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    background: rgba(15, 23, 42, .96);
}
.kgm-dialog-head strong { display: block; margin-bottom: 4px; }
.kgm-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.iframe-warning {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
    background: rgba(34, 211, 238, .08);
    color: #cffafe;
    font-size: 13px;
    line-height: 1.45;
}
.kgm-frame {
    width: 100%;
    flex: 1;
    border: 0;
    background: white;
}
@media (max-width: 860px) {
    .kgm-dialog { height: calc(100vh - 18px); border-radius: 20px; }
    .kgm-dialog-head { flex-direction: column; }
    .kgm-dialog-actions { width: 100%; }
}
