:root {
    --navy: #163a5f;
    --navy-dark: #0f2d4a;
    --navy-light: #eaf1f7;
    --navy-soft: #f2f6fa;
    --ink: #182431;
    --muted: #647383;
    --muted-dark: #4a5968;
    --line: #dce3e9;
    --line-strong: #c7d1da;
    --surface: #ffffff;
    --background: #f4f6f8;
    --background-warm: #faf9f6;
    --success: #197449;
    --success-bg: #eaf6ef;
    --warning: #9a6512;
    --warning-bg: #fff5df;
    --danger: #b33b3b;
    --danger-bg: #fceeee;
    --info: #2f678f;
    --shadow-sm: 0 1px 2px rgba(15, 45, 74, 0.05);
    --shadow-md: 0 12px 35px rgba(15, 45, 74, 0.08);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --header-height: 74px;
    --content-width: 1220px;
    --transition: 160ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--background);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    color: inherit;
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3,
strong {
    letter-spacing: -0.015em;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    line-height: 1.16;
    color: var(--navy-dark);
}

h2 {
    margin-bottom: 7px;
    font-size: 1.22rem;
    line-height: 1.3;
    color: var(--navy-dark);
}

h3 {
    margin-bottom: 6px;
    font-size: 1.02rem;
    color: var(--navy-dark);
}

.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;
}

.skip-link {
    position: fixed;
    z-index: 9999;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--navy-dark);
    transform: translateY(-150%);
    transition: transform var(--transition);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid rgba(22, 58, 95, 0.28);
    outline-offset: 3px;
}

.page-main {
    width: min(100% - 40px, var(--content-width));
    margin: 0 auto;
    padding: 42px 0 56px;
}

.page-stack {
    display: grid;
    gap: 24px;
}

.page-stack--narrow {
    width: min(100%, 920px);
    margin-inline: auto;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--info);
    font-size: 0.73rem;
    font-weight: 760;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.eyebrow--light {
    color: #bfd3e4;
}

/* Header */
.site-header {
    position: sticky;
    z-index: 100;
    top: 0;
    min-height: var(--header-height);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    width: min(100% - 40px, var(--content-width));
    min-height: var(--header-height);
    margin: 0 auto;
    align-items: center;
    gap: 32px;
}

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    display: inline-grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: var(--navy);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-copy strong {
    color: var(--navy-dark);
    font-size: 0.93rem;
}

.brand-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.7rem;
}

.header-menu {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.primary-nav a {
    position: relative;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    color: var(--muted-dark);
    font-size: 0.87rem;
    font-weight: 650;
    transition: color var(--transition), background var(--transition);
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
    color: var(--navy);
    background: var(--navy-soft);
}

.primary-nav a[aria-current="page"]::after {
    position: absolute;
    right: 14px;
    bottom: 3px;
    left: 14px;
    height: 2px;
    border-radius: 2px;
    background: var(--navy);
    content: "";
}

.account-menu {
    display: flex;
    align-items: center;
    gap: 9px;
}

.account-avatar {
    display: inline-grid;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid #cddbe6;
    border-radius: 50%;
    color: var(--navy);
    background: var(--navy-light);
    font-size: 0.8rem;
    font-weight: 800;
}

.account-copy {
    display: flex;
    max-width: 155px;
    margin-right: 5px;
    flex-direction: column;
    line-height: 1.25;
}

.account-copy strong,
.account-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-copy strong {
    font-size: 0.79rem;
}

.account-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.69rem;
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

.nav-toggle-lines {
    display: grid;
    width: 19px;
    margin: auto;
    gap: 4px;
}

.nav-toggle-lines i {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--navy);
    transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-lines i:first-child { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines i:last-child { transform: translateY(-6px) rotate(-45deg); }

/* Buttons */
.button {
    display: inline-flex;
    min-height: 42px;
    padding: 9px 16px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 720;
    line-height: 1.2;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: 0.68; cursor: wait; }

.button--primary {
    color: #fff;
    background: var(--navy);
    border-color: var(--navy);
    box-shadow: 0 5px 13px rgba(22, 58, 95, 0.14);
}

.button--primary:hover:not(:disabled) { background: var(--navy-dark); border-color: var(--navy-dark); }
.button--secondary { color: var(--navy); background: var(--navy-light); border-color: #cbdbe7; }
.button--secondary:hover:not(:disabled) { background: #dce9f3; border-color: #b8ccdc; }
.button--ghost { color: var(--muted-dark); background: #fff; border-color: var(--line); }
.button--ghost:hover:not(:disabled) { color: var(--navy); border-color: #aebfcd; background: var(--navy-soft); }
.button--danger-ghost { color: var(--danger); background: #fff; border-color: #eccaca; }
.button--danger-ghost:hover:not(:disabled) { background: var(--danger-bg); }
.button--success-ghost { color: var(--success); background: #fff; border-color: #bddfcf; }
.button--success-ghost:hover:not(:disabled) { background: var(--success-bg); }
.button--small { min-height: 34px; padding: 7px 11px; font-size: 0.77rem; }
.button--large { min-height: 49px; padding-inline: 21px; }
.button--block { width: 100%; }
.button-symbol { font-size: 1.1rem; font-weight: 400; line-height: 1; }
.button.is-loading::before {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: spin 650ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.auth-page { background: var(--background-warm); }
.auth-main { min-height: 100vh; }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, 0.82fr) minmax(480px, 1.18fr); }
.auth-intro {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 100%;
    padding: clamp(32px, 5vw, 70px);
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: var(--navy-dark);
}

.auth-intro::before,
.auth-intro::after {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.auth-intro::before { width: 420px; height: 420px; right: -240px; top: 12%; }
.auth-intro::after { width: 260px; height: 260px; right: -105px; top: 28%; }
.brand--light { position: relative; z-index: 1; align-self: flex-start; }
.brand--light .brand-mark { color: var(--navy); background: #fff; }
.brand--light .brand-copy strong { color: #fff; }
.brand--light .brand-copy small { color: #b9cad8; }
.auth-intro-copy { position: relative; z-index: 1; max-width: 520px; margin: 80px 0; }
.auth-intro-copy h1 { max-width: 460px; margin-bottom: 18px; color: #fff; font-size: clamp(2.15rem, 5vw, 4rem); line-height: 1.05; }
.auth-intro-copy p { max-width: 490px; margin: 0; color: #ccd9e4; font-size: clamp(1rem, 1.5vw, 1.15rem); }
.auth-assurance { position: relative; z-index: 1; display: flex; max-width: 520px; padding-top: 25px; align-items: flex-start; gap: 13px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.assurance-mark { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 50%; color: #fff; font-weight: 800; }
.auth-assurance p { margin: 0; color: #b9cad8; font-size: 0.84rem; }
.auth-assurance strong { color: #fff; }
.auth-panel { display: flex; min-width: 0; padding: 48px clamp(24px, 7vw, 100px) 28px; flex-direction: column; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 430px; min-width: 0; }
.auth-card-heading { margin-bottom: 29px; }
.auth-card-heading h2 { margin-bottom: 9px; font-size: clamp(1.7rem, 3vw, 2.2rem); }
.auth-card-heading p { margin: 0; color: var(--muted); }
.auth-footer { margin: 45px 0 0; color: #8b96a1; font-size: 0.72rem; text-align: center; }
.auth-help { margin: 22px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.55; text-align: center; }

/* Forms */
.stack-form { display: grid; gap: 19px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.field label,
fieldset legend { color: var(--ink); font-size: 0.81rem; font-weight: 710; }
.field label span { color: var(--danger); }
.field input,
.field select,
.field textarea,
.compact-filter input,
.compact-filter select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field textarea { min-height: 86px; resize: vertical; }
.field select,
.compact-filter select { padding-right: 34px; cursor: pointer; }
.field input::placeholder,
.field textarea::placeholder,
.compact-filter input::placeholder { color: #98a3ae; }
.field input:hover,
.field select:hover,
.field textarea:hover,
.compact-filter input:hover,
.compact-filter select:hover { border-color: #9fb0bf; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.compact-filter input:focus,
.compact-filter select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(22, 58, 95, 0.11); }
.field [aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.field-error { color: var(--danger); font-size: 0.75rem; font-weight: 630; }
.field-hint { color: var(--muted); font-size: 0.73rem; }
.field--full { grid-column: 1 / -1; }
.field--span-two { grid-column: span 2; }
.input-action { position: relative; }
.input-action input { padding-right: 72px; }
.input-action-button { position: absolute; top: 50%; right: 7px; padding: 6px 8px; border: 0; border-radius: 6px; color: var(--navy); background: transparent; font-size: 0.74rem; font-weight: 750; cursor: pointer; transform: translateY(-50%); }
.input-action-button:hover { background: var(--navy-soft); }
.currency-input { position: relative; }
.currency-input > span { position: absolute; top: 50%; left: 13px; color: var(--navy); font-size: 1rem; font-weight: 760; transform: translateY(-50%); }
.currency-input input { padding-left: 33px; font-size: 1rem; font-weight: 720; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 20px; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.form-actions--end { justify-content: flex-end; }
.submit-feedback { margin: 0; padding: 11px 14px; border: 1px solid #d7a94b; border-radius: var(--radius-sm); color: #664814; background: #fff8e8; font-size: 0.82rem; }
.submit-feedback[hidden] { display: none; }
.form-alert { display: flex; padding: 13px 15px; align-items: flex-start; gap: 11px; border: 1px solid #edc6c6; border-radius: var(--radius-sm); color: #772f2f; background: var(--danger-bg); }
.form-alert > span { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--danger); font-size: 0.75rem; font-weight: 850; }
.form-alert strong { display: block; margin-bottom: 2px; font-size: 0.85rem; }
.form-alert p { margin: 0; font-size: 0.78rem; }

/* Page headings and cards */
.page-heading > p,
.page-heading > div > p { max-width: 700px; margin-bottom: 0; color: var(--muted); }
.page-heading--split { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.back-link { display: flex; width: max-content; margin-bottom: 20px; align-items: center; gap: 6px; color: var(--muted-dark); font-size: 0.79rem; font-weight: 680; }
.back-link:hover { color: var(--navy); }
.content-card,
.form-card,
.filter-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.content-card { overflow: hidden; }
.card-heading { padding: 21px 23px 18px; border-bottom: 1px solid var(--line); }
.card-heading h2,
.card-heading p { margin-bottom: 0; }
.card-heading p { margin-top: 4px; color: var(--muted); font-size: 0.81rem; }
.card-heading--split { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.text-link,
.icon-link { color: var(--navy); font-size: 0.8rem; font-weight: 740; }
.text-link:hover,
.icon-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat-card--featured { border-color: var(--navy); color: #fff; background: var(--navy); }
.stat-topline { display: flex; min-height: 23px; margin-bottom: 13px; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.stat-card--featured .stat-topline { color: #cfdae4; }
.stat-card > strong { display: block; overflow: hidden; color: var(--navy-dark); font-size: clamp(1.45rem, 2.2vw, 1.85rem); line-height: 1.18; text-overflow: ellipsis; white-space: nowrap; }
.stat-card--featured > strong { color: #fff; }
.stat-card > small { display: block; margin-top: 8px; color: var(--muted); font-size: 0.72rem; }
.stat-card--featured > small { color: #bfd0de; }
.stat-icon { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: rgba(255, 255, 255, 0.12); font-size: 0.78rem; }
.stat-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info); box-shadow: 0 0 0 4px var(--navy-light); }
.stat-dot--success { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.stat-dot--warning { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td { padding: 15px 18px; border-bottom: 1px solid #e7ebef; text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); background: #fafbfc; font-size: 0.69rem; font-weight: 760; letter-spacing: 0.055em; text-transform: uppercase; white-space: nowrap; }
.data-table td { color: var(--muted-dark); font-size: 0.8rem; }
.data-table td > strong { color: var(--ink); font-size: 0.82rem; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfd; }
.cell-meta { display: block; max-width: 240px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.table-action { text-align: right !important; white-space: nowrap; }
.status-badge { display: inline-flex; min-height: 26px; padding: 4px 9px; align-items: center; gap: 6px; border: 1px solid #d5dde4; border-radius: 999px; color: var(--muted-dark); background: #f4f6f7; font-size: 0.68rem; font-weight: 750; line-height: 1; white-space: nowrap; }
.status-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #84919c; }
.status-badge[data-status="SUCCESS"],
.status-badge[data-status="SUCCEEDED"],
.status-badge[data-status="PAID"],
.status-badge[data-status="COMPLETED"],
.status-badge[data-status="APPROVED"],
.status-badge[data-status="ACTIVE"] { color: var(--success); border-color: #c5e3d3; background: var(--success-bg); }
.status-badge[data-status="SUCCESS"] > span,
.status-badge[data-status="SUCCEEDED"] > span,
.status-badge[data-status="PAID"] > span,
.status-badge[data-status="COMPLETED"] > span,
.status-badge[data-status="APPROVED"] > span,
.status-badge[data-status="ACTIVE"] > span { background: var(--success); }
.status-badge[data-status="PENDING"],
.status-badge[data-status="PROCESSING"],
.status-badge[data-status="CREATED"],
.status-badge[data-status="LINK_REQUESTED"],
.status-badge[data-status="AWAITING_CUSTOMER"],
.status-badge[data-status="VERIFYING"],
.status-badge[data-status="REVIEW_REQUIRED"] { color: var(--warning); border-color: #ead5a7; background: var(--warning-bg); }
.status-badge[data-status="PENDING"] > span,
.status-badge[data-status="PROCESSING"] > span,
.status-badge[data-status="CREATED"] > span,
.status-badge[data-status="LINK_REQUESTED"] > span,
.status-badge[data-status="AWAITING_CUSTOMER"] > span,
.status-badge[data-status="VERIFYING"] > span,
.status-badge[data-status="REVIEW_REQUIRED"] > span { background: var(--warning); }
.status-badge[data-status="AUTHORIZED"] { color: var(--info); border-color: #c8dbea; background: var(--navy-light); }
.status-badge[data-status="AUTHORIZED"] > span { background: var(--info); }
.status-badge[data-status="FAILED"],
.status-badge[data-status="FAILURE"],
.status-badge[data-status="DECLINED"],
.status-badge[data-status="CANCELLED"],
.status-badge[data-status="CANCELED"],
.status-badge[data-status="ERROR"],
.status-badge[data-status="INACTIVE"] { color: var(--danger); border-color: #efcaca; background: var(--danger-bg); }
.status-badge[data-status="FAILED"] > span,
.status-badge[data-status="FAILURE"] > span,
.status-badge[data-status="DECLINED"] > span,
.status-badge[data-status="CANCELLED"] > span,
.status-badge[data-status="CANCELED"] > span,
.status-badge[data-status="ERROR"] > span,
.status-badge[data-status="INACTIVE"] > span { background: var(--danger); }
.status-badge--large { min-height: 34px; padding: 7px 12px; font-size: 0.77rem; }
.pagination { display: flex; padding: 17px 20px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
.pagination a { color: var(--navy); font-weight: 720; }
.pagination .is-disabled { color: #adb5bd; }

/* Empty, flash, safety */
.empty-state { display: flex; min-height: 285px; padding: 38px 24px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state--compact { min-height: 220px; }
.empty-state p { max-width: 450px; margin-bottom: 17px; color: var(--muted); font-size: 0.82rem; }
.empty-symbol { display: grid; width: 46px; height: 46px; margin-bottom: 15px; place-items: center; border: 1px solid #ccdae5; border-radius: 50%; color: var(--navy); background: var(--navy-light); font-size: 1.1rem; font-weight: 800; }
.info-strip,
.secure-payment-note { display: flex; padding: 17px 19px; align-items: flex-start; gap: 13px; border: 1px solid #c9dce9; border-radius: var(--radius); color: var(--navy-dark); background: var(--navy-light); }
.info-strip-mark,
.secure-note-mark { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--navy); font-size: 0.75rem; font-weight: 850; }
.info-strip strong,
.secure-payment-note strong { font-size: 0.84rem; }
.info-strip p,
.secure-payment-note p { margin: 2px 0 0; color: var(--muted-dark); font-size: 0.77rem; }
.flash { display: flex; margin-bottom: 22px; padding: 13px 15px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); }
.flash p { flex: 1; margin: 0; font-size: 0.81rem; font-weight: 630; }
.flash-indicator { width: 9px; height: 9px; border-radius: 50%; background: var(--info); }
.flash--success { color: var(--success); border-color: #c4dfd0; background: var(--success-bg); }
.flash--success .flash-indicator { background: var(--success); }
.flash--error { color: var(--danger); border-color: #ecc8c8; background: var(--danger-bg); }
.flash--error .flash-indicator { background: var(--danger); }
.flash--warning { color: var(--warning); border-color: #ead5aa; background: var(--warning-bg); }
.flash--warning .flash-indicator { background: var(--warning); }
.flash-close { width: 29px; height: 29px; border: 0; border-radius: 50%; color: currentColor; background: transparent; font-size: 1.2rem; cursor: pointer; }
.flash-close:hover { background: rgba(0, 0, 0, 0.05); }

/* Payment form and details */
.payment-form { display: grid; gap: 20px; }
.form-card { padding: 24px; }
.form-card-heading { display: flex; margin-bottom: 24px; align-items: flex-start; gap: 13px; }
.form-card-heading h2,
.form-card-heading p { margin-bottom: 0; }
.form-card-heading p { margin-top: 3px; color: var(--muted); font-size: 0.78rem; }
.step-number { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: #fff; background: var(--navy); font-size: 0.76rem; font-weight: 800; }
.detail-heading { align-items: center; }
.detail-summary { display: grid; overflow: hidden; grid-template-columns: 1.15fr 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.detail-summary > div { padding: 21px 23px; border-right: 1px solid var(--line); }
.detail-summary > div:last-child { border-right: 0; }
.detail-summary span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.73rem; }
.detail-summary strong { color: var(--navy-dark); font-size: 1rem; }
.detail-summary > div:first-child strong { font-size: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.detail-card { align-self: start; }
.detail-list { display: grid; margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-list > div { min-width: 0; padding: 17px 20px; border-bottom: 1px solid #e9edf0; }
.detail-list > div:nth-last-child(-n + 2) { border-bottom: 0; }
.detail-list .detail-list--wide { grid-column: 1 / -1; }
.detail-list .detail-list--error { border-top: 1px solid #efcccc; color: var(--danger); background: var(--danger-bg); }
.detail-list dt { margin-bottom: 5px; color: var(--muted); font-size: 0.7rem; }
.detail-list dd { margin: 0; color: var(--ink); font-size: 0.8rem; font-weight: 630; }
.break-word { overflow-wrap: anywhere; }

/* Filters */
.filter-card { padding: 17px; }
.filter-form { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.75fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) auto; align-items: end; gap: 12px; }
.filter-actions { display: flex; gap: 7px; }
.filter-form .field { gap: 5px; }
.filter-form .field label { font-size: 0.72rem; }
.filter-form .field input,
.filter-form .field select { min-height: 41px; padding-block: 8px; font-size: 0.79rem; }

/* Admin */
.dashboard-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 17px; }
.activity-list,
.dealer-mini-list { display: grid; }
.activity-item { display: grid; padding: 15px 20px; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #e8ecef; }
.activity-item:last-child { border-bottom: 0; }
.activity-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.activity-mark[data-status="SUCCESS"],
.activity-mark[data-status="SUCCEEDED"],
.activity-mark[data-status="COMPLETED"],
.activity-mark[data-status="PAID"],
.activity-mark[data-status="APPROVED"] { background: var(--success); }
.activity-mark[data-status="FAILED"],
.activity-mark[data-status="FAILURE"],
.activity-mark[data-status="DECLINED"],
.activity-mark[data-status="CANCELLED"] { background: var(--danger); }
.activity-item > div { display: flex; min-width: 0; flex-direction: column; }
.activity-item strong { font-size: 0.79rem; }
.activity-item span,
.activity-item small { color: var(--muted); font-size: 0.68rem; }
.activity-value { align-items: flex-end; }
.dealer-mini-list article { display: grid; padding: 14px 19px; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid #e8ecef; }
.dealer-mini-list article:last-child { border-bottom: 0; }
.dealer-mini-list article > div { display: flex; min-width: 0; flex-direction: column; }
.dealer-mini-list article strong,
.dealer-mini-list article span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dealer-mini-list article strong { font-size: 0.78rem; }
.dealer-mini-list article > div span { color: var(--muted); font-size: 0.68rem; }
.dealer-create-card { scroll-margin-top: calc(var(--header-height) + 18px); }
.dealer-form { display: grid; gap: 24px; }
.dealer-form fieldset { min-width: 0; margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); }
.dealer-form legend { padding: 0 10px 0 0; color: var(--navy-dark); font-size: 0.76rem; letter-spacing: 0.025em; text-transform: uppercase; }
.compact-filter { display: grid; width: min(100%, 490px); grid-template-columns: minmax(150px, 1fr) 115px auto; gap: 7px; }
.compact-filter input,
.compact-filter select { min-height: 36px; padding-block: 6px; font-size: 0.75rem; }
.dealer-cell { display: flex; align-items: center; gap: 9px; }
.dealer-cell > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.dealer-cell small { color: var(--muted); font-size: 0.68rem; }

/* Result */
.result-shell { display: grid; min-height: calc(100vh - var(--header-height) - 105px); place-items: center; align-content: center; }
.result-card { width: min(100%, 620px); padding: clamp(28px, 6vw, 48px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); text-align: center; }
.result-symbol { display: grid; width: 64px; height: 64px; margin: 0 auto 20px; place-items: center; border: 1px solid #e1d09f; border-radius: 50%; color: var(--warning); background: var(--warning-bg); font-size: 1.45rem; font-weight: 850; }
.result-card--success .result-symbol { color: var(--success); border-color: #bddfcf; background: var(--success-bg); }
.result-card--error .result-symbol { color: var(--danger); border-color: #efcaca; background: var(--danger-bg); }
.result-card h1 { font-size: clamp(1.7rem, 4vw, 2.25rem); }
.result-card > p { max-width: 475px; margin: 0 auto 26px; color: var(--muted); }
.result-details { display: grid; margin: 0 0 28px; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fafbfc; }
.result-details > div { padding: 15px 12px; border-right: 1px solid var(--line); }
.result-details > div:last-child { border-right: 0; }
.result-details dt { margin-bottom: 4px; color: var(--muted); font-size: 0.67rem; }
.result-details dd { margin: 0; color: var(--navy-dark); font-size: 0.81rem; font-weight: 740; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.result-help { margin: 14px 0 0; color: var(--muted); font-size: 0.71rem; text-align: center; }

/* Error pages */
.error-shell { display: flex; min-height: calc(100vh - var(--header-height) - 100px); padding: 50px 20px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.error-code { margin-bottom: -15px; color: #e4ebf0; font-size: clamp(6rem, 18vw, 12rem); font-weight: 850; letter-spacing: -0.08em; line-height: 0.9; user-select: none; }
.error-shell h1 { max-width: 650px; }
.error-shell > p { max-width: 550px; margin-bottom: 25px; color: var(--muted); }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

@media (max-width: 1080px) {
    .header-inner { gap: 18px; }
    .primary-nav a { padding-inline: 9px; }
    .account-copy { display: none; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .filter-search { grid-column: span 2; }
    .filter-actions { align-self: end; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    :root { --header-height: 66px; }
    .page-main { width: min(100% - 28px, var(--content-width)); padding: 30px 0 42px; }
    .header-inner { width: min(100% - 28px, var(--content-width)); min-height: var(--header-height); }
    .nav-toggle { display: block; }
    .header-menu { position: absolute; top: calc(100% + 1px); right: 0; left: 0; display: none; padding: 13px 14px 17px; align-items: stretch; border-bottom: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-md); }
    .header-menu.is-open { display: grid; }
    .primary-nav { display: grid; gap: 3px; }
    .primary-nav a { padding: 12px; }
    .primary-nav a[aria-current="page"]::after { display: none; }
    .account-menu { padding: 13px 4px 0; border-top: 1px solid var(--line); }
    .account-copy { display: flex; flex: 1; max-width: none; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-intro { min-height: auto; padding: 28px; }
    .auth-intro-copy { margin: 70px 0 45px; }
    .auth-intro-copy h1 { font-size: clamp(2rem, 8vw, 3rem); }
    .auth-assurance { display: none; }
    .auth-panel { padding: 45px 24px 25px; }
    .page-heading--split { align-items: flex-start; flex-direction: column; }
    .detail-heading { flex-direction: row; align-items: center; }
    .form-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field--span-two { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-search { grid-column: span 2; }
    .compact-filter { width: 100%; }
    .card-heading--split { align-items: flex-start; }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .page-main { width: min(100% - 20px, var(--content-width)); padding-top: 23px; }
    .header-inner { width: min(100% - 20px, var(--content-width)); }
    .brand-copy strong { font-size: 0.84rem; }
    .brand-copy small { font-size: 0.65rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { padding: 16px; }
    .stat-card > strong { font-size: 1.3rem; }
    .stat-topline { margin-bottom: 10px; font-size: 0.7rem; }
    .page-heading--split > .button,
    .page-heading--split > a.button { width: 100%; }
    .content-card,
    .form-card,
    .filter-card { border-radius: 10px; }
    .form-card { padding: 19px 15px; }
    .form-card-heading { margin-bottom: 20px; }
    .form-grid,
    .form-grid--three { grid-template-columns: 1fr; }
    .field--span-two { grid-column: auto; }
    .form-actions--end { flex-direction: column-reverse; }
    .form-actions--end .button { width: 100%; }
    .detail-heading { align-items: flex-start; flex-direction: column; }
    .detail-summary { grid-template-columns: 1fr 1fr; }
    .detail-summary > div { padding: 16px; }
    .detail-summary > div:first-child { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
    .detail-summary > div:nth-child(2) { border-right: 1px solid var(--line); }
    .detail-summary > div:last-child { border-right: 0; }
    .filter-form { grid-template-columns: 1fr 1fr; }
    .filter-search { grid-column: 1 / -1; }
    .filter-actions { grid-column: 1 / -1; }
    .filter-actions .button { flex: 1; }
    .card-heading { padding: 18px 16px 15px; }
    .card-heading--split { flex-direction: column; }
    .compact-filter { grid-template-columns: 1fr 110px; }
    .compact-filter .button { grid-column: 1 / -1; }
    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td { display: block; width: 100%; }
    .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .responsive-table tbody { padding: 0 15px; }
    .responsive-table tr { padding: 13px 0; border-bottom: 1px solid var(--line); }
    .responsive-table tr:last-child { border-bottom: 0; }
    .responsive-table td { display: flex; min-height: 34px; padding: 6px 0; align-items: flex-start; justify-content: space-between; gap: 14px; border: 0; text-align: right; }
    .responsive-table td::before { flex: 0 0 98px; color: var(--muted); content: attr(data-label); font-size: 0.68rem; font-weight: 730; letter-spacing: 0.03em; text-align: left; text-transform: uppercase; }
    .responsive-table td > * { margin-left: auto; }
    .responsive-table .table-action { padding-top: 10px; justify-content: flex-end; text-align: right !important; }
    .responsive-table .table-action::before { display: none; }
    .responsive-table .table-action .icon-link,
    .responsive-table .table-action form,
    .responsive-table .table-action .button { width: 100%; }
    .responsive-table .table-action .icon-link { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: center; }
    .dealer-cell { margin-left: auto; justify-content: flex-end; text-align: right; }
    .cell-meta { margin-left: auto; }
    .pagination { gap: 10px; }
    .pagination > span:not(.is-disabled) { display: none; }
    .result-shell { min-height: auto; padding: 20px 0; }
    .result-card { padding: 28px 17px; }
    .result-details { grid-template-columns: 1fr; }
    .result-details > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .result-details > div:last-child { border-bottom: 0; }
    .result-actions { flex-direction: column; }
    .result-actions .button { width: 100%; }
    .auth-intro { padding: 24px 20px; }
    .auth-intro-copy { margin: 55px 0 15px; }
    .auth-intro-copy p { font-size: 0.9rem; }
    .auth-panel { padding: 35px 20px 22px; }
    .auth-footer { margin-top: 32px; }
}

@media (max-width: 390px) {
    .brand-copy strong { max-width: 175px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-form { grid-template-columns: 1fr; }
    .filter-search,
    .filter-actions { grid-column: auto; }
    .detail-summary { grid-template-columns: 1fr; }
    .detail-summary > div,
    .detail-summary > div:nth-child(2) { grid-column: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .detail-summary > div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .site-header,
    .button,
    .back-link,
    .flash,
    .form-actions { display: none !important; }
    body { color: #000; background: #fff; }
    .page-main { width: 100%; padding: 0; }
    .content-card,
    .detail-summary,
    .form-card { box-shadow: none; break-inside: avoid; }
}
