:root {
    --ink: #14213d;
    --muted: #6f7d95;
    --line: #e6ebf2;
    --surface: #ffffff;
    --canvas: #f5f7fb;
    --blue: #2563eb;
    --green: #16a36a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand-block { height: 104px; padding: 30px 28px 20px; position: relative; border-bottom: 1px solid var(--line); }
.brand { font-size: 23px; font-weight: 750; letter-spacing: -.6px; }
.brand-caption { display: block; margin-top: 4px; font-size: 10px; letter-spacing: 2px; font-weight: 700; color: var(--blue); }
.navbar-toggler { display: none; }
.nav-scrollable { padding: 22px 14px; }
.nav-scrollable.collapse { display: block; }
.nav-list { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 13px; padding: 12px 14px; color: var(--muted); border-radius: 9px; font-size: 14px; font-weight: 600; }
.nav-link.active { color: var(--blue); background: #eef4ff; }
.nav-icon { width: 20px; text-align: center; font-size: 20px; line-height: 1; }
.sidebar-footer { margin-top: auto; padding: 20px 28px 26px; color: #9aa6b9; font-size: 11px; line-height: 1.65; }
.sidebar-footer span { color: #c0c8d5; }

.main-content { min-width: 0; flex: 1; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 54px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-title { font-size: 14px; font-weight: 700; }
.topbar-subtitle { color: var(--muted); font-size: 12px; margin-top: 3px; }
.server-status, .security-badge { display: inline-flex; align-items: center; gap: 9px; color: var(--green); font-size: 12px; font-weight: 650; }
.server-status { padding: 10px 15px; border: 1px solid #d8f0e4; border-radius: 99px; background: #f3fcf7; }
.topbar-actions { display: inline-flex; align-items: center; gap: 12px; }
.logout-action { padding: 9px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 650; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.content { max-width: 1280px; margin: 0 auto; padding: 48px 54px 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.compact-heading { align-items: center; }
.page-heading-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 750; letter-spacing: 1.7px; margin-bottom: 11px; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -1.5px; line-height: 1.05; }
/* Blazor переводит фокус на заголовок при навигации для экранных читалок.
   У заголовка это не должно выглядеть как ошибка или поле ввода. */
.page-heading h1:focus { outline: none; }
.page-heading p { color: var(--muted); margin: 13px 0 0; max-width: 590px; line-height: 1.55; font-size: 15px; }
.developer-note { text-align: right; color: var(--muted); font-size: 11px; line-height: 1.55; }
.developer-note strong { color: var(--ink); font-size: 12px; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric-card, .welcome-card, .empty-state-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(20, 33, 61, .035); }
.metric-card { padding: 22px 24px; min-height: 143px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-value { margin-top: 14px; font-size: 32px; font-weight: 760; letter-spacing: -1px; }
.metric-accent { color: var(--blue); }
.metric-ok { color: var(--green); font-size: 22px; margin-top: 21px; }
.metric-hint { margin-top: 5px; color: #a0aabd; font-size: 11px; }
.welcome-card { display: flex; align-items: flex-start; gap: 20px; padding: 30px; }
.welcome-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 43px; border-radius: 12px; color: #fff; background: var(--blue); font-size: 23px; font-weight: 700; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.welcome-card p, .empty-state-card p { color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 720px; margin: 10px 0 20px; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; gap: 13px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.primary-action { padding: 11px 16px; color: #fff; background: var(--blue); }
.primary-action span { font-size: 17px; line-height: 0; }
.secondary-action { padding: 10px 17px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.secondary-action:disabled { opacity: .55; cursor: default; }
.empty-state-card { padding: 58px 28px; text-align: center; }
.empty-state-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 14px; color: var(--blue); background: #eef4ff; font-size: 24px; }
.empty-state-card p { margin: 11px auto 22px; max-width: 620px; }
.security-badge { padding: 9px 13px; border-radius: 99px; background: #f3fcf7; }
.auth-layout { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.auth-card { width: min(430px, 100%); padding: 38px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 15px 45px rgba(20, 33, 61, .08); }
.auth-card h1 { font-size: 32px; }
.auth-intro { color: var(--muted); line-height: 1.55; font-size: 14px; margin: 13px 0 27px; }
.form-field { display: grid; gap: 8px; margin-bottom: 17px; }
.form-field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.form-field input { width: 100%; padding: 11px 12px; border: 1px solid #ccd5e3; border-radius: 7px; color: var(--ink); background: #fff; outline: none; }
.form-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.auth-submit { border: 0; margin-top: 7px; }
.form-error { color: #b42318; background: #fff1f0; border: 1px solid #ffd8d4; border-radius: 7px; padding: 10px 11px; font-size: 12px; margin: 5px 0 14px; }
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(20, 33, 61, .035); overflow: hidden; }
.table-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.table-card-heading span { color: var(--muted); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1020px; }
th, td { padding: 15px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 12px; }
th { color: var(--muted); background: #f8fafe; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
tbody tr:last-child td { border-bottom: 0; }
.license-key { color: var(--blue); font-weight: 700; }
.status-pill { display: inline-flex; padding: 6px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.status-success { color: #087443; background: #eaf8f0; }
.status-danger { color: #b42318; background: #fff0ef; }
.comment-input { width: 180px; padding: 7px 8px; border: 1px solid #d5ddea; border-radius: 6px; font-size: 12px; }
.row-actions { display: inline-flex; align-items: center; gap: 7px; }
.row-action { border: 0; border-radius: 6px; padding: 7px 9px; color: var(--blue); background: #eef4ff; cursor: pointer; font-size: 11px; font-weight: 700; }
.row-action-danger { color: #b42318; background: #fff0ef; }
.row-action:disabled, .danger-action:disabled, .inline-action:disabled { opacity: .55; cursor: default; }
.operation-message { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -12px 0 22px; padding: 12px 15px; color: #087443; background: #eaf8f0; border: 1px solid #d2f0df; border-radius: 9px; font-size: 12px; }
.operation-message code { padding: 5px 8px; color: var(--ink); background: rgba(255, 255, 255, .75); border: 1px solid #c8e8d5; border-radius: 5px; font-family: Consolas, monospace; font-size: 12px; }
.inline-action { border: 0; padding: 5px 8px; color: #087443; background: transparent; text-decoration: underline; cursor: pointer; font-size: 12px; font-weight: 700; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(20, 33, 61, .42); }
.modal-card { width: min(460px, 100%); padding: 27px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 20px 70px rgba(20, 33, 61, .24); }
.modal-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-card-heading .eyebrow { margin-bottom: 8px; }
.modal-close { border: 0; padding: 0 2px; color: var(--muted); background: transparent; cursor: pointer; font-size: 28px; line-height: .8; }
.modal-description { margin: 12px 0 23px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.modal-description strong { color: var(--ink); font-family: Consolas, monospace; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.danger-action { display: inline-flex; align-items: center; border: 1px solid #ffd8d4; border-radius: 8px; padding: 10px 17px; color: #b42318; background: #fff0ef; cursor: pointer; font-size: 13px; font-weight: 700; }
.eyebrow-danger { color: #b42318; }
.loading-indicator { color: var(--muted); font-size: 14px; }
.error-state h2 { color: #b42318; }

#blazor-error-ui { background: #fff4d6; bottom: 0; box-shadow: 0 -1px 4px rgba(20, 33, 61, .15); display: none; left: 0; padding: .8rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid red; }
.validation-message { color: red; }

@media (max-width: 800px) {
    .app-shell { display: block; }
    .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand-block { height: 74px; padding: 19px 20px 14px; }
    .navbar-toggler { display: block; position: absolute; right: 18px; top: 19px; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
    .nav-scrollable { padding: 8px 12px 14px; }
    .nav-scrollable.collapse { display: none; }
    .sidebar-footer { display: none; }
    .topbar { min-height: 65px; padding: 0 20px; }
    .server-status { padding: 8px 10px; font-size: 11px; }
    .content { padding: 32px 20px 50px; }
    .page-heading { display: block; }
    .page-heading-actions { margin-top: 20px; }
    .developer-note { text-align: left; margin-top: 20px; }
    .metrics-grid { grid-template-columns: 1fr; }
}
