:root {
    color-scheme: dark;
    --bg: #05070b;
    --panel: #0b0f16;
    --panel-2: #0f141d;
    --line: rgba(255,255,255,.08);
    --line-strong: rgba(255,255,255,.14);
    --text: #f4f7fb;
    --muted: #9aa6b8;
    --accent: #d9dde4;
    --accent-2: #7cc8ff;
    --danger: #ff7b8a;
    --success: #79e0b4;
    --shadow: 0 24px 80px rgba(0,0,0,.45);
    --radius: 22px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background:
        radial-gradient(circle at top, rgba(255,255,255,.05), transparent 28%),
        linear-gradient(180deg, #040507 0%, #06080d 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
a { color: inherit; text-decoration: none; }
.app-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 16px auto 28px;
}
.app-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px; border: 1px solid var(--line); border-radius: 26px;
    background: rgba(10, 12, 18, .92); box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.app-topbar h1 { margin: 4px 0 0; font-size: clamp(1.25rem, 2.1vw, 1.7rem); letter-spacing: .01em; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.chip {
    display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 999px;
    background: rgba(255,255,255,.04); border: 1px solid var(--line);
    color: #e9eef7; font-size: .92rem;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 14px; padding: 11px 14px;
    font-weight: 600; cursor: pointer; transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-ghost {
    background: rgba(255,255,255,.03); color: var(--text); border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.btn-primary {
    background: #f5f7fb; color: #06080b;
}
.btn-primary:hover { background: #ffffff; }
.btn-danger {
    background: rgba(255,123,138,.1); color: #ffdbe1; border-color: rgba(255,123,138,.18);
}
.btn-muted {
    background: rgba(255,255,255,.05); color: var(--text); border-color: var(--line);
}
.flash {
    margin-top: 16px; padding: 13px 16px; border-radius: 18px; border: 1px solid var(--line);
    background: rgba(255,255,255,.03); box-shadow: var(--shadow);
}
.flash-success { border-color: rgba(121,224,180,.22); background: rgba(121,224,180,.07); }
.flash-error { border-color: rgba(255,123,138,.22); background: rgba(255,123,138,.07); }
.flash-info { border-color: rgba(124,200,255,.22); background: rgba(124,200,255,.07); }
.app-main { margin-top: 16px; }
.tabs {
    display: flex; flex-wrap: wrap; gap: 10px;
    padding: 10px; border: 1px solid var(--line); border-radius: 22px;
    background: rgba(8, 10, 14, .92); box-shadow: var(--shadow);
}
.tab {
    padding: 11px 14px; border-radius: 14px; border: 1px solid transparent;
    background: transparent; color: var(--muted); cursor: pointer; font-weight: 600;
}
.tab.is-active {
    color: var(--text); background: rgba(255,255,255,.05); border-color: var(--line-strong);
}
.panes { margin-top: 16px; display: grid; gap: 16px; }
.pane { display: none; }
.pane.is-active { display: block; }
.grid {
    display: grid; gap: 16px;
}
.grid-2 { grid-template-columns: minmax(0, 1.45fr) minmax(0, .95fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
    border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12, 15, 22, .95);
    box-shadow: var(--shadow); padding: 20px; overflow: hidden;
}
.card.slim { padding: 16px 18px; }
.card h2, .card h3 { margin: 0 0 12px; }
.card p { color: #d8dee8; line-height: 1.6; }
.muted { color: var(--muted); }
.hstack { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.vstack { display: grid; gap: 12px; }
.stat {
    padding: 16px; border-radius: 18px; background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.stat strong { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.stat span { color: var(--muted); }
label { display: grid; gap: 6px; color: #dfe6f0; font-size: .95rem; }
input, select, textarea {
    width: 100%; border-radius: 14px; border: 1px solid var(--line);
    background: #080b10; color: var(--text); padding: 12px 13px;
    outline: none; font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(124,200,255,.45); box-shadow: 0 0 0 4px rgba(124,200,255,.10); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #c8d1de; font-size: .86rem; font-weight: 700; }
.subtle { color: var(--muted); font-size: .93rem; }
.pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px;
    border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: #e9eef7;
    font-size: .84rem;
}
.hidden { display: none !important; }
.overlay {
    position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,.72); backdrop-filter: blur(10px); z-index: 999;
}
.overlay.show { display: flex; }
.overlay-card {
    width: min(440px, calc(100% - 32px)); padding: 26px; border-radius: 24px;
    background: rgba(10, 12, 18, .98); border: 1px solid var(--line); box-shadow: var(--shadow);
    text-align: center;
}
.overlay-card-wide {
    width: min(760px, calc(100% - 32px));
    text-align: left;
}
.spinner {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
    border: 5px solid rgba(255,255,255,.12); border-top-color: #fff; animation: spin 1s linear infinite;
}
.plan-loader {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 22px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.03);
}
.plan-reveal-body {
    margin-top: 16px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line-strong);
    background: #05070b;
    color: #fff;
    white-space: pre-wrap;
    line-height: 1.7;
    max-height: min(56vh, 520px);
    overflow: auto;
}
.plan-reveal-meta { color: var(--muted); font-size: .92rem; margin-top: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.print-only { display: none; }
.print-page { display: none; }
@media (max-width: 1100px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    table { min-width: 560px; }
}
@media (max-width: 760px) {
    .app-shell { width: min(100% - 20px, 100%); }
    .app-topbar { flex-direction: column; align-items: flex-start; }
    .tabs { gap: 8px; }
    .tab { width: 100%; text-align: left; }
    table { min-width: 520px; }
}
@media print {
    body * { visibility: hidden !important; }
    .print-page, .print-page * { visibility: visible !important; }
    .print-page { display: block !important; position: absolute; inset: 0; background: #fff; color: #000; }
    .print-page * { color: #000 !important; }
}
