:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #182230;
    --muted: #667085;
    --border: #e4e7ec;
    --primary: #5b36d6;
    --primary-dark: #4324b8;
    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --success: #027a48;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --shadow: 0 12px 35px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Tahoma, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 58px;
    padding: 7px clamp(16px, 3vw, 42px);
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
    align-items: center;
    gap: 20px;
    background: #071426;
    color: white;
    box-shadow: 0 6px 20px rgba(7, 20, 38, .20);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.18));
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .1px; }
.brand small { opacity: .72; font-size: 10px; }
.topbar nav { display: flex; gap: 8px; }
.topbar nav a { padding: 9px 14px; border-radius: 9px; color: #d0d5dd; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: white; }
.logout-form { justify-self: end; display: flex; align-items: center; gap: 12px; }
.user-name { color: #d0d5dd; font-size: 13px; }

.page-shell { width: min(1500px, calc(100% - 36px)); margin: 28px auto 70px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; margin-top: 0; margin-bottom: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 22px; }
.page-heading h1 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 34px); }
.page-heading p { margin: 0; color: var(--muted); }
.heading-with-badge { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.heading-with-badge h1 { margin: 0; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.narrow-panel { max-width: 650px; margin: 80px auto; text-align: center; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; font-size: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card, .info-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 19px;
    box-shadow: var(--shadow);
}
.stat-card span, .info-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-card strong { font-size: 30px; }
.stat-card.warning { border-right: 4px solid #f79009; }
.stat-card.danger { border-right: 4px solid var(--danger); }
.info-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.info-card strong { display: block; overflow-wrap: anywhere; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 700; background: #f9fafb; }
tbody tr:hover { background: #fcfcfd; }
td small { display: block; color: var(--muted); margin-top: 2px; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    transition: .15s ease;
    white-space: nowrap;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: white; color: #344054; border-color: #d0d5dd; }
.button-secondary:hover { background: #f9fafb; }
.button-ghost { color: inherit; border-color: rgba(255,255,255,.18); background: transparent; }
.page-shell .button-ghost { color: #344054; border-color: #d0d5dd; }
.button-danger { background: var(--danger); color: white; }
.button-success { background: var(--success); color: white; }
.button-warning { background: #f79009; color: white; }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button-block { width: 100%; }
.action-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.small-actions { min-width: 205px; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-success { color: var(--success); background: var(--success-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.badge-muted { color: #475467; background: #f2f4f7; }

.alert { border-radius: 12px; padding: 13px 16px; margin-bottom: 18px; font-weight: 700; }
.alert-success { color: var(--success); background: var(--success-soft); border: 1px solid #abefc6; }
.alert-danger { color: var(--danger); background: var(--danger-soft); border: 1px solid #fecdca; }
.muted, .help-text { color: var(--muted); }
.text-link { color: var(--primary); font-weight: 700; }
.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; }

.login-card {
    width: min(440px, 100%);
    padding: 34px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 28px 70px rgba(16, 24, 40, .14);
}
.login-brand-logo {
    display: block;
    width: min(300px, 88%);
    height: auto;
    margin: 0 auto 14px;
}

.login-card h1, .login-card > p { text-align: center; }
.login-card h1 { margin: 0 0 7px; font-size: 24px; }

.stack-form { display: grid; gap: 10px; margin-top: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid > div, .compact-form label { display: grid; gap: 7px; }
.full-row { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 800; color: #344054; }
input, textarea, select {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: white;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #a99cf3; box-shadow: 0 0 0 3px #f1effd; }
textarea { resize: vertical; }
.check-row { display: flex !important; align-items: center; gap: 9px; margin: 6px 0; }
.check-row input { width: auto; }
.field-error, .validation-summary { color: var(--danger); font-size: 12px; }
.validation-summary ul { margin: 0; padding-right: 18px; }
.form-actions { display: flex !important; align-items: center; gap: 10px; margin-top: 4px; }
.centered { justify-content: center; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.search-bar { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; gap: 10px; margin-bottom: 18px; }

.event-list { display: grid; }
.event-item { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: 0; }
.event-item strong { font-size: 13px; }
.event-item p { margin: 3px 0; color: #475467; }
.event-item small, .event-item time { color: var(--muted); font-size: 11px; }
.event-item time { white-space: nowrap; }

.renew-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.danger-zone { border-color: #fecdca; background: #fffafa; }
.key-panel { max-width: 860px; margin-inline: auto; text-align: center; }
.success-icon { width: 68px; height: 68px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 34px; font-weight: 900; }
.warning-text { color: var(--warning); font-weight: 700; }
.license-key-box { display: flex; align-items: center; gap: 12px; margin: 24px 0; padding: 15px; border: 1px dashed #a99cf3; border-radius: 13px; background: #f7f5ff; direction: ltr; }
.license-key-box code { flex: 1; font-family: Consolas, monospace; font-size: clamp(15px, 2vw, 21px); font-weight: 800; overflow-wrap: anywhere; }
.summary-list { display: grid; grid-template-columns: repeat(2, 1fr); text-align: right; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 22px 0; }
.summary-list div { padding: 12px 15px; border-bottom: 1px solid var(--border); }
.summary-list dt { color: var(--muted); font-size: 12px; }
.summary-list dd { margin: 3px 0 0; font-weight: 800; }

@media (max-width: 1150px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .info-grid { grid-template-columns: repeat(3, 1fr); }
    .topbar { grid-template-columns: 1fr auto; }
    .topbar nav { order: 3; grid-column: 1 / -1; justify-content: center; }
    .compact-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
    .two-column, .form-grid { grid-template-columns: 1fr; }
    .full-row { grid-column: auto; }
    .stats-grid, .info-grid { grid-template-columns: repeat(2, 1fr); }
    .page-heading { flex-direction: column; }
    .renew-grid { grid-template-columns: repeat(2, 1fr); }
    .search-bar { grid-template-columns: 1fr; }
    .topbar { display: flex; flex-wrap: wrap; }
    .logout-form { margin-right: auto; }
}
@media (max-width: 520px) {
    .page-shell { width: min(100% - 20px, 1500px); margin-top: 16px; }
    .panel { padding: 16px; border-radius: 13px; }
    .stats-grid, .info-grid, .summary-list { grid-template-columns: 1fr; }
    .compact-form { grid-template-columns: 1fr; }
    .license-key-box { flex-direction: column; }
    .login-card { padding: 24px 18px; }
    .topbar { padding: 12px; }
    .brand { width: 100%; }
}

/* Stage 1.2: deferred renewal, edition selector, and system checkboxes. */
.panel-subtitle { margin: 5px 0 0; }
.compact-empty { padding: 10px 0; }
.info-card small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; }
.settings-form { display: grid; gap: 22px; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.settings-grid label { display: grid; gap: 7px; }
.settings-section {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.form-grid > .system-selector {
    display: grid;
    gap: 15px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fcfcfd;
}
.settings-section h3,
.created-systems h3 { margin: 0 0 4px; font-size: 16px; }
.selector-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.selector-heading > div:first-child { display: grid; gap: 4px; }
.choice-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 64px;
    padding: 12px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.choice-card:hover { border-color: #a99cf3; background: #fbfaff; }
.choice-card:has(input:checked) {
    border-color: #a99cf3;
    background: #f7f5ff;
    box-shadow: 0 0 0 2px #f1effd;
}
.choice-card input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}
.choice-card span { min-width: 0; }
.choice-card strong,
.choice-card small { display: block; }
.choice-card strong { color: #344054; font-size: 13px; }
.choice-card small {
    color: var(--muted);
    margin-top: 3px;
    font-size: 11px;
    direction: ltr;
    text-align: right;
}
.system-choice-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.renew-choice-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}
.renewal-choice { min-height: 72px; }
.selection-status {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #344054;
    background: #f2f4f7;
    font-size: 12px;
    font-weight: 700;
}
.selection-status-active {
    color: var(--success);
    border-color: #abefc6;
    background: var(--success-soft);
}
.settings-save-bar {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid #b2ccff;
    border-radius: 13px;
    background: rgba(245, 248, 255, .97);
    box-shadow: 0 12px 30px rgba(16, 24, 40, .10);
    backdrop-filter: blur(8px);
}
.settings-save-bar strong,
.settings-save-bar small { display: block; }
.settings-save-bar small { color: var(--muted); margin-top: 3px; }
.feature-badges { display: flex; flex-wrap: wrap; gap: 9px; }
.feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid #b2ccff;
    border-radius: 999px;
    color: #1849a9;
    background: #f7f5ff;
}
.feature-badge strong { font-size: 12px; }
.feature-badge small {
    color: #6172f3;
    font-family: Consolas, monospace;
    font-size: 10px;
    direction: ltr;
}
.centered-badges { justify-content: center; }
.created-systems { margin: 6px 0 24px; }
.systems-summary-panel { padding-top: 18px; padding-bottom: 18px; }
button:disabled,
input[type="submit"]:disabled { cursor: wait; opacity: .68; transform: none; }

@media (max-width: 1250px) {
    .settings-grid,
    .system-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .renew-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .settings-grid,
    .system-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .selector-heading,
    .settings-save-bar { align-items: stretch; flex-direction: column; }
    .settings-save-bar { position: static; }
    .settings-save-bar .button { width: 100%; }
}
@media (max-width: 520px) {
    .settings-grid,
    .system-choice-grid,
    .renew-choice-grid { grid-template-columns: 1fr; }
    .selector-heading .action-row { width: 100%; }
    .selector-heading .action-row .button { flex: 1; }
}

/* Stage 2A2 - compact, responsive admin layout */
:root {
    --topbar-h: 54px;
    --radius: 11px;
    --compact-shadow: 0 5px 18px rgba(16, 24, 40, .055);
}

body { font-size: 13px; line-height: 1.42; }

.topbar {
    min-height: var(--topbar-h);
    padding: 6px clamp(12px, 2vw, 28px);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .16);
}
.brand { gap: 8px; flex: 0 0 auto; }
.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
}
.brand strong { font-size: 13px; line-height: 1.15; }
.brand small { font-size: 10px; margin-top: 2px; }
.topbar nav {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1 1 auto;
    min-width: 0;
}
.topbar nav a {
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.topbar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.logout-form { margin-inline-start: auto; justify-self: auto; gap: 7px; flex: 0 0 auto; }
.user-name { font-size: 11px; }
.topbar .button { min-height: 30px; padding: 5px 10px; font-size: 11px; }

.page-shell {
    width: min(1440px, calc(100% - 24px));
    margin: 14px auto 34px;
}
.login-shell { margin: 0 auto; min-height: calc(100vh - 1px); }
.page-heading {
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.page-heading h1 { margin: 0 0 2px; font-size: clamp(19px, 2vw, 25px); line-height: 1.2; }
.page-heading p { font-size: 11px; }
.heading-with-badge { gap: 8px; }

.panel {
    border-radius: var(--radius);
    padding: 13px;
    box-shadow: var(--compact-shadow);
    margin-bottom: 12px;
}
.panel-heading { gap: 10px; margin-bottom: 10px; }
.panel-heading h2 { font-size: 15px; }
.panel-subtitle { font-size: 11px; }
.narrow-panel { max-width: 610px; margin: 42px auto; }

.stats-grid {
    grid-template-columns: repeat(5, minmax(115px, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}
.stat-card, .info-card {
    border-radius: var(--radius);
    padding: 11px 12px;
    box-shadow: var(--compact-shadow);
    min-width: 0;
}
.stat-card span, .info-card span { font-size: 11px; margin-bottom: 4px; }
.stat-card strong { font-size: 22px; line-height: 1.1; }
.info-card strong { font-size: 12px; line-height: 1.35; }
.info-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}
.two-column { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.button {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 7px;
    font-size: 11.5px;
    gap: 5px;
}
.button-small { min-height: 27px; padding: 4px 8px; font-size: 10.5px; }
.action-row { gap: 6px; }
.small-actions { min-width: 0; }
.badge { padding: 3px 8px; font-size: 10.5px; }
.alert { border-radius: 9px; padding: 9px 12px; margin-bottom: 11px; font-size: 12px; }
.empty-state { padding: 18px 8px; }

.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
table { min-width: 0; width: 100%; font-size: 11.5px; }
th, td { padding: 7px 7px; line-height: 1.3; overflow-wrap: anywhere; }
th { font-size: 10.5px; white-space: nowrap; }
td small { font-size: 9.5px; margin-top: 2px; line-height: 1.25; }
td .button { white-space: nowrap; }
.cell-compact { max-width: 220px; }
.cell-mono {
    font-family: Consolas, monospace;
    direction: ltr;
    unicode-bidi: plaintext;
    font-size: 9.5px;
}
.text-ellipsis {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

input, textarea, select {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 12px;
}
textarea { min-height: 76px; }
label { font-size: 11.5px; }
.stack-form { gap: 7px; margin-top: 16px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid > div, .compact-form label { gap: 4px; }
.form-actions { gap: 7px; }
.search-bar { grid-template-columns: minmax(220px, 1fr) auto auto; gap: 7px; margin-bottom: 10px; }
.compact-form { gap: 8px; }

.settings-form { gap: 12px; }
.settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 9px;
}
.settings-grid label { gap: 4px; }
.settings-section { padding-top: 12px; }
.settings-section h3, .created-systems h3 { font-size: 13px; }
.selector-heading { gap: 9px; margin-bottom: 8px; }
.form-grid > .system-selector { gap: 9px; padding: 10px; border-radius: 9px; }
.system-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 7px;
}
.renew-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 7px;
}
.choice-card {
    min-height: 46px;
    padding: 7px 9px;
    border-radius: 8px;
    gap: 7px;
}
.choice-card input { width: 15px; height: 15px; }
.choice-card strong { font-size: 11px; }
.choice-card small { font-size: 9px; margin-top: 1px; }
.renewal-choice { min-height: 50px; }
.selection-status { margin: 7px 0 0; padding: 7px 9px; border-radius: 7px; font-size: 10.5px; }
.settings-save-bar {
    position: static;
    padding: 9px 11px;
    border-radius: 9px;
    gap: 10px;
    box-shadow: none;
}
.settings-save-bar strong { font-size: 11.5px; }
.settings-save-bar small { font-size: 9.5px; }

.event-item { gap: 10px; padding: 8px 0; }
.event-item strong { font-size: 11px; }
.event-item p { margin: 2px 0; font-size: 10.5px; }
.event-item small, .event-item time { font-size: 9px; }

.login-card {
    width: min(400px, 100%);
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .12);
}
.login-logo { width: 46px; height: 46px; margin-bottom: 12px; font-size: 22px; border-radius: 11px; }
.login-card h1 { font-size: 20px; }

.security-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}
.security-note {
    padding: 10px 12px;
    border: 1px solid #b2ccff;
    border-radius: 9px;
    background: #f7f5ff;
    color: #1849a9;
    font-size: 11px;
}
.current-session { background: #f6fef9; }

@media (min-width: 981px) {
    .table-wrap { overflow-x: visible; }
    table { table-layout: auto; }
    .device-table th:nth-child(1), .device-table td:nth-child(1) { width: 16%; }
    .device-table th:nth-child(2), .device-table td:nth-child(2) { width: 14%; }
    .device-table th:nth-child(3), .device-table td:nth-child(3) { width: 8%; }
    .device-table th:nth-child(4), .device-table td:nth-child(4) { width: 12%; }
    .device-table th:nth-child(5), .device-table td:nth-child(5) { width: 13%; }
    .device-table th:nth-child(6), .device-table td:nth-child(6) { width: 12%; }
    .device-table th:nth-child(7), .device-table td:nth-child(7) { width: 25%; }
}

@media (max-width: 1100px) {
    .brand small { display: none; }
    .topbar { gap: 9px; }
    .topbar nav a { padding-inline: 8px; }
    .user-name { display: none; }
    .stats-grid { grid-template-columns: repeat(3, minmax(110px, 1fr)); }
    .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .topbar { position: static; flex-wrap: wrap; padding: 7px 10px; }
    .brand { flex: 1 1 auto; }
    .topbar nav { order: 3; flex: 1 0 100%; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
    .logout-form { margin-inline-start: 0; }
    .page-shell { width: min(100% - 16px, 1440px); margin-top: 9px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading .action-row { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .full-row { grid-column: auto; }
    .security-summary { grid-template-columns: 1fr; }
    .table-wrap { overflow-x: auto; }
    table { min-width: 680px; }
    .settings-save-bar { align-items: stretch; flex-direction: column; }
    .settings-save-bar .button { width: 100%; }
}

@media (max-width: 520px) {
    .stats-grid, .info-grid { grid-template-columns: 1fr 1fr; }
    .panel { padding: 10px; }
    .login-card { padding: 20px 14px; }
    .system-choice-grid, .renew-choice-grid, .settings-grid { grid-template-columns: 1fr; }
}
