:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-soft: #f1f5f9;
    --border: #d9e2ec;
    --text: #111827;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    background: #0f172a;
    color: #ffffff;
    padding: 22px 18px;
}

.brand-mark,
.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-symbol {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    font-weight: 700;
}

.brand-mark small {
    display: block;
    color: #cbd5e1;
}

.nav-list {
    display: grid;
    gap: 6px;
    margin-top: 28px;
}

.nav-list a {
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 8px;
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.admin-main {
    padding: 28px;
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.admin-topbar h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar-actions,
.form-actions,
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-small {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
}

.notice-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #7f1d1d;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 16px;
}

.stat-card span,
.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin: 6px 0;
    font-size: 28px;
}

.panel {
    padding: 16px;
    margin-bottom: 18px;
}

.panel-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.panel-header,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel h2,
.section-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #eff6ff;
    color: #1f2937;
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    display: block;
    color: var(--muted);
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.status-active {
    background: #dcfce7;
    color: var(--success);
}

.status-suspended,
.status-archived {
    background: #fee2e2;
    color: var(--danger);
}

.status-draft {
    background: #fef3c7;
    color: var(--warning);
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 11px;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.toolbar input {
    max-width: 520px;
}

.form-panel {
    max-width: 980px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: #334155;
    font-weight: 700;
}

.span-2 {
    grid-column: span 2;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.form-actions {
    justify-content: flex-end;
    margin-top: 18px;
}

.meta-list {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
}

.meta-list div {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 12px;
}

.meta-list dt {
    color: var(--muted);
    font-weight: 700;
}

.meta-list dd {
    margin: 0;
}

.colour-chip {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--chip);
    vertical-align: -2px;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .admin-main {
        padding: 18px;
    }

    .stat-grid,
    .panel-grid,
    .detail-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}

/* Editra v0.2 secure administration */
.nav-list .nav-active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.user-menu > span {
    display: grid;
    line-height: 1.25;
}

.user-menu small,
.muted {
    color: var(--muted);
}

.button-danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
}

.button-block {
    width: 100%;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f1f5f9;
}

.auth-shell {
    width: min(100%, 460px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    margin: 0 auto 18px;
    color: var(--text);
}

.auth-brand:hover {
    text-decoration: none;
}

.auth-brand span:last-child {
    display: grid;
}

.auth-brand small {
    color: var(--muted);
}

.auth-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.auth-title {
    margin: 0 0 8px;
    font-size: 28px;
}

.auth-copy {
    margin: 0 0 18px;
    color: var(--muted);
}

.auth-form,
.stack-form {
    display: grid;
    gap: 14px;
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.check-row input {
    width: auto;
}

.auth-links {
    margin: 16px 0 0;
    text-align: center;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
}

.auth-divider {
    position: relative;
    text-align: center;
    color: var(--muted);
}

.auth-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
}

.auth-divider span {
    position: relative;
    padding: 0 10px;
    background: var(--surface);
}

.secret-box {
    display: grid;
    gap: 6px;
    margin: 16px 0;
    padding: 14px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
}

.secret-box code {
    font-size: 16px;
    letter-spacing: 0.08em;
    word-break: break-all;
}

.uri-details {
    margin-bottom: 18px;
}

.code-wrap {
    display: block;
    margin-top: 8px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    word-break: break-all;
    white-space: normal;
}

.recovery-panel {
    border-color: #86efac;
    background: #f0fdf4;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: 520px;
}

.recovery-grid code {
    padding: 8px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    background: #ffffff;
    font-size: 15px;
}

.setup-steps {
    padding-left: 20px;
}

.compact-form {
    margin-top: 16px;
}

.danger-panel {
    border-color: #fecaca;
}

.form-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.assignment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.assignment-grid label small {
    color: var(--muted);
    font-weight: 400;
}

.inline-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.audit-json {
    max-width: 520px;
    max-height: 260px;
    overflow: auto;
    padding: 10px;
    border-radius: 6px;
    background: #0f172a;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 900px) {
    .admin-topbar,
    .user-menu {
        align-items: flex-start;
    }

    .user-menu {
        border-left: 0;
        padding-left: 0;
    }

    .assignment-grid,
    .recovery-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }
}

/* v0.2 role/permission matrix */
.role-permission-stack {
    display: grid;
    gap: 1rem;
}

.role-permission-card {
    border: 1px solid var(--admin-border, #dbe2ea);
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
}

.role-permission-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.role-permission-header h3,
.permission-module legend {
    margin: 0;
}

.permission-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .85rem;
}

.permission-module {
    border: 1px solid var(--admin-border, #dbe2ea);
    border-radius: 10px;
    padding: .8rem;
    min-width: 0;
}

.permission-module legend {
    padding: 0 .35rem;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin: .55rem 0;
}

.checkbox-row input {
    margin-top: .2rem;
}

.checkbox-row span {
    display: grid;
    gap: .1rem;
}

.checkbox-row small {
    color: var(--admin-muted, #667085);
    overflow-wrap: anywhere;
}

.notice-soft {
    margin-top: 1rem;
}

@media (max-width: 720px) {
    .role-permission-header {
        align-items: stretch;
        flex-direction: column;
    }
}

/* --------------------------------------------------------------------------
   Editra v0.2.1 — professional administration and settings experience
   -------------------------------------------------------------------------- */
:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-muted: #eef2f7;
    --border: #dfe5ec;
    --border-strong: #cbd5e1;
    --text: #172033;
    --muted: #6b778c;
    --primary: #315efb;
    --primary-dark: #2446c7;
    --primary-soft: #eef3ff;
    --success: #157347;
    --success-soft: #ecf8f1;
    --danger: #c73737;
    --danger-soft: #fff0f0;
    --warning: #a96800;
    --warning-soft: #fff8e6;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 12px rgba(16, 24, 40, 0.035);
    --sidebar: #111827;
    --sidebar-soft: #1b2433;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
}

.admin-shell {
    grid-template-columns: 252px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 14px 16px;
    background: linear-gradient(180deg, #101827 0%, #121c2d 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 6px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    min-width: 0;
}

.brand-mark strong {
    display: block;
    font-size: 15px;
    letter-spacing: 0.01em;
}

.brand-mark small {
    margin-top: 2px;
    color: #91a0b6;
    font-size: 11px;
}

.brand-symbol {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(145deg, #4a74ff, #274ed8);
    box-shadow: 0 8px 18px rgba(49, 94, 251, 0.28);
}

.environment-badge {
    padding: 3px 7px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    color: #aab7ca;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.nav-list {
    display: block;
    flex: 1;
    margin-top: 15px;
}

.nav-section {
    display: grid;
    gap: 3px;
    margin-bottom: 17px;
}

.nav-section-label {
    padding: 0 10px 6px;
    color: #728198;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px 9px;
    border-radius: 8px;
    color: #c7d0df;
    font-size: 13px;
    font-weight: 600;
}

.nav-list a:hover {
    background: rgba(255, 255, 255, 0.055);
    color: #fff;
}

.nav-list .nav-active {
    background: #22304a;
    color: #fff;
    box-shadow: inset 2px 0 0 #6d8dff;
}

.nav-glyph {
    display: inline-grid;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #9eacc0;
    font-size: 10px;
    font-weight: 800;
}

.nav-active .nav-glyph {
    border-color: rgba(109, 141, 255, 0.45);
    background: rgba(109, 141, 255, 0.12);
    color: #dce5ff;
}

.sidebar-footer {
    display: grid;
    gap: 9px;
    padding: 14px 7px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #c7d0df;
    font-size: 12px;
    font-weight: 650;
}

.sidebar-footer small {
    color: #68778e;
    font-size: 10px;
}

.admin-main {
    padding: 24px 28px 42px;
}

.admin-topbar {
    align-items: center;
    min-height: 58px;
    margin-bottom: 20px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--border);
}

.topbar-title-group h1,
.admin-topbar h1 {
    font-size: 23px;
    font-weight: 720;
    letter-spacing: -0.025em;
}

.eyebrow {
    margin-bottom: 3px;
    color: #7a8699;
    font-size: 10px;
    letter-spacing: .09em;
}

.user-menu {
    gap: 9px;
    padding: 5px 6px 5px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.user-avatar {
    display: inline-grid !important;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

.user-meta {
    min-width: 0;
    padding-right: 4px;
}

.user-meta strong {
    font-size: 12px;
}

.user-meta small {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}

.panel,
.stat-card,
.role-permission-card,
.permission-module {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
    border-radius: var(--radius-lg);
}

.button {
    min-height: 36px;
    padding: 7px 12px;
    border-color: var(--border-strong);
    border-radius: 8px;
    background: #fff;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03);
}

.button:hover {
    border-color: #9fb0c5;
    background: #f8fafc;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    color: #fff;
}

.button-danger-soft {
    border-color: #f0c3c3;
    background: var(--danger-soft);
    color: var(--danger);
}

.button-danger-soft:hover {
    border-color: #e39898;
    background: #ffe7e7;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 9px;
}

.notice ul {
    margin: 5px 0 0;
    padding-left: 18px;
}

.notice-success {
    border-color: #b9e3ca;
    background: var(--success-soft);
    color: #145c38;
}

.notice-warning {
    border-color: #efd89d;
    background: var(--warning-soft);
    color: #7a5200;
}

.notice-icon {
    display: inline-grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

input,
select,
textarea {
    min-height: 39px;
    border-color: #cfd8e3;
    border-radius: 7px;
    padding: 8px 10px;
    background: #fff;
    color: #202a3c;
    font-size: 13px;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9aa7b8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #7594ff;
    outline: 3px solid rgba(49, 94, 251, 0.10);
}

th {
    background: #f7f9fc;
    color: #596579;
    font-size: 10px;
    letter-spacing: .055em;
}

td,
th {
    padding: 10px 11px;
}

/* Settings frame */
.settings-layout {
    display: grid;
    grid-template-columns: 258px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-navigation {
    position: sticky;
    top: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.settings-navigation-head {
    padding: 18px 17px 15px;
    border-bottom: 1px solid var(--border);
}

.settings-kicker {
    display: block;
    margin-bottom: 4px;
    color: #7a8699;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.settings-navigation-head h2,
.settings-workspace-head h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.02em;
}

.settings-navigation-head p,
.settings-workspace-head p,
.settings-section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.settings-nav-group {
    padding: 14px 10px 10px;
}

.settings-nav-group + .settings-nav-group {
    border-top: 1px solid #edf1f5;
}

.settings-nav-label {
    display: block;
    padding: 0 7px 7px;
    color: #8b96a8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 8px;
    color: #465267;
}

.settings-nav-link:hover {
    background: #f7f9fc;
    text-decoration: none;
}

.settings-nav-link.is-active {
    background: var(--primary-soft);
    color: #203b92;
}

.settings-nav-link > span:last-child {
    display: grid;
    min-width: 0;
}

.settings-nav-link strong {
    font-size: 12px;
    font-weight: 720;
}

.settings-nav-link small {
    margin-top: 1px;
    color: #8995a7;
    font-size: 10px;
    font-weight: 500;
}

.settings-nav-icon {
    display: inline-grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    border: 1px solid #dbe3ed;
    border-radius: 7px;
    background: #fff;
    color: #657188;
    font-size: 10px;
    font-weight: 800;
}

.settings-nav-link.is-active .settings-nav-icon {
    border-color: #bac9ff;
    background: #fff;
    color: var(--primary);
}

.settings-workspace {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.settings-workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 21px 17px;
}

.title-with-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.health-pill {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 760;
}

.health-ok {
    background: var(--success-soft);
    color: var(--success);
}

.health-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.health-neutral {
    background: #eef2f7;
    color: #69768a;
}

.settings-summary-chip {
    min-width: 155px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fafbfc;
}

.settings-summary-chip span,
.settings-summary-chip small {
    display: block;
    color: #7d899b;
    font-size: 9px;
}

.settings-summary-chip strong {
    display: block;
    margin: 2px 0;
    font-size: 13px;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 0 18px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.settings-tabs a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 45px;
    padding: 0 10px;
    color: #657188;
    font-size: 12px;
    font-weight: 690;
}

.settings-tabs a:hover {
    color: #253047;
    text-decoration: none;
}

.settings-tabs a.is-active {
    color: #18243b;
}

.settings-tabs a.is-active::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: -1px;
    left: 8px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--primary);
}

.tab-count {
    display: inline-grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #dfe6f1;
    color: #566274;
    font-size: 9px;
}

.settings-form {
    display: block;
}

.settings-section {
    margin: 0;
    padding: 21px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.settings-section:last-child {
    border-bottom: 0;
}

.settings-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 17px;
}

.settings-section-heading > div:first-child {
    position: relative;
}

.settings-section-heading h3 {
    display: inline-block;
    margin: 0;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.step-badge {
    display: inline-grid;
    width: 21px;
    height: 21px;
    margin-right: 6px;
    place-items: center;
    border-radius: 6px;
    background: #eef3ff;
    color: var(--primary-dark);
    font-size: 9px;
    font-weight: 800;
    vertical-align: 1px;
}

.security-note {
    padding: 4px 8px;
    border: 1px solid #bfe0cc;
    border-radius: 999px;
    background: #f0faf4;
    color: #2e6c49;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.transport-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.transport-card {
    position: relative;
    display: grid;
    gap: 10px;
    min-height: 118px;
    padding: 13px;
    border: 1px solid #d9e1eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.transport-card:hover {
    border-color: #aab9cb;
}

.transport-card.is-selected {
    border-color: #8aa4ff;
    background: #f8faff;
    box-shadow: 0 0 0 2px rgba(49, 94, 251, 0.07);
}

.transport-card input {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 16px;
    min-height: 0;
    height: 16px;
    margin: 0;
}

.transport-card-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 22px;
}

.transport-card-body > span:last-child {
    display: grid;
}

.transport-card-body strong {
    font-size: 13px;
}

.transport-card-body small,
.transport-meta {
    color: #7c899b;
    font-size: 10px;
    font-weight: 520;
}

.transport-icon {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 8px;
    background: #edf2f8;
    color: #5d6a80;
    font-size: 11px;
    font-weight: 850;
}

.is-selected .transport-icon {
    background: #e7edff;
    color: var(--primary);
}

.transport-meta {
    align-self: end;
    padding-top: 9px;
    border-top: 1px solid #edf1f5;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 6px;
    color: #3f4a5e;
    font-size: 11px;
    font-weight: 700;
}

.field-help {
    color: #8793a5;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.45;
}

.span-3 {
    grid-column: span 3;
}

.password-field,
.input-suffix {
    position: relative;
}

.password-field input {
    padding-right: 58px;
}

.input-action {
    position: absolute;
    top: 4px;
    right: 4px;
    min-height: 31px;
    padding: 0 9px;
    border: 0;
    border-radius: 6px;
    background: #f1f4f8;
    color: #526075;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.input-suffix input {
    padding-right: 42px;
}

.input-suffix span {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #8b97a8;
    font-size: 10px;
}

.inline-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.inline-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.success-dot::before {
    background: #28a064;
}

.warning-dot::before {
    background: #d88b12;
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #e1e6ed;
    border-radius: 9px;
    background: #fafbfc;
}

.check-card input {
    width: 15px;
    min-height: 0;
    height: 15px;
    margin-top: 2px;
}

.check-card span {
    display: grid;
}

.check-card strong {
    font-size: 11px;
}

.check-card small {
    margin-top: 2px;
    color: #8793a5;
    font-size: 10px;
    font-weight: 500;
}

.sticky-save-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 20px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.045);
    backdrop-filter: blur(8px);
}

.sticky-save-bar > div {
    display: grid;
}

.sticky-save-bar strong {
    font-size: 11px;
}

.sticky-save-bar span {
    color: #8290a3;
    font-size: 10px;
}

/* Queue */
.queue-settings-block {
    background: #fbfcfe;
}

.queue-config-row {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 190px auto;
    gap: 14px;
    align-items: end;
}

.switch-setting {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.switch-setting > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-setting > span:last-child {
    display: grid;
}

.switch-setting strong {
    font-size: 11px;
}

.switch-setting small {
    margin-top: 2px;
    color: #8491a3;
    font-size: 10px;
    font-weight: 500;
}

.switch-control {
    position: relative;
    width: 36px;
    height: 20px;
    flex: 0 0 36px;
    border-radius: 999px;
    background: #cbd4df;
    transition: background .15s ease;
}

.switch-control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
    transition: transform .15s ease;
}

.switch-setting input:checked + .switch-control {
    background: var(--primary);
}

.switch-setting input:checked + .switch-control::after {
    transform: translateX(16px);
}

.compact-field input {
    min-height: 38px;
}

.metric-strip {
    display: grid;
    gap: 11px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.metric-strip-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-strip-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    padding: 12px 13px;
    border: 1px solid #dfe6ef;
    border-radius: 9px;
    background: #fff;
}

.metric-card > span,
.metric-card > small {
    display: block;
    color: #7b8799;
    font-size: 9px;
}

.metric-card > strong {
    display: block;
    margin: 3px 0;
    font-size: 21px;
    letter-spacing: -0.02em;
}

.metric-card .metric-text {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-alert {
    border-color: #efc2c2;
    background: #fffafa;
}

.queue-heading {
    align-items: center;
}

.professional-table-wrap {
    margin: 0 -21px -21px;
    border-top: 1px solid #edf1f5;
}

.professional-table th {
    border-bottom-color: #e4e9ef;
    background: #fafbfc;
}

.professional-table td {
    font-size: 11px;
}

.professional-table td strong {
    display: block;
    font-size: 11px;
}

.professional-table td small {
    margin-top: 2px;
    font-size: 9px;
}

.error-summary {
    max-width: 380px;
    color: #7c3b3b;
    line-height: 1.4;
}

.table-actions-head {
    width: 150px;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.empty-state {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 26px;
    color: #7c899a;
    text-align: center;
}

.empty-state strong {
    color: #4a5669;
    font-size: 11px;
}

.empty-state span {
    font-size: 10px;
}

.compact-empty {
    padding: 17px;
}

.compact-notice {
    margin: 14px 0 0;
}

.worker-help {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 45%);
    gap: 18px;
    align-items: center;
    background: #f8fafc;
}

.worker-help h3 {
    margin: 0 0 5px;
    font-size: 13px;
}

.worker-help p {
    margin: 0;
    color: #778498;
    font-size: 10px;
}

.worker-help code {
    display: block;
    overflow-x: auto;
    padding: 10px 11px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #111827;
    color: #dce6f5;
    font-size: 10px;
    white-space: nowrap;
}

/* Diagnostics */
.diagnostics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
    border-bottom: 1px solid var(--border);
}

.diagnostics-grid > .settings-section {
    border-bottom: 0;
}

.diagnostics-grid > .settings-section + .settings-section {
    border-left: 1px solid var(--border);
}

.test-mail-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.diagnostic-error {
    display: grid;
    gap: 3px;
    margin-bottom: 13px;
    padding: 10px 11px;
    border: 1px solid #efc5c5;
    border-radius: 8px;
    background: #fff5f5;
    color: #7b3333;
}

.diagnostic-error strong {
    font-size: 10px;
}

.diagnostic-error span {
    font-size: 10px;
    overflow-wrap: anywhere;
}

.check-list {
    display: grid;
    gap: 8px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #e1e7ee;
    border-radius: 8px;
    background: #fafbfc;
}

.check-item > span:last-child {
    display: grid;
}

.check-item strong {
    font-size: 10px;
}

.check-item small {
    margin-top: 1px;
    color: #8491a3;
    font-size: 9px;
}

.check-indicator {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
}

.check-item.is-pass .check-indicator {
    background: var(--success-soft);
    color: var(--success);
}

.check-item.is-fail .check-indicator {
    background: var(--warning-soft);
    color: var(--warning);
}

@media (max-width: 1180px) {
    .settings-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .transport-grid,
    .metric-strip-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid-3 .span-3 {
        grid-column: span 2;
    }

    .queue-config-row,
    .test-mail-form {
        grid-template-columns: 1fr 1fr;
    }

    .queue-config-row .switch-setting,
    .test-mail-form .button {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .nav-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .sidebar-footer {
        display: none;
    }

    .settings-layout,
    .diagnostics-grid {
        grid-template-columns: 1fr;
    }

    .settings-navigation {
        position: static;
    }

    .settings-nav-group {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .settings-nav-label {
        grid-column: 1 / -1;
    }

    .diagnostics-grid > .settings-section + .settings-section {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .worker-help {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .admin-main {
        padding: 16px;
    }

    .admin-topbar,
    .settings-workspace-head,
    .sticky-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }

    .user-meta {
        flex: 1;
    }

    .nav-list,
    .settings-nav-group,
    .transport-grid,
    .field-grid,
    .field-grid-3,
    .metric-strip-3,
    .metric-strip-4,
    .queue-config-row,
    .test-mail-form {
        grid-template-columns: 1fr;
    }

    .field-grid-3 .span-3,
    .span-2,
    .span-3,
    .queue-config-row .switch-setting,
    .test-mail-form .button {
        grid-column: auto;
    }

    .settings-tabs {
        overflow-x: auto;
    }

    .settings-tabs a {
        white-space: nowrap;
    }

    .settings-summary-chip {
        width: 100%;
    }

    .professional-table {
        min-width: 690px;
    }
}
