:root {
    --bg: #0b1220;
    --surface: #111827;
    --surface-2: #1f2937;
    --border: #334155;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #166534;
    --success-bg: #052e16;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --warn: #92400e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Tahoma, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
    color: var(--text);
    min-height: 100vh;
}

a { color: #93c5fd; text-decoration: none; }

.app-shell { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; }

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-kicker { margin: 0 0 .25rem; font-size: .75rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.app-header h1 { margin: 0; font-size: 1.35rem; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a {
    padding: .55rem 1rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: .875rem;
}
.tabs a.active { background: var(--primary); color: #fff; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: .9rem 1rem;
}
.stat-card strong { display: block; font-size: 1.35rem; margin-top: .25rem; }
.stat-card.ok { border-color: #166534; }
.stat-card.warn { border-color: #92400e; }

.layout-split {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 960px) {
    .layout-split { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr; }
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.panel-card-accent { border-color: #2563eb; box-shadow: 0 0 0 1px rgba(37,99,235,.25); }

.panel-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.panel-card-head h2 { margin: 0; font-size: 1rem; }
.panel-card-body { padding: 1rem 1.1rem 1.15rem; }

.chip {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: #1e3a8a;
    color: #dbeafe;
    font-size: .75rem;
    direction: ltr;
}

.alert {
    padding: .75rem .9rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: .875rem;
}
.alert-success { background: var(--success-bg); color: #bbf7d0; border: 1px solid var(--success); }
.alert-error { background: #450a0a; color: #fecaca; border: 1px solid var(--danger); }

.muted { color: var(--muted); font-size: .875rem; }
.subtle { color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.field-hint { color: var(--muted); font-size: .75rem; margin: .35rem 0 0; }

label { display: block; font-size: .8125rem; color: var(--muted); margin: .65rem 0 .3rem; }

.field-input,
input.field-input,
select.field-input,
textarea.field-input {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
}

textarea.field-input { min-height: 88px; resize: vertical; }
input[readonly].field-input { opacity: .85; }

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .25rem .75rem;
}
.field-span-2 { grid-column: span 2; }

@media (max-width: 640px) {
    .field-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
}

.form-stack { display: flex; flex-direction: column; gap: .15rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem .95rem;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: .875rem;
}
.btn:hover { background: var(--primary-hover); }
.btn-primary { background: var(--primary); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: .35rem .65rem; font-size: .75rem; }
.btn-block { width: 100%; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.data-table th, .data-table td { padding: .7rem .55rem; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; }
.data-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.data-table tr.row-active { background: rgba(37, 99, 235, .08); }
.data-table tr.row-note td { color: var(--muted); font-size: .75rem; padding-top: 0; border-bottom: 1px solid #1e293b; }
.mono { font-family: Consolas, monospace; font-size: .78rem; }

.badge {
    display: inline-block;
    padding: .18rem .5rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 600;
}
.badge-ok { background: #14532d; color: #bbf7d0; }
.badge-bad { background: #450a0a; color: #fecaca; }
.badge-warn { background: #78350f; color: #fde68a; }
.panel-card.mb-4 { margin-bottom: 1rem; }

.actions { white-space: nowrap; }
.inline-form { display: inline; margin-right: .35rem; }

.info-strip {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: .85rem 1rem;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}
.info-strip strong { display: block; margin-top: .2rem; }

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}
.login-card h1 { margin: 0 0 1rem; font-size: 1.15rem; }
