:root {
    --bg: #090909;
    --panel: #111111;
    --panel-soft: #181818;
    --text: #f5f5f2;
    --muted: #a6a6a0;
    --gold: #d5ad4d;
    --gold-soft: #f0d58d;
    --line: rgba(255,255,255,.11);
    --ink: #171717;
    --paper: #f5f3ed;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-page {
    background:
        radial-gradient(circle at 12% 18%, rgba(213,173,77,.10), transparent 28rem),
        var(--bg);
    color: var(--text);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr);
}

.brand-panel {
    padding: clamp(48px, 8vw, 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--line);
}

.brand-mark,
.mini-mark {
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    color: var(--gold-soft);
    font-family: Georgia, serif;
}

.brand-mark {
    width: 72px;
    height: 72px;
    font-size: 34px;
    margin-bottom: 44px;
}

.eyebrow {
    margin: 0 0 16px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .22em;
}

h1, h2 { margin-top: 0; line-height: 1.04; }
.brand-panel h1 {
    max-width: 760px;
    margin-bottom: 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(45px, 6vw, 84px);
    font-weight: 500;
    letter-spacing: -.04em;
}

.lead {
    max-width: 630px;
    margin: 0;
    color: #c7c7c0;
    font-size: clamp(18px, 2vw, 23px);
    line-height: 1.55;
}

.brand-rule {
    width: 88px;
    height: 1px;
    margin: 44px 0 22px;
    background: var(--gold);
}
.small-copy { color: var(--muted); letter-spacing: .04em; }

.login-card {
    display: grid;
    place-items: center;
    padding: 42px;
    background: #0c0c0c;
}
.login-card-inner { width: min(100%, 480px); }
.login-card h2 {
    margin-bottom: 12px;
    font-family: Georgia, serif;
    font-size: 48px;
    font-weight: 500;
}
.muted { color: var(--muted); line-height: 1.65; margin: 0 0 34px; }

label {
    display: block;
    margin: 18px 0 8px;
    font-size: 14px;
    font-weight: 650;
}
input {
    width: 100%;
    border: 1px solid #343434;
    background: #151515;
    color: var(--text);
    border-radius: 4px;
    padding: 15px 16px;
    font: inherit;
    outline: none;
}
input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(213,173,77,.11);
}
button {
    width: 100%;
    margin-top: 28px;
    border: 1px solid var(--gold);
    border-radius: 4px;
    padding: 15px 18px;
    background: var(--gold);
    color: #111;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
button:hover { filter: brightness(1.06); }
.alert {
    margin: 0 0 24px;
    padding: 13px 15px;
    border: 1px solid rgba(213,173,77,.45);
    background: rgba(213,173,77,.09);
    color: #f1dfad;
    line-height: 1.5;
}
.security-note { margin-top: 22px; color: #777; font-size: 12px; line-height: 1.55; }

.dashboard-page { background: var(--paper); color: var(--ink); }
.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px clamp(24px, 5vw, 72px);
    background: var(--bg);
    color: var(--text);
}
.topbar-brand { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 800; letter-spacing: .14em; }
.mini-mark { width: 36px; height: 36px; font-size: 18px; }
.topbar form { margin: 0; }
.ghost-button {
    width: auto;
    margin: 0;
    padding: 10px 15px;
    background: transparent;
    color: var(--text);
}
.dashboard-shell { max-width: 1180px; margin: 0 auto; padding: 90px 28px; }
.dashboard-shell h1 { font-family: Georgia, serif; font-size: clamp(48px, 7vw, 82px); font-weight: 500; letter-spacing: -.04em; }
.dark-lead { color: #4e4e4a; max-width: 760px; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 54px; }
.status-card { display: flex; gap: 14px; min-height: 145px; padding: 24px; border: 1px solid #d9d5ca; background: #fff; }
.status-card strong { display: block; margin-bottom: 8px; }
.status-card p { margin: 0; color: #66635d; line-height: 1.5; overflow-wrap: anywhere; }
.status-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--gold); margin-top: 5px; }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel { min-height: 48vh; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-card { padding: 60px 28px; }
    .status-grid { grid-template-columns: 1fr; }
}


/* --- Admin customer management --- */
.topbar-link { color: inherit; text-decoration: none; }
.topbar-nav { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.topbar-nav a { color: #d0d0ca; text-decoration: none; font-size: 13px; font-weight: 700; }
.topbar-nav a:hover { color: var(--gold-soft); }

.admin-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 72px 28px 110px;
}
.admin-shell-narrow { max-width: 860px; }
.admin-shell h1 {
    margin-bottom: 18px;
    font-family: Georgia, serif;
    font-size: clamp(48px, 6vw, 76px);
    font-weight: 500;
    letter-spacing: -.04em;
}
.admin-lead { max-width: 760px; margin: 0; color: #5e5b55; font-size: 18px; line-height: 1.65; }
.page-heading-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 42px; }

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 17px;
    border: 1px solid #c7b47e;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 800;
}
.action-link-primary { background: var(--gold); color: #111; }
.action-link-secondary { background: transparent; color: #34322d; border-color: #bdb9ae; }
.back-link, .text-link { color: #5f553d; font-weight: 700; text-decoration: none; }
.back-link { display: inline-block; margin-bottom: 42px; }

.notice { margin: 0 0 30px; padding: 16px 18px; border: 1px solid; line-height: 1.55; }
.notice ul { margin-bottom: 0; }
.success-notice { background: #f7f3e7; border-color: #d4bd7a; }
.error-notice { background: #fff2ef; border-color: #d6a19b; }

.search-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
}
.search-form input,
.admin-form input,
.admin-form select {
    border-color: #c9c5ba;
    background: #fff;
    color: #171717;
}
.search-form button {
    width: auto;
    margin: 0;
    min-height: 49px;
}
.search-form .text-link { padding: 12px; }

.table-card { border: 1px solid #d9d5ca; background: #fff; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.admin-table th, .admin-table td { padding: 18px 20px; text-align: left; border-bottom: 1px solid #ece9e1; vertical-align: middle; }
.admin-table th { color: #77726a; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.cell-subline { display: block; margin-top: 5px; color: #77726a; font-size: 13px; }
.table-actions a { color: #5f4f24; font-weight: 800; text-decoration: none; }

.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-active { background: #edf5ea; color: #356031; }
.status-disabled { background: #efefec; color: #66635d; }
.status-locked { background: #fff0e8; color: #885037; }

.empty-state { padding: 50px; border: 1px solid #d9d5ca; background: #fff; }
.empty-state h2 { font-family: Georgia, serif; font-size: 36px; font-weight: 500; margin-bottom: 10px; }
.empty-state p { color: #66635d; line-height: 1.6; max-width: 650px; }
.empty-state .action-link { margin-top: 16px; }

.admin-form { margin-top: 42px; padding: 34px; border: 1px solid #d9d5ca; background: #fff; }
.admin-form label { color: #292824; }
.admin-form input, .admin-form select { width: 100%; padding: 14px 15px; border: 1px solid #c9c5ba; border-radius: 4px; font: inherit; }
.admin-form input:focus, .admin-form select:focus { border-color: #9f7d2c; box-shadow: 0 0 0 3px rgba(213,173,77,.16); outline: none; }
.admin-form select { min-height: 49px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-divider { height: 1px; margin: 34px 0; background: #e6e2d9; }
.form-section-title { margin: 0 0 20px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.field-help { margin: 8px 0 0; color: #77726a; font-size: 13px; line-height: 1.5; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 36px; }
.form-actions button { width: auto; margin: 0; }
.checkbox-row { display: flex !important; align-items: center; gap: 10px; margin-top: 24px !important; }
.checkbox-row input { width: 18px; height: 18px; margin: 0; }

.account-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 34px; }
.account-meta-grid > div { padding: 18px; border: 1px solid #d9d5ca; background: #fff; }
.account-meta-grid span { display: block; margin-bottom: 7px; color: #77726a; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.dashboard-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 52px; }
.dashboard-action-card {
    position: relative;
    min-height: 230px;
    padding: 30px;
    border: 1px solid #d9d5ca;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}
.dashboard-action-card strong { display: block; margin: 10px 0 12px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.dashboard-action-card p { max-width: 480px; margin: 0; color: #66635d; line-height: 1.6; }
.action-kicker { color: #9b792d; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.card-arrow { position: absolute; right: 28px; bottom: 24px; color: #9b792d; font-size: 26px; }
.dashboard-action-card:not(.dashboard-action-disabled):hover { border-color: #b99b52; transform: translateY(-1px); }
.dashboard-action-disabled { background: #efede7; }

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; }
    .topbar-nav { order: 3; width: 100%; margin-left: 0; padding-top: 8px; border-top: 1px solid var(--line); }
    .page-heading-row { align-items: flex-start; flex-direction: column; }
    .search-form { grid-template-columns: 1fr; }
    .search-form button { width: 100%; }
    .form-grid, .account-meta-grid, .dashboard-actions { grid-template-columns: 1fr; }
    .admin-form { padding: 22px; }
    .form-actions { align-items: stretch; flex-direction: column-reverse; }
    .form-actions .action-link, .form-actions button { width: 100%; }
}


/* --- Areas & protected documents --- */
.portal-section { margin-top: 70px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 26px; }
.section-heading h2 { margin: 6px 0 0; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 48px); font-weight: 500; letter-spacing: -.025em; }
.section-heading p { color: #68645c; }
.compact-heading { margin-bottom: 18px; }

.customer-area-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.customer-area-card { padding: 26px; border: 1px solid #d9d5ca; background: #fff; }
.area-card-heading h3 { margin: 8px 0 8px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.area-card-heading p { color: #6a665d; line-height: 1.6; }
.file-list { margin-top: 20px; border-top: 1px solid #ece8de; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 15px 0; border-bottom: 1px solid #ece8de; color: #1b1b19; text-decoration: none; }
.file-row strong { display: block; }
.file-row small { display: block; margin-top: 4px; color: #7c776d; }
.file-download { color: #86671f; font-size: 13px; font-weight: 800; }
.muted-text { color: #757168; line-height: 1.6; }

.customer-upload-form textarea,
.admin-form textarea {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #c9c5ba;
    border-radius: 4px;
    background: #fff;
    color: #171717;
    font: inherit;
    resize: vertical;
}
.customer-upload-form textarea:focus,
.admin-form textarea:focus {
    border-color: #9f7d2c;
    box-shadow: 0 0 0 3px rgba(213,173,77,.16);
    outline: none;
}

.admin-content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 48px; }
.compact-form { margin-top: 0; }
.area-admin-list { margin-top: 18px; border: 1px solid #d9d5ca; background: #fff; }
.area-admin-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 20px; border-bottom: 1px solid #ece9e1; }
.area-admin-row:last-child { border-bottom: 0; }
.area-admin-row p { margin: 5px 0 0; color: #77726a; font-size: 13px; line-height: 1.5; }
.small-button { width: auto; margin: 0; padding: 9px 12px; min-height: 38px; }
.secondary-button { background: transparent; color: #5f553d; border: 1px solid #bdb9ae; }
.inline-form { display: inline; margin-left: 10px; }
.link-button { display: inline; width: auto; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.link-button:hover { transform: none; box-shadow: none; }
.danger-link { color: #8b3d36; text-decoration: underline; font-weight: 700; }

@media (max-width: 900px) {
    .customer-area-grid,
    .admin-content-grid { grid-template-columns: 1fr; }
    .file-row { align-items: flex-start; }
}


/* --- Invitations & password reset --- */
.auth-link-row {
    margin: 18px 0 0;
    text-align: center;
    font-size: 14px;
}
.auth-link-row a {
    color: #b78b2f;
    font-weight: 800;
    text-decoration: none;
}
.auth-link-row a:hover {
    text-decoration: underline;
}
.auth-primary-link {
    display: inline-flex;
    justify-content: center;
    min-height: 46px;
    padding: 12px 18px;
    border: 1px solid #c7a34a;
}
.invitation-info {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #d8ca9f;
    background: #fbf7ea;
}
.invitation-info strong {
    display: block;
    margin-bottom: 7px;
}
.invitation-info p {
    margin: 0;
    color: #655f52;
    line-height: 1.6;
}
.status-pending {
    background: #fff5d8;
    color: #785b16;
}
.pending-invite-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-top: 34px;
    padding: 22px;
    border: 1px solid #d8ca9f;
    background: #fbf7ea;
}
.pending-invite-card strong {
    display: block;
    margin: 8px 0 6px;
}
.pending-invite-card p {
    margin: 0;
    color: #655f52;
    line-height: 1.55;
}
.pending-invite-card form {
    flex: 0 0 auto;
}
.pending-invite-card button {
    width: auto;
    margin: 0;
}
@media (max-width: 760px) {
    .pending-invite-card {
        align-items: stretch;
        flex-direction: column;
    }
    .pending-invite-card button {
        width: 100%;
    }
}


/* --- Audit log & security overview --- */
.security-heading { align-items: center; }
.security-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    padding: 10px 13px;
    border: 1px solid #cdd9c8;
    background: #f4f8f1;
    color: #3f6338;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
}
.security-live-badge .status-dot,
.security-ok .status-dot {
    width: 8px;
    height: 8px;
}

.security-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 38px 0 22px;
}
.security-kpi {
    min-height: 138px;
    padding: 22px;
    border: 1px solid #d9d5ca;
    background: #fff;
}
.security-kpi span {
    display: block;
    min-height: 36px;
    color: #77726a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1.45;
    text-transform: uppercase;
}
.security-kpi strong {
    display: block;
    margin-top: 14px;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 500;
}
.security-kpi-warn {
    border-color: #ddc58c;
    background: #fffaf0;
}
.security-kpi-danger {
    border-color: #d4a09a;
    background: #fff5f2;
}

.security-alert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.security-panel {
    border: 1px solid #d9d5ca;
    background: #fff;
}
.security-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px;
    border-bottom: 1px solid #ece9e1;
}
.security-panel-head h2 {
    margin: 7px 0 0;
    font-family: Georgia, serif;
    font-size: 30px;
    font-weight: 500;
}
.security-count {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d4d0c6;
    border-radius: 50%;
    font-weight: 800;
}
.security-ok {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px;
    color: #4e6848;
    line-height: 1.55;
}
.security-mini-list { padding: 0 24px; }
.security-mini-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 17px 0;
    border-bottom: 1px solid #ece9e1;
}
.security-mini-row:last-child { border-bottom: 0; }
.security-mini-row strong { display: block; }
.security-mini-row small {
    display: block;
    margin-top: 5px;
    color: #7a756c;
}
.security-mini-meta {
    flex: 0 0 auto;
    color: #6c675e;
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}
.security-risk-pill {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    background: #fff0e8;
    color: #885037;
    font-size: 12px;
    font-weight: 800;
}

.audit-section { margin-top: 70px; }
.audit-filter-form {
    display: grid;
    grid-template-columns: 190px 220px minmax(260px, 1fr) auto auto;
    gap: 11px;
    align-items: end;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #d9d5ca;
    background: #fff;
}
.audit-filter-form label {
    display: block;
    margin-bottom: 7px;
    color: #565149;
    font-size: 12px;
    font-weight: 800;
}
.audit-filter-form select,
.audit-filter-form input {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid #c9c5ba;
    border-radius: 4px;
    background: #fff;
    color: #171717;
    font: inherit;
}
.audit-filter-form button {
    width: auto;
    min-height: 46px;
    margin: 0;
}
.audit-reset-link {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
}

.audit-table { min-width: 1260px; }
.audit-time strong,
.audit-time span { display: block; }
.audit-time span {
    margin-top: 4px;
    color: #7a756c;
    font-size: 12px;
}
.audit-ip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
.audit-event-pill {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.audit-tone-success { background: #edf5ea; color: #356031; }
.audit-tone-warning { background: #fff5d8; color: #785b16; }
.audit-tone-danger { background: #fff0e8; color: #885037; }
.audit-tone-account { background: #f2eee2; color: #65542b; }
.audit-tone-file { background: #eef2f4; color: #445a64; }
.audit-tone-content { background: #f1eef5; color: #5e4c69; }
.audit-tone-neutral { background: #efefec; color: #66635d; }

.audit-details summary {
    cursor: pointer;
    color: #6d5724;
    font-weight: 800;
}
.audit-details-body {
    width: min(520px, 70vw);
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #ded9cd;
    background: #faf8f2;
    color: #4c4942;
    font-size: 12px;
    line-height: 1.5;
}
.audit-details-body p { margin: 6px 0 12px; }
.audit-details-body pre {
    max-height: 260px;
    overflow: auto;
    margin: 7px 0 14px;
    padding: 10px;
    background: #f0ede5;
    white-space: pre-wrap;
    word-break: break-word;
}
.audit-user-agent { word-break: break-word; }

.audit-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
}
.audit-pagination a {
    color: #695622;
    font-weight: 800;
    text-decoration: none;
}
.audit-pagination a:last-child { text-align: right; }
.audit-pagination strong {
    color: #706b62;
    font-size: 13px;
}

.security-note-panel {
    margin-top: 56px;
    padding: 20px 22px;
    border-left: 3px solid #b8923d;
    background: #f6f3ea;
}
.security-note-panel strong { display: block; margin-bottom: 7px; }
.security-note-panel p {
    margin: 0;
    color: #666057;
    line-height: 1.6;
}

@media (max-width: 1050px) {
    .security-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .security-alert-grid { grid-template-columns: 1fr; }
    .audit-filter-form {
        grid-template-columns: 1fr 1fr;
    }
    .audit-search-field { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
    .security-kpi-grid { grid-template-columns: 1fr; }
    .security-mini-row { align-items: flex-start; flex-direction: column; }
    .security-mini-meta { text-align: left; }
    .audit-filter-form { grid-template-columns: 1fr; }
    .audit-search-field { grid-column: auto; }
    .audit-filter-form button { width: 100%; }
    .audit-pagination {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .audit-pagination a:last-child { text-align: center; }
}


/* --- Protected document archive --- */
.archive-link {
    color: #7b5a17;
    text-decoration: underline;
}
.restore-link {
    color: #356031;
    text-decoration: underline;
}
.archive-section {
    padding-top: 12px;
    border-top: 1px solid #ddd8cd;
}
.archive-count {
    display: inline-flex;
    min-width: 46px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid #cfbf92;
    border-radius: 50%;
    background: #faf6e9;
    color: #6b5522;
    font-family: Georgia, serif;
    font-size: 21px;
}
.archive-empty {
    padding: 28px;
    border: 1px dashed #cfc8b7;
    background: #faf8f2;
}
.archive-empty strong {
    display: block;
    margin-bottom: 6px;
}
.archive-empty p {
    margin: 0;
    color: #716c62;
}
.archive-table {
    min-width: 1120px;
}
.archive-table-card {
    border-color: #cec4a9;
}
.archive-status {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.archive-status-ok {
    background: #edf5ea;
    color: #356031;
}
.archive-status-missing {
    background: #fff0e8;
    color: #885037;
}
.archive-actions {
    min-width: 190px;
}
.archive-legacy-note {
    color: #8a6a5b;
    font-size: 12px;
    font-weight: 700;
}
.archive-footnote {
    max-width: 920px;
    margin: 15px 0 0;
    color: #777168;
    font-size: 12px;
    line-height: 1.6;
}


/* --- Permanent archive deletion --- */
.purge-details {
    display: block;
    margin-top: 10px;
}
.purge-details > summary {
    cursor: pointer;
    color: #9a3f35;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
}
.purge-form {
    width: min(360px, 70vw);
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #d8a19a;
    background: #fff5f2;
}
.purge-form label {
    display: block;
    margin-bottom: 8px;
    color: #694842;
    font-size: 12px;
    line-height: 1.5;
}
.purge-form label strong {
    display: block;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #8b3027;
}
.purge-form input {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px 11px;
    border: 1px solid #c98e87;
    border-radius: 4px;
    background: #fff;
    color: #231b1a;
    font: inherit;
}
.purge-button {
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #9b3d34;
    background: #9b3d34;
    color: #fff;
}
.purge-button:hover {
    background: #7e3029;
}
.archive-danger-note {
    max-width: 920px;
    margin-top: 18px;
    padding: 16px 18px;
    border-left: 3px solid #a5453a;
    background: #fff4f1;
}
.archive-danger-note strong {
    display: block;
    margin-bottom: 6px;
    color: #7e3029;
}
.archive-danger-note p {
    margin: 0;
    color: #6f5550;
    font-size: 13px;
    line-height: 1.6;
}


/* --- Customer deletion of own uploads --- */
.customer-file-actions {
    min-width: 150px;
}
.customer-delete-link {
    margin-left: 10px;
    color: #8b3d36;
    text-decoration: underline;
}
.customer-delete-note {
    max-width: 820px;
    margin: -10px 0 20px;
    padding: 12px 14px;
    border-left: 3px solid #b8923d;
    background: #f7f4ec;
    color: #6d675d;
    font-size: 13px;
    line-height: 1.6;
}


/* --- Admin dashboard v1 --- */
.admin-dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 44px;
}
.admin-kpi-card {
    display: block;
    min-height: 158px;
    padding: 22px;
    border: 1px solid #d9d5ca;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}
.admin-kpi-card span {
    display: block;
    min-height: 34px;
    color: #746f65;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
    line-height: 1.45;
    text-transform: uppercase;
}
.admin-kpi-card strong {
    display: block;
    margin: 11px 0 6px;
    font-family: Georgia, serif;
    font-size: 43px;
    font-weight: 500;
    letter-spacing: -.03em;
}
.admin-kpi-card small {
    color: #777168;
    font-size: 12px;
    line-height: 1.5;
}
a.admin-kpi-card:hover {
    border-color: #b89b56;
    transform: translateY(-1px);
}
.admin-kpi-attention {
    border-color: #d7c187;
    background: #fffaf0;
}
.admin-kpi-positive {
    border-color: #cbd7c5;
    background: #f7faf5;
}
.admin-kpi-danger {
    border-color: #d4a09a;
    background: #fff5f2;
}

.admin-dashboard-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}
.admin-quick-action {
    position: relative;
    min-height: 210px;
    padding: 25px;
    border: 1px solid #d9d5ca;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}
.admin-quick-action-primary {
    border-color: #c9ab62;
    background: #f9f5e9;
}
.admin-quick-action strong {
    display: block;
    margin: 10px 0;
    font-family: Georgia, serif;
    font-size: 29px;
    font-weight: 500;
}
.admin-quick-action p {
    max-width: 390px;
    margin: 0;
    color: #69645b;
    line-height: 1.55;
}
.admin-quick-action:hover {
    border-color: #aa893e;
    transform: translateY(-1px);
}

.admin-dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 54px;
}
.admin-dashboard-panel {
    border: 1px solid #d9d5ca;
    background: #fff;
}
.admin-dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 23px 24px;
    border-bottom: 1px solid #ebe7dd;
}
.admin-dashboard-panel-head h2 {
    margin: 7px 0 0;
    font-family: Georgia, serif;
    font-size: 30px;
    font-weight: 500;
}
.admin-dashboard-panel-head > span {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d2ccc0;
    border-radius: 50%;
    font-weight: 800;
}
.admin-dashboard-panel-head > a {
    color: #725c28;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}
.admin-dashboard-list {
    padding: 0 24px;
}
.admin-dashboard-list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 17px 0;
    border-bottom: 1px solid #ebe7dd;
    color: var(--ink);
    text-decoration: none;
}
.admin-dashboard-list-row:last-child {
    border-bottom: 0;
}
.admin-dashboard-list-row:hover strong {
    color: #7a5c1b;
}
.admin-dashboard-list-row strong {
    display: block;
}
.admin-dashboard-list-row small {
    display: block;
    margin-top: 5px;
    color: #777168;
    line-height: 1.45;
}
.admin-dashboard-row-meta {
    flex: 0 0 auto;
    color: #746f65;
    font-size: 12px;
    line-height: 1.55;
    text-align: right;
}
.admin-dashboard-empty {
    padding: 26px 24px;
    color: #777168;
    line-height: 1.6;
}
.mini-archive-label {
    display: inline-flex;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #f0ece1;
    color: #776236;
    font-size: 10px;
    font-weight: 800;
}
.dashboard-status {
    display: inline-flex;
    margin-bottom: 4px;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}
.dashboard-status-active {
    background: #edf5ea;
    color: #356031;
}
.dashboard-status-pending {
    background: #fff5d8;
    color: #785b16;
}
.dashboard-status-disabled,
.dashboard-status-locked {
    background: #efefec;
    color: #66635d;
}
.admin-security-preview {
    margin-top: 18px;
}
.admin-dashboard-security-ok {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #496942;
}

@media (max-width: 1050px) {
    .admin-dashboard-kpis,
    .admin-dashboard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 800px) {
    .admin-dashboard-columns {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 620px) {
    .admin-dashboard-kpis,
    .admin-dashboard-actions {
        grid-template-columns: 1fr;
    }
    .admin-dashboard-list-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .admin-dashboard-row-meta {
        text-align: left;
    }
}

/* --- Customer notification on admin document upload --- */
.customer-notification-option {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    margin-top: 26px !important;
    padding: 16px;
    border: 1px solid #d8ca9f;
    background: #fbf7ea;
    cursor: pointer;
}
.customer-notification-option input {
    flex: 0 0 auto;
    width: 18px !important;
    height: 18px;
    margin: 2px 0 0;
}
.customer-notification-option span {
    display: block;
}
.customer-notification-option strong {
    display: block;
    color: #3e382a;
}
.customer-notification-option small {
    display: block;
    margin-top: 5px;
    color: #716958;
    font-size: 12px;
    line-height: 1.55;
}



/* =========================================================
   K-Analytics Visual Finish v1
   ========================================================= */

:root {
    --ka-gold-deep: #9b7424;
    --ka-paper-warm: #f5f2e9;
    --ka-paper-card: #fffdfa;
    --ka-ink-soft: #49463f;
    --ka-line-strong: #cfc8b8;
    --ka-shadow: 0 16px 44px rgba(24, 21, 15, .055);
    --ka-shadow-hover: 0 18px 48px rgba(24, 21, 15, .09);
}

/* Smoother page rendering */
html {
    scroll-behavior: smooth;
    background: var(--paper);
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a,
button,
input,
select,
textarea {
    transition:
        border-color .16s ease,
        background-color .16s ease,
        color .16s ease,
        box-shadow .16s ease,
        transform .16s ease,
        opacity .16s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(213, 173, 77, .34);
    outline-offset: 3px;
}

/* ---------- Login / password pages ---------- */
.auth-page {
    position: relative;
    overflow-x: hidden;
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border: 1px solid rgba(213, 173, 77, .12);
    border-radius: 50%;
}

.auth-page::before {
    width: 520px;
    height: 520px;
    left: -260px;
    bottom: -230px;
}

.auth-page::after {
    width: 320px;
    height: 320px;
    right: -170px;
    top: -130px;
}

.auth-shell {
    position: relative;
    z-index: 1;
}

.brand-panel {
    background:
        linear-gradient(135deg, rgba(213,173,77,.045), transparent 45%),
        #090909;
}

.brand-mark {
    box-shadow: inset 0 0 0 5px rgba(213, 173, 77, .035);
}

.login-card {
    position: relative;
    box-shadow: inset 1px 0 0 rgba(255,255,255,.035);
}

.login-card-inner {
    padding: clamp(0px, 2vw, 18px);
}

.login-card input {
    min-height: 52px;
}

.login-card button {
    min-height: 52px;
}

.auth-link-row a {
    text-underline-offset: 3px;
}

/* ---------- Global portal background ---------- */
.dashboard-page {
    background:
        radial-gradient(circle at 92% 12%, rgba(213,173,77,.055), transparent 24rem),
        linear-gradient(180deg, #f7f4ec 0, var(--paper) 300px);
}

/* ---------- Header / navigation ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 72px;
    border-bottom: 1px solid rgba(213,173,77,.22);
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.topbar-brand {
    white-space: nowrap;
}

.topbar-brand:hover .mini-mark {
    background: rgba(213,173,77,.09);
}

.topbar-nav {
    gap: 7px;
}

.topbar-nav a {
    position: relative;
    padding: 10px 12px;
    border-radius: 3px;
}

.topbar-nav a:hover {
    background: rgba(255,255,255,.045);
}

.topbar-nav a.is-active {
    color: var(--gold-soft);
    background: rgba(213,173,77,.09);
}

.topbar-nav a.is-active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 1px;
    background: var(--gold);
}

.ghost-button:hover {
    background: rgba(213,173,77,.08);
    border-color: var(--gold-soft);
}

/* ---------- Page hierarchy ---------- */
.dashboard-shell,
.admin-shell {
    position: relative;
}

.dashboard-shell::before,
.admin-shell::before {
    content: "";
    display: block;
    width: 54px;
    height: 2px;
    margin-bottom: 24px;
    background: var(--gold);
}

.dashboard-shell h1,
.admin-shell h1 {
    max-width: 980px;
}

.dark-lead,
.admin-lead {
    color: var(--ka-ink-soft);
}

.eyebrow {
    font-weight: 800;
}

.section-heading h2,
.admin-dashboard-panel-head h2,
.security-panel-head h2 {
    letter-spacing: -.025em;
}

/* ---------- Cards ---------- */
.status-card,
.table-card,
.customer-area-card,
.admin-form,
.empty-state,
.dashboard-action-card,
.admin-quick-action,
.admin-kpi-card,
.admin-dashboard-panel,
.security-panel,
.security-kpi,
.account-meta-grid > div,
.area-admin-list {
    border-color: var(--ka-line-strong);
    box-shadow: var(--ka-shadow);
}

a.dashboard-action-card:hover,
a.admin-quick-action:hover,
a.admin-kpi-card:hover {
    box-shadow: var(--ka-shadow-hover);
}

.dashboard-action-card,
.admin-quick-action,
.customer-area-card,
.security-panel,
.admin-dashboard-panel,
.table-card,
.admin-form,
.empty-state {
    background: var(--ka-paper-card);
}

.dashboard-action-card,
.admin-quick-action {
    overflow: hidden;
}

.dashboard-action-card::before,
.admin-quick-action::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: transparent;
}

.dashboard-action-card:hover::before,
.admin-quick-action:hover::before,
.admin-quick-action-primary::before {
    background: var(--gold);
}

/* ---------- Buttons / links ---------- */
.action-link,
button {
    letter-spacing: .01em;
}

.action-link-primary,
.admin-form button:not(.link-button):not(.small-button):not(.purge-button),
.search-form button {
    box-shadow: 0 8px 20px rgba(155, 116, 36, .13);
}

.action-link-primary:hover,
.admin-form button:not(.link-button):not(.small-button):not(.purge-button):hover,
.search-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(155, 116, 36, .18);
}

.back-link,
.text-link,
.table-actions a,
.admin-dashboard-panel-head > a {
    text-underline-offset: 3px;
}

.back-link:hover,
.text-link:hover,
.table-actions a:hover,
.admin-dashboard-panel-head > a:hover {
    color: var(--ka-gold-deep);
    text-decoration: underline;
}

/* ---------- Forms ---------- */
.admin-form {
    border-radius: 2px;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.search-form input,
.audit-filter-form input,
.audit-filter-form select {
    min-height: 48px;
    border-color: #c8c1b3;
}

.admin-form textarea {
    min-height: 110px;
}

.admin-form label {
    margin-top: 21px;
}

.field-help {
    max-width: 680px;
}

/* ---------- Tables ---------- */
.admin-table thead {
    background: #f2eee4;
}

.admin-table th {
    color: #686258;
}

.admin-table tbody tr {
    transition: background-color .12s ease;
}

.admin-table tbody tr:hover {
    background: #fcfaf5;
}

.admin-table td {
    line-height: 1.45;
}

/* ---------- KPI / dashboard ---------- */
.admin-dashboard-kpis {
    margin-top: 48px;
}

.admin-kpi-card {
    position: relative;
    overflow: hidden;
}

.admin-kpi-card::after {
    content: "";
    position: absolute;
    right: -42px;
    bottom: -52px;
    width: 128px;
    height: 128px;
    border: 1px solid rgba(155,116,36,.11);
    border-radius: 50%;
}

.admin-kpi-card strong {
    color: #26231e;
}

.admin-dashboard-panel-head {
    background: linear-gradient(180deg, #fffdfa, #fbf8f1);
}

.admin-dashboard-list-row {
    min-height: 72px;
}

.admin-dashboard-security-ok {
    background: #f8fbf6;
}

/* ---------- Customer dashboard ---------- */
.customer-area-card {
    position: relative;
    overflow: hidden;
}

.customer-area-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 46px;
    height: 2px;
    background: var(--gold);
}

.file-row:hover {
    color: var(--ka-gold-deep);
}

.file-row:hover .file-download {
    transform: translateX(2px);
}

/* ---------- Notices ---------- */
.notice,
.alert {
    border-radius: 2px;
}

.success-notice {
    border-left: 4px solid #a98a3f;
}

.error-notice {
    border-left: 4px solid #a84a40;
}

/* ---------- Security / archive ---------- */
.security-live-badge,
.archive-count {
    box-shadow: var(--ka-shadow);
}

.audit-event-pill,
.status-pill,
.dashboard-status,
.archive-status {
    letter-spacing: .01em;
}

.archive-danger-note {
    box-shadow: inset 0 0 0 1px rgba(165,69,58,.06);
}

/* ---------- Footer ---------- */
.portal-footer {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px 38px;
}

.portal-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-top: 22px;
    border-top: 1px solid #d8d2c5;
    color: #79736a;
    font-size: 12px;
    line-height: 1.5;
}

.portal-footer a {
    color: #685522;
    text-decoration: none;
}

.portal-footer a:hover {
    text-decoration: underline;
}

/* ---------- Better responsive behavior ---------- */
@media (max-width: 960px) {
    .topbar {
        position: relative;
    }

    .topbar-nav {
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .topbar-nav a {
        flex: 0 0 auto;
    }

    .dashboard-shell {
        padding-top: 62px;
    }

    .admin-shell {
        padding-top: 56px;
    }
}

@media (max-width: 720px) {
    .topbar {
        gap: 12px;
        padding: 12px 18px;
    }

    .topbar-brand > span:last-child {
        display: none;
    }

    .topbar-nav {
        gap: 2px;
    }

    .topbar-nav a {
        padding: 9px 8px;
        font-size: 12px;
    }

    .ghost-button {
        padding: 9px 10px;
        font-size: 12px;
    }

    .dashboard-shell,
    .admin-shell {
        padding-left: 18px;
        padding-right: 18px;
    }

    .dashboard-shell h1,
    .admin-shell h1 {
        font-size: clamp(42px, 13vw, 62px);
    }

    .page-heading-row {
        margin-bottom: 30px;
    }

    .admin-form {
        padding: 18px;
    }

    .table-card {
        margin-left: -18px;
        margin-right: -18px;
        border-left: 0;
        border-right: 0;
    }

    .portal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .portal-footer-inner {
        flex-direction: column;
        gap: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}


/* --- Security hardening & system check v1 --- */
.system-check-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 36px 0 28px;
}
.system-check-count {
    padding: 20px;
    border: 1px solid #d0c9bb;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.system-check-count span {
    display: block;
    color: #756f65;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.system-check-count strong {
    display: block;
    margin-top: 9px;
    font-family: Georgia, serif;
    font-size: 38px;
    font-weight: 500;
}
.system-check-count-critical {
    border-color: #d7a09a;
    background: #fff5f2;
}
.system-check-count-warning {
    border-color: #d9c78d;
    background: #fffaf0;
}
.system-check-count-ok {
    border-color: #c7d5c1;
    background: #f6faf4;
}
.system-check-group {
    margin-top: 56px;
}
.system-check-list {
    border: 1px solid #d3ccbe;
    background: #fffdfa;
}
.system-check-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    gap: 20px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #ebe6dc;
}
.system-check-row:last-child {
    border-bottom: 0;
}
.system-check-main {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}
.system-check-main strong {
    display: block;
}
.system-check-main p {
    margin: 5px 0 0;
    color: #716b61;
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.system-check-badge {
    flex: 0 0 auto;
    min-width: 68px;
    padding: 5px 7px;
    border-radius: 999px;
    background: #efede7;
    color: #68635a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
    text-align: center;
}
.system-check-row-ok .system-check-badge {
    background: #edf5ea;
    color: #356031;
}
.system-check-row-warning .system-check-badge {
    background: #fff2ce;
    color: #785b16;
}
.system-check-row-critical .system-check-badge {
    background: #ffe6e1;
    color: #8b342c;
}
.system-check-row-info .system-check-badge {
    background: #edf0f2;
    color: #50616a;
}
.system-check-recommendation {
    color: #5f5a51;
    font-size: 13px;
    line-height: 1.55;
}
.system-check-row-critical .system-check-recommendation {
    color: #7d3b34;
    font-weight: 650;
}
@media (max-width: 900px) {
    .system-check-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .system-check-row {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 520px) {
    .system-check-summary {
        grid-template-columns: 1fr;
    }
}


/* --- Multiple administrator management v1 --- */
.admin-management-note,
.admin-permission-warning {
    margin: 0 0 26px;
    padding: 17px 19px;
    border-left: 3px solid var(--gold);
    background: #f8f4e9;
}
.admin-management-note strong,
.admin-permission-warning strong {
    display: block;
    margin-bottom: 6px;
}
.admin-management-note p,
.admin-permission-warning p {
    margin: 0;
    color: #696258;
    line-height: 1.6;
}
.admin-permission-warning {
    margin-top: 30px;
    margin-bottom: 0;
}
.admin-account-table {
    min-width: 980px;
}
.admin-self-badge {
    display: inline-flex;
    margin-left: 7px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #eee6d0;
    color: #725820;
    font-size: 10px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-weight: 900;
    vertical-align: middle;
}
.admin-account-actions {
    min-width: 210px;
}
.admin-account-actions .inline-form {
    display: block;
    margin: 0 0 8px;
}
.admin-account-actions .link-button {
    color: #69531e;
    text-decoration: underline;
}
.admin-delete-details {
    margin-top: 7px;
}
.admin-delete-details > summary {
    cursor: pointer;
    color: #963d34;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
}
.admin-delete-form {
    width: min(390px, 70vw);
    margin-top: 10px;
    padding: 15px;
    border: 1px solid #d7a099;
    background: #fff5f2;
}
.admin-delete-form p {
    margin: 0 0 12px;
    color: #6e514c;
    font-size: 12px;
    line-height: 1.55;
}
.admin-delete-form label {
    display: block;
    margin: 12px 0 6px;
    color: #5c4541;
    font-size: 12px;
}
.admin-delete-form label strong {
    display: block;
    margin-top: 4px;
    color: #8b3027;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.admin-delete-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid #c98e87;
    background: #fff;
    color: #221a19;
}
.admin-delete-form .purge-button {
    margin-top: 12px;
}


/* --- Portal Backup Manager v1 --- */
.backup-create-button {
    width: auto;
    min-width: 220px;
    margin: 0;
}
.backup-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 36px 0 18px;
}
.backup-summary-grid article {
    padding: 22px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.backup-summary-grid span {
    display: block;
    min-height: 30px;
    color: #756f65;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.backup-summary-grid strong {
    display: block;
    margin-top: 7px;
    font-family: Georgia, serif;
    font-size: 30px;
    font-weight: 500;
}
.backup-info-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin-top: 18px;
    border: 1px solid #cec7b9;
    background: #cec7b9;
}
.backup-info-card > div {
    padding: 22px;
    background: #fffdfa;
}
.backup-info-card strong {
    display: block;
    margin: 7px 0 8px;
    font-size: 18px;
}
.backup-info-card p {
    margin: 0;
    color: #6d675d;
    line-height: 1.6;
}
.backup-info-card code {
    padding: 2px 4px;
    background: #eee9df;
    font-size: 12px;
}
.backup-local-warning {
    margin-top: 18px;
    padding: 17px 19px;
    border-left: 3px solid #b8923d;
    background: #f8f4e9;
}
.backup-local-warning strong {
    display: block;
    margin-bottom: 6px;
}
.backup-local-warning p {
    margin: 0;
    color: #696258;
    line-height: 1.6;
}
.backup-table {
    min-width: 960px;
}
.backup-actions {
    min-width: 220px;
}
.backup-delete-details {
    display: block;
    margin-top: 9px;
}
.backup-delete-details > summary {
    cursor: pointer;
    color: #963d34;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
}
.backup-delete-form {
    width: min(390px, 70vw);
    margin-top: 10px;
    padding: 15px;
    border: 1px solid #d7a099;
    background: #fff5f2;
}
.backup-delete-form label {
    display: block;
    margin: 10px 0 6px;
    color: #5c4541;
    font-size: 12px;
}
.backup-delete-form label strong {
    display: block;
    margin-top: 4px;
    color: #8b3027;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.backup-delete-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid #c98e87;
    background: #fff;
    color: #221a19;
}
.backup-delete-form .purge-button {
    margin-top: 12px;
}
@media (max-width: 850px) {
    .backup-summary-grid,
    .backup-info-card {
        grid-template-columns: 1fr;
    }
    .backup-create-button {
        width: 100%;
    }
}


/* --- Backup restore v1 --- */
.backup-restore-details {
    display: block;
    margin-top: 9px;
}
.backup-restore-details > summary {
    cursor: pointer;
    color: #6c561f;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
}
.backup-restore-form {
    width: min(440px, 74vw);
    margin-top: 10px;
    padding: 16px;
    border: 1px solid #cdb66f;
    background: #fffaed;
}
.backup-restore-form label {
    display: block;
    margin: 12px 0 6px;
    color: #514a39;
    font-size: 12px;
}
.backup-restore-form label strong {
    display: block;
    margin-top: 4px;
    color: #725715;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.backup-restore-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid #bca45e;
    background: #fff;
    color: #201d17;
}
.backup-restore-warning {
    padding: 12px 13px;
    border-left: 3px solid #b8923d;
    background: #f5eedb;
}
.backup-restore-warning strong {
    display: block;
    margin-bottom: 5px;
}
.backup-restore-warning p {
    margin: 0;
    color: #665d49;
    font-size: 12px;
    line-height: 1.55;
}
.backup-restore-button {
    width: 100%;
    margin-top: 13px;
    border-color: #9a7726;
    background: #b28b32;
    color: #111;
}
.backup-restore-button:hover {
    background: #c19a3a;
}
.backup-restore-info {
    margin-top: 12px;
    padding: 17px 19px;
    border-left: 3px solid #8c7440;
    background: #f4f0e6;
}
.backup-restore-info strong {
    display: block;
    margin-bottom: 6px;
}
.backup-restore-info p {
    margin: 0;
    color: #696258;
    line-height: 1.6;
}


/* =========================================================
   Messaging v1
   ========================================================= */
.customer-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.message-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 42px;
}
.message-category-grid-admin {
    grid-template-columns: 1fr;
    margin-top: 0;
}
.message-category-card {
    display: block;
    padding: 22px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    color: #1d1b17;
    text-decoration: none;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
a.message-category-card:hover,
.message-category-card.is-selected {
    border-color: #b48f38;
    transform: translateY(-1px);
}
.message-category-card strong {
    display: block;
    margin: 8px 0 6px;
    font-family: Georgia, serif;
    font-size: 28px;
    font-weight: 500;
}
.message-category-card small {
    color: #746e63;
}
.message-filter-reset {
    margin: 16px 0 0;
}
.message-filter-reset a {
    color: #705922;
    font-weight: 800;
}

.message-thread-list {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}
.message-thread-card {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 26px;
    align-items: center;
    padding: 23px 24px;
    border: 1px solid #d0c9bc;
    background: #fffdfa;
    color: #1d1b17;
    text-decoration: none;
    box-shadow: var(--ka-shadow, 0 10px 26px rgba(0,0,0,.04));
}
.message-thread-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
}
.message-thread-card.is-unread::before {
    background: #b58a2c;
}
.message-thread-card.is-unread {
    background: #fffaf0;
}
.message-thread-card:hover {
    border-color: #b99d60;
    transform: translateY(-1px);
}
.message-thread-main {
    min-width: 0;
}
.message-thread-main h2 {
    margin: 8px 0;
    font-family: Georgia, serif;
    font-size: 27px;
    font-weight: 500;
}
.message-thread-main p,
.message-preview {
    display: block;
    margin: 0;
    color: #69645b;
    line-height: 1.55;
}
.message-thread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}
.message-category-pill,
.message-new-pill,
.message-author-role {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.message-category-pill {
    background: #f0eadc;
    color: #675322;
}
.message-new-pill {
    background: #ead7a6;
    color: #5e4713;
}
.message-author-role {
    background: #efede7;
    color: #69645b;
}
.message-thread-side {
    flex: 0 0 150px;
    color: #777168;
    font-size: 12px;
    line-height: 1.55;
    text-align: right;
}
.message-thread-side span,
.message-thread-side small,
.message-thread-side strong {
    display: block;
}
.message-thread-side strong {
    margin-top: 7px;
    color: #725a21;
}

.message-thread-heading {
    margin-top: 22px;
}
.message-thread-created {
    color: #756f65;
}
.message-conversation {
    display: grid;
    gap: 16px;
    margin-top: 38px;
}
.message-post {
    max-width: 900px;
    padding: 22px 24px;
    border: 1px solid #d2cbbc;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 10px 28px rgba(0,0,0,.04));
}
.message-post-admin {
    border-left: 3px solid #b38a31;
}
.message-post-customer,
.message-post-own {
    margin-left: auto;
    border-right: 3px solid #807968;
    background: #f8f6f0;
}
.message-post-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid #ece7dc;
}
.message-post-head strong {
    display: block;
}
.message-post-head span {
    display: block;
    margin-top: 3px;
    color: #777168;
    font-size: 11px;
}
.message-post-body {
    padding-top: 17px;
    color: #34312b;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.message-post-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.message-post-actions a,
.message-post-actions button {
    font-size: 12px;
}
.message-post-actions form {
    margin: 0;
}
.message-attachments {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}
.message-attachments a {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid #d9d2c5;
    background: #f5f1e7;
    color: #342e21;
    text-decoration: none;
}
.message-attachments a:hover {
    border-color: #b99b55;
}
.message-attachments small {
    color: #777168;
}

.message-reply-section {
    max-width: 900px;
}
.message-reply-form {
    margin-top: 0;
}
.message-email-notice {
    margin-top: 22px;
    padding: 15px 16px;
    border-left: 3px solid #b8923d;
    background: #f8f4e8;
}
.message-email-notice strong {
    display: block;
    margin-bottom: 5px;
}
.message-email-notice p {
    margin: 0;
    color: #696258;
    font-size: 12px;
    line-height: 1.6;
}
.message-admin-create-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
}
.compact-empty-state {
    padding: 20px;
}
.message-thread-delete-details > summary {
    cursor: pointer;
    color: #953d34;
    font-size: 12px;
    font-weight: 800;
    text-decoration: underline;
}
.message-thread-delete-form {
    width: min(410px, 75vw);
    margin-top: 10px;
    padding: 15px;
    border: 1px solid #d7a099;
    background: #fff5f2;
}
.message-thread-delete-form label {
    display: block;
    margin: 10px 0 6px;
    font-size: 12px;
}
.message-thread-delete-form label strong {
    display: block;
    margin-top: 4px;
    color: #8b3027;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.message-thread-delete-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid #c98e87;
    background: #fff;
}
.message-empty-state {
    margin-top: 42px;
}

@media (max-width: 900px) {
    .message-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .message-admin-create-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 680px) {
    .message-category-grid {
        grid-template-columns: 1fr;
    }
    .message-thread-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .message-thread-side {
        flex: 0 0 auto;
        text-align: left;
    }
    .message-post,
    .message-post-customer,
    .message-post-own {
        max-width: 100%;
        margin-left: 0;
    }
    .message-post-head {
        flex-direction: column;
    }
    .customer-heading-actions {
        width: 100%;
    }
    .customer-heading-actions .action-link {
        flex: 1 1 180px;
        justify-content: center;
    }
}


/* =========================================================
   K-Analytics Branding v1
   ========================================================= */
.brand-logo-image {
    display: block;
    width: min(100%, 270px);
    height: auto;
    margin: 0 0 42px;
    object-fit: contain;
}

.topbar-logo-mark {
    display: block;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.topbar-brand {
    min-height: 42px;
}

.topbar-brand:hover .topbar-logo-mark {
    transform: scale(1.025);
}

@media (max-width: 720px) {
    .topbar-logo-mark {
        width: 36px;
        height: 36px;
    }

    .brand-logo-image {
        width: min(100%, 230px);
        margin-bottom: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-logo-mark {
        transition: none !important;
    }
}


/* =========================================================
   Admin 2FA & Maintenance v1
   ========================================================= */
.two-factor-setup-card {
    width: min(100%, 560px);
}
.two-factor-secret-box {
    margin: 22px 0 14px;
    padding: 18px;
    border: 1px solid rgba(213,173,77,.42);
    background: rgba(213,173,77,.07);
}
.two-factor-secret-box span,
.two-factor-secret-box small {
    display: block;
}
.two-factor-secret-box span {
    color: var(--gold);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.two-factor-secret-box strong {
    display: block;
    margin: 9px 0;
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 18px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.two-factor-secret-box small {
    color: #aaa69c;
}
.two-factor-uri-details {
    margin: 14px 0 24px;
}
.two-factor-uri-details summary {
    cursor: pointer;
    color: #d8bd72;
    font-size: 12px;
}
.two-factor-uri-details code {
    display: block;
    margin-top: 10px;
    padding: 12px;
    background: #151515;
    color: #cfc9bc;
    font-size: 11px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.recovery-code-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 20px 0;
}
.recovery-code-grid code {
    display: block;
    padding: 11px 12px;
    border: 1px solid rgba(213,173,77,.35);
    background: #151515;
    color: #f0d58d;
    font-size: 14px;
    text-align: center;
}
.two-factor-continue {
    margin-top: 18px;
}

.maintenance-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 38px 0 30px;
}
.maintenance-kpi {
    min-height: 150px;
    padding: 21px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.maintenance-kpi span,
.maintenance-kpi small {
    display: block;
}
.maintenance-kpi span {
    color: #756f65;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.maintenance-kpi strong {
    display: block;
    margin: 11px 0 8px;
    font-family: Georgia, serif;
    font-size: 29px;
    font-weight: 500;
    line-height: 1.15;
}
.maintenance-kpi small {
    color: #736d63;
}
.maintenance-kpi-ok {
    border-color: #c4d3bd;
    background: #f6faf3;
}
.maintenance-kpi-attention {
    border-color: #dbc783;
    background: #fff9e9;
}
.maintenance-panel {
    margin-top: 22px;
    padding: 24px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.maintenance-panel h2 {
    margin: 0 0 12px;
    font-family: Georgia, serif;
    font-size: 34px;
    font-weight: 500;
}
.maintenance-panel > p:not(.eyebrow) {
    color: #696258;
    line-height: 1.65;
}
.maintenance-check-list {
    border: 1px solid #ded7ca;
}
.maintenance-check-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border-bottom: 1px solid #ebe6dc;
}
.maintenance-check-row:last-child {
    border-bottom: 0;
}
.maintenance-check-state span {
    display: inline-flex;
    min-width: 58px;
    justify-content: center;
    padding: 5px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}
.maintenance-check-ok .maintenance-check-state span {
    background: #edf5ea;
    color: #356031;
}
.maintenance-check-attention .maintenance-check-state span {
    background: #fff0c8;
    color: #775914;
}
.maintenance-check-row strong {
    display: block;
}
.maintenance-check-row p {
    margin: 5px 0 0;
    color: #6f695f;
    font-size: 13px;
}
.maintenance-check-row > a {
    color: #6c5420;
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}
.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.maintenance-definition-list {
    margin: 18px 0 0;
}
.maintenance-definition-list > div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid #ebe6dc;
}
.maintenance-definition-list > div:last-child {
    border-bottom: 0;
}
.maintenance-definition-list dt {
    color: #6e675d;
}
.maintenance-definition-list dd {
    margin: 0;
    font-weight: 800;
    text-align: right;
}
.maintenance-text-ok {
    color: #356031;
}
.maintenance-text-danger {
    color: #8b342c;
}
.maintenance-rhythm p {
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid #ebe6dc;
    color: #696258;
    line-height: 1.55;
}
.maintenance-rhythm p:last-child {
    border-bottom: 0;
}
.light-secret-box {
    background: #f8f4e8;
}
.light-secret-box strong {
    color: #322a19;
}
.light-secret-box small {
    color: #6e675d;
}
.light-uri-details code {
    background: #f2eee5;
    color: #4f493f;
}
.light-recovery-codes code {
    background: #f2eee5;
    color: #5f4b1c;
    border-color: #d1c28f;
}
.recovery-panel {
    border-color: #c5d3bd;
    background: #f6faf3;
}
.maintenance-update-note {
    border-left: 3px solid var(--gold);
}

@media (max-width: 960px) {
    .maintenance-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .maintenance-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 620px) {
    .maintenance-kpi-grid {
        grid-template-columns: 1fr;
    }
    .maintenance-check-row {
        grid-template-columns: 1fr;
        gap: 9px;
    }
    .recovery-code-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   Admin Notification Center v1
   ========================================================= */
.notification-nav-link {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
}
.notification-nav-badge {
    display: inline-flex;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #c89d38;
    color: #111;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}
.notification-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 36px 0 22px;
}
.notification-kpi {
    display: block;
    padding: 20px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    color: #1f1c17;
    text-decoration: none;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.notification-kpi:hover { border-color: #bda05f; transform: translateY(-1px); }
.notification-kpi span,
.notification-kpi small { display: block; }
.notification-kpi span {
    color: #756f65;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.notification-kpi strong {
    display: block;
    margin: 8px 0 5px;
    font-family: Georgia, serif;
    font-size: 36px;
    font-weight: 500;
}
.notification-kpi small { color: #756f65; }
.notification-kpi-attention { border-color: #d8bf77; background: #fff9eb; }
.notification-kpi-danger { border-color: #d6a09a; background: #fff5f2; }
.notification-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 24px;
}
.notification-filters a {
    padding: 8px 11px;
    border: 1px solid #d1cabc;
    background: #fffdfa;
    color: #5d574e;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}
.notification-filters a.is-active {
    border-color: #a88431;
    background: #f4ecd6;
    color: #4e3d17;
}
.notification-list {
    display: grid;
    gap: 10px;
}
.notification-row {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 19px 20px;
    border: 1px solid #d2cbbf;
    background: #fffdfa;
}
.notification-row.is-unread {
    border-left: 4px solid #b58a2c;
    background: #fffbf0;
}
.notification-row-danger { border-color: #d7aaa4; }
.notification-row-warning { border-color: #d8c382; }
.notification-icon {
    display: flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #efe9da;
    color: #6b5521;
    font-family: Georgia, serif;
    font-size: 23px;
}
.notification-row-danger .notification-icon,
.notification-row-warning .notification-icon {
    background: #fff0df;
    color: #8b4d26;
}
.notification-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: #777168;
    font-size: 11px;
}
.notification-content h2 {
    margin: 8px 0 6px;
    font-family: Georgia, serif;
    font-size: 24px;
    font-weight: 500;
}
.notification-content p {
    margin: 0;
    color: #625d54;
    line-height: 1.55;
}
.notification-customer {
    display: block;
    margin-top: 8px;
    color: #7a7368;
}
.notification-actions form { margin: 0; }
.notification-actions button {
    width: auto;
    min-width: 100px;
    margin: 0;
    padding: 9px 12px;
    font-size: 11px;
}
.notification-read-label {
    color: #817a70;
    font-size: 11px;
}
.notification-empty-state { margin-top: 24px; }

.admin-operations-panel {
    margin: 34px 0 26px;
    padding: 24px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.admin-operations-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}
.admin-operation-item {
    padding: 16px;
    border: 1px solid #ddd6c9;
    background: #faf8f3;
    color: #201d18;
    text-decoration: none;
}
.admin-operation-item:hover { border-color: #bda05f; }
.admin-operation-item span,
.admin-operation-item small { display: block; }
.admin-operation-item span {
    color: #736d62;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.admin-operation-item strong {
    display: block;
    margin: 7px 0 4px;
    font-family: Georgia, serif;
    font-size: 27px;
    font-weight: 500;
}
.admin-operation-item small { color: #777168; }
.admin-operation-item.is-danger { border-color: #d7aaa4; background: #fff6f3; }
.admin-operation-item.is-warning { border-color: #d9c47f; background: #fff9e9; }
.admin-operation-item.is-ok { border-color: #c6d4bf; background: #f6faf3; }
.admin-recent-notifications {
    display: grid;
    gap: 7px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e7e1d6;
}
.admin-recent-notification {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    background: #f8f5ee;
    color: #2d2922;
    text-decoration: none;
}
.admin-recent-notification.is-unread { border-left: 3px solid #b58a2c; }
.admin-recent-notification strong,
.admin-recent-notification small { display: block; }
.admin-recent-notification small { margin-top: 3px; color: #777168; }
.admin-quick-action-attention { border-color: #c6a85e !important; background: #fff9e9 !important; }

@media (max-width: 960px) {
    .notification-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-operations-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .notification-kpi-grid,
    .admin-operations-grid { grid-template-columns: 1fr; }
    .notification-row { grid-template-columns: 40px minmax(0, 1fr); }
    .notification-actions { grid-column: 2; }
}


/* =========================================================
   Customer account & session management v1
   ========================================================= */
.account-page {
    padding-bottom: 70px;
}
.account-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 38px 0 28px;
}
.account-summary-grid article {
    min-height: 135px;
    padding: 20px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.account-summary-grid span {
    display: block;
    color: #756f65;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.account-summary-grid strong {
    display: block;
    margin-top: 10px;
    font-family: Georgia, serif;
    font-size: 24px;
    font-weight: 500;
    overflow-wrap: anywhere;
}
.account-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.account-panel {
    padding: 25px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 12px 30px rgba(0,0,0,.05));
}
.account-panel h2 {
    margin: 0 0 10px;
    font-family: Georgia, serif;
    font-size: 34px;
    font-weight: 500;
}
.account-panel > p:not(.eyebrow) {
    color: #6c665c;
    line-height: 1.65;
}
.account-session-list {
    display: grid;
    gap: 8px;
    margin: 20px 0 24px;
}
.account-session-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid #ddd6c9;
    background: #faf8f3;
}
.account-session-row.is-current {
    border-color: #c2d0bb;
    background: #f4f9f1;
}
.account-session-row strong,
.account-session-row small {
    display: block;
}
.account-session-row small {
    margin-top: 4px;
    color: #777168;
    font-size: 11px;
}
.account-session-row > span {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    background: #e7f0e3;
    color: #356031;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}
.account-revoke-form {
    margin-top: 16px;
    padding-top: 18px;
    border-top: 1px solid #e5dfd4;
}
.account-security-note {
    margin-top: 18px;
    padding: 18px 20px;
    border-left: 3px solid #b8923d;
    background: #f8f4e9;
}
.account-security-note strong {
    display: block;
    margin-bottom: 6px;
}
.account-security-note p {
    margin: 0;
    color: #696258;
    line-height: 1.6;
}
@media (max-width: 980px) {
    .account-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .account-columns {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 580px) {
    .account-summary-grid {
        grid-template-columns: 1fr;
    }
    .account-session-row {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* =========================================================
   Message workflow & global document search v1
   ========================================================= */
.workflow-filter-panel {
    margin: 30px 0 28px;
    padding: 20px;
    border: 1px solid #cec7b9;
    background: #fffdfa;
    box-shadow: var(--ka-shadow, 0 10px 28px rgba(0,0,0,.04));
}
.workflow-filter-panel-compact { margin-top: 18px; }
.workflow-filter-panel-customer { margin-top: 26px; }
.workflow-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.workflow-filter-grid-documents { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workflow-filter-wide { grid-column: span 2; }
.workflow-filter-panel label {
    display: block;
    margin: 0 0 6px;
    color: #655f55;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.workflow-filter-panel input,
.workflow-filter-panel select {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid #cfc8bb;
    background: #fff;
    color: #211f1a;
}
.workflow-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 16px;
}
.workflow-filter-actions button { width: auto; margin: 0; min-width: 120px; }
.workflow-filter-actions a { color: #6c5420; font-size: 12px; font-weight: 800; }
.workflow-filter-actions span { margin-left: auto; color: #756f65; font-size: 12px; }
.workflow-empty-state { margin-top: 28px; }
.workflow-pagination {
    display: flex;
    justify-content: center;
    gap: 22px;
    align-items: center;
    margin: 22px 0;
    font-size: 13px;
}
.workflow-pagination a { color: #6b5420; font-weight: 850; }
.workflow-pagination span { color: #746e64; }
.message-status-pill,
.message-customer-reply-pill {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.message-status-open { background: #edf5ea; color: #356031; }
.message-status-done { background: #eceae5; color: #625e56; }
.message-customer-reply-pill { background: #f7e8c1; color: #715313; }
.message-thread-title-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.message-thread-admin-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.message-thread-admin-actions form { margin: 0; }
.message-done-note {
    max-width: 900px;
    margin: 24px 0 0;
    padding: 15px 17px;
    border-left: 3px solid #8a8273;
    background: #f1efe9;
}
.message-done-note strong { display: block; margin-bottom: 5px; }
.message-done-note p { margin: 0; color: #686258; line-height: 1.55; }
.workflow-document-table { min-width: 1180px; }
.workflow-document-actions { min-width: 150px; }
.workflow-document-actions a { display: block; margin: 4px 0; }
@media (max-width: 1050px) {
    .workflow-filter-grid,
    .workflow-filter-grid-documents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
    .workflow-filter-grid,
    .workflow-filter-grid-documents { grid-template-columns: 1fr; }
    .workflow-filter-wide { grid-column: auto; }
    .workflow-filter-actions span { width: 100%; margin-left: 0; }
    .message-thread-admin-actions { align-items: stretch; width: 100%; }
}


/* =========================================================
   Production Diagnostics v1
   ========================================================= */
.diagnostic-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.diagnostic-summary {
    margin-top: 36px;
}
.diagnostic-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}
.diagnostic-action-card {
    margin-top: 0;
}
.diagnostic-action-card h2 {
    font-size: 30px;
}
.diagnostic-action-card form:not(.diagnostic-upload-form) {
    margin-top: 20px;
}
.diagnostic-action-card button {
    width: auto;
    min-width: 180px;
}
.diagnostic-upload-form {
    margin-top: 18px;
}
.diagnostic-upload-form input[type="file"] {
    margin-bottom: 14px;
}
.diagnostic-group {
    margin-top: 48px;
}
.system-check-row-critical {
    border-left: 3px solid #a94a41;
}
.system-check-row-warning {
    border-left: 3px solid #b8923d;
}
.system-check-row-ok {
    border-left: 3px solid #6d8b64;
}
@media (max-width: 800px) {
    .diagnostic-action-grid {
        grid-template-columns: 1fr;
    }
    .diagnostic-heading-actions {
        width: 100%;
    }
    .diagnostic-heading-actions .action-link {
        flex: 1 1 180px;
        justify-content: center;
    }
}

/* Portal gateway --------------------------------------------------------- */
.gateway-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(196, 157, 70, 0.08), transparent 38rem),
        #090909;
    color: #ffffff;
}

.gateway-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.gateway-card {
    width: min(100%, 430px);
    padding: 42px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(17, 17, 17, 0.96);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.gateway-logo {
    display: block;
    width: min(100%, 280px);
    height: auto;
    margin: 0 auto 34px;
}

.gateway-card form {
    display: grid;
    gap: 12px;
}

.gateway-label {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.gateway-card input[type="password"] {
    width: 100%;
    min-height: 52px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: #101010;
    color: #ffffff;
    padding: 0 15px;
    font: inherit;
}

.gateway-card input[type="password"]:focus {
    outline: 2px solid rgba(211, 174, 86, 0.44);
    outline-offset: 2px;
    border-color: rgba(211, 174, 86, 0.7);
}

.gateway-card button {
    min-height: 50px;
    margin-top: 6px;
}

.gateway-alert {
    margin-bottom: 22px;
}

.gateway-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.gateway-status.is-enabled {
    background: rgba(61, 153, 112, 0.12);
    border: 1px solid rgba(61, 153, 112, 0.32);
}

.gateway-status.is-disabled {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.settings-subpanel {
    min-width: 0;
}

@media (max-width: 640px) {
    .gateway-card {
        padding: 30px 22px;
        border-radius: 18px;
    }

    .gateway-logo {
        width: min(100%, 230px);
        margin-bottom: 28px;
    }
}

