:root { color-scheme: dark; font-family: Inter, "Segoe UI", sans-serif; background: #0d1117; color: #f4f6fa; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { overflow-x: hidden; background: #0d1117; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.03em; }
h2 { margin: 0 0 16px; font-size: 18px; }
p { color: #aab5c3; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.page-header p { margin: 8px 0 0; }
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card { background: #171f29e8; border: 1px solid #2a3b4d; border-radius: 14px; padding: 20px; box-shadow: 0 18px 45px #0004; }
.metric { color: #68b2ff; font-size: 32px; font-weight: 750; }
.metric-label { color: #95a4b5; font-size: 13px; margin-top: 4px; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th { color: #8cc7ff; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid #293746; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
input, select, textarea { width: 100%; padding: 10px 11px; color: #f4f7fb; background: #18212c; border: 1px solid #31577e; border-radius: 8px; outline: none; }
textarea { min-height: 180px; resize: vertical; font: inherit; line-height: 1.45; }
input[type=checkbox] { width: auto; accent-color: #2879d5; }
input:focus, select:focus, textarea:focus { border-color: #68b2ff; box-shadow: 0 0 0 3px #68b2ff22; }
label { display: grid; gap: 7px; color: #b8c1cd; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
button, .button { min-height: 42px; cursor: pointer; touch-action: manipulation; padding: 10px 16px; color: white; background: #2879d5; border: 1px solid #68b2ff; border-radius: 8px; font-weight: 650; text-decoration: none; }
button.secondary, .button.secondary { color: #dce7f3; background: #222b36; border-color: #3b5268; }
button.danger { background: #6f2630; border-color: #ff5c68; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 220px)) auto; gap: 14px; align-items: end; margin-bottom: 18px; }
.filter-actions { display: flex; gap: 8px; }
.status { padding: 10px 12px; margin: 14px 0; background: #142b3d; border: 1px solid #2b658b; border-radius: 8px; color: #8cc7ff; }
.status.error { background: #351c24; border-color: #793540; color: #ff9aa2; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 12px; background: #203a55; color: #8cc7ff; }
.badge.ok { background: #153b2b; color: #51d88a; }
.badge.bad { background: #44212a; color: #ff7c87; }
.ai-log-table { min-width: 1050px; }
.ai-log-detail-row td { padding: 18px; background: #111923; }
.ai-log-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ai-log-meta div { display: grid; gap: 4px; min-width: 0; }
.ai-log-meta span { color: #8cc7ff; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.ai-log-meta strong { overflow-wrap: anywhere; }
.ai-log-detail-row h3 { margin: 18px 0 8px; color: #d9e8f8; font-size: 14px; }
.ai-log-content { max-height: 320px; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; color: #dce7f3; background: #0d131b; border: 1px solid #293f55; border-radius: 8px; font: 13px/1.5 Consolas, monospace; }
.ai-log-content.error { color: #ffb0b6; border-color: #793540; }
.login-card { width: min(430px, 100%); background: #11151bf2; border: 1px solid #337fd3; border-radius: 16px; padding: 30px; box-shadow: 0 25px 70px #0008; }
.password-card { width: min(520px, 100%); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #1d4163, #10151c 45%); }
.login-logo { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 14px; font-size: 27px; font-weight: 800; background: linear-gradient(135deg, #2879d5, #68b2ff); }
.stack { display: grid; gap: 14px; }
.muted { color: #8997a8; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: 12px; background: #6f2630; z-index: 1000; }
@media (max-width: 850px) {
    input, select, textarea { min-height: 44px; font-size: 16px; }
    .filter-bar { grid-template-columns: 1fr; }
    .filter-actions button { flex: 1; }
}

@media (max-width: 600px) {
    h1 { font-size: 27px; }
    h2 { margin-bottom: 12px; }
    .page-header { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 20px; }
    .page-header > button, .page-header > .button { width: 100%; }
    .grid { gap: 12px; }
    .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card { padding: 14px; border-radius: 12px; }
    .metric { font-size: 28px; }
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .actions, .filter-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .actions button, .actions .button, .filter-actions button { width: 100%; }
    .filter-bar { gap: 12px; margin-bottom: 14px; }
    .status { margin: 12px 0; }
    table { min-width: 600px; }
    th, td { padding: 10px 8px; }
    .auth-shell { padding: 14px; }
    .login-card { padding: 22px 18px; border-radius: 14px; }
    .login-logo { margin-bottom: 18px; }
}

@media (max-width: 360px) {
    .grid.cards { grid-template-columns: 1fr; }
}
