/*
|--------------------------------------------------------------------------
| TradeFlowOS global styles
|--------------------------------------------------------------------------
*/

:root {
    --colour-navy-950: #08131e;
    --colour-navy-900: #0d1b29;
    --colour-navy-850: #102132;
    --colour-navy-800: #152a3e;
    --colour-navy-700: #203a50;

    --colour-blue-600: #1e74d8;
    --colour-blue-500: #2f8cff;
    --colour-blue-100: #e9f3ff;

    --colour-slate-900: #182230;
    --colour-slate-700: #344054;
    --colour-slate-600: #475467;
    --colour-slate-500: #667085;
    --colour-slate-400: #98a2b3;
    --colour-slate-300: #d0d5dd;
    --colour-slate-200: #e4e7ec;
    --colour-slate-100: #f2f4f7;
    --colour-slate-50: #f8fafc;

    --colour-white: #ffffff;

    --colour-success: #067647;
    --colour-success-bg: #ecfdf3;
    --colour-success-border: #abefc6;

    --colour-warning: #b54708;
    --colour-warning-bg: #fffaeb;
    --colour-warning-border: #fedf89;

    --colour-error: #b42318;
    --colour-error-bg: #fef3f2;
    --colour-error-border: #fecdca;

    --shadow-sm:
        0 1px 2px rgba(16, 24, 40, 0.05);

    --shadow-md:
        0 8px 24px rgba(15, 23, 42, 0.08);

    --shadow-lg:
        0 24px 60px rgba(15, 23, 42, 0.16);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --font-body:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

/*
|--------------------------------------------------------------------------
| Reset
|--------------------------------------------------------------------------
*/

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

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: var(--font-body);
    color: var(--colour-slate-900);
    background: var(--colour-slate-50);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

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

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

a {
    color: inherit;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button {
    border: 0;
}

/*
|--------------------------------------------------------------------------
| Authentication layout
|--------------------------------------------------------------------------
*/

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.auth-layout {
    display: grid;
    grid-template-columns:
        minmax(420px, 46%) minmax(480px, 54%);
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    overflow: hidden;
    padding:
        max(40px, env(safe-area-inset-top)) 52px max(32px, env(safe-area-inset-bottom));
    color: var(--colour-white);
    background:
        radial-gradient(circle at 8% 8%,
            rgba(47, 140, 255, 0.24),
            transparent 34%),
        radial-gradient(circle at 90% 88%,
            rgba(47, 140, 255, 0.13),
            transparent 38%),
        linear-gradient(145deg,
            var(--colour-navy-950),
            var(--colour-navy-850));
}

.auth-brand-panel::before {
    content: "";
    position: absolute;
    top: -180px;
    right: -170px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 50%;
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    right: -110px;
    bottom: -160px;
    width: 380px;
    height: 380px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.auth-brand-panel-inner,
.auth-brand-footer {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.auth-brand-logo {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    flex: 0 0 76px;
    padding: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.2);
}

.auth-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-brand-fallback {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 15px;
    color: var(--colour-white);
    background: var(--colour-blue-500);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow:
        0 12px 26px rgba(47, 140, 255, 0.24);
}

.auth-brand-name {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.auth-brand-name strong {
    font-size: 21px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.auth-brand-name small {
    color: rgba(255, 255, 255, 0.64);
    font-size: 12px;
    line-height: 1.4;
}

.auth-brand-copy {
    max-width: 610px;
    margin-top: clamp(64px, 11vh, 140px);
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: #8bc1ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    line-height: 1.4;
    text-transform: uppercase;
}

.auth-eyebrow::before {
    content: "";
    width: 24px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.auth-eyebrow-dark {
    color: var(--colour-blue-600);
}

.auth-brand-copy h1 {
    max-width: 660px;
    margin: 0;
    font-size: clamp(38px, 4vw, 64px);
    font-weight: 700;
    letter-spacing: -0.052em;
    line-height: 1.02;
}

.auth-brand-copy p {
    max-width: 610px;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 17px;
    line-height: 1.75;
}

.auth-feature-grid {
    display: grid;
    gap: 12px;
    max-width: 610px;
    margin-top: 42px;
}

.auth-feature-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 76px;
    padding: 15px 17px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(10px);
}

.auth-feature-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    color: #8bc1ff;
    background: rgba(47, 140, 255, 0.13);
}

.auth-feature-icon svg {
    width: 20px;
    height: 20px;
}

.auth-feature-card div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-feature-card strong {
    font-size: 14px;
    line-height: 1.3;
}

.auth-feature-card span:last-child {
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    line-height: 1.5;
}

.auth-brand-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 60px;
    color: rgba(255, 255, 255, 0.42);
    font-size: 11px;
    line-height: 1.5;
}

/*
|--------------------------------------------------------------------------
| Authentication form panel
|--------------------------------------------------------------------------
*/

.auth-form-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding:
        max(40px, env(safe-area-inset-top)) clamp(34px, 7vw, 110px) max(40px, env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 100% 0,
            rgba(47, 140, 255, 0.06),
            transparent 30%),
        var(--colour-white);
}

.auth-form-wrapper {
    width: 100%;
    max-width: 480px;
}

.auth-form-heading {
    margin-bottom: 32px;
}

.auth-form-heading h2 {
    margin: 0;
    color: var(--colour-slate-900);
    font-size: clamp(34px, 4vw, 48px);
    font-weight: 750;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.auth-form-heading p {
    margin: 14px 0 0;
    color: var(--colour-slate-500);
    font-size: 15px;
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 22px;
}

.form-group {
    display: grid;
    gap: 9px;
}

.form-group label,
.form-label-row label {
    color: var(--colour-slate-700);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.form-label-row a {
    color: var(--colour-blue-600);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.form-label-row a:hover {
    text-decoration: underline;
}

.form-control-wrap {
    position: relative;
}

.form-control-wrap input {
    width: 100%;
    min-height: 56px;
    padding:
        13px 48px 13px 48px;
    border: 1px solid var(--colour-slate-300);
    border-radius: 13px;
    outline: none;
    color: var(--colour-slate-900);
    background: var(--colour-white);
    font-size: 15px;
    line-height: 1.4;
    box-shadow: var(--shadow-sm);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.form-control-wrap input::placeholder {
    color: var(--colour-slate-400);
}

.form-control-wrap input:hover {
    border-color: #b9c0ca;
}

.form-control-wrap input:focus {
    border-color: var(--colour-blue-500);
    box-shadow:
        0 0 0 4px rgba(47, 140, 255, 0.12);
}

.form-control-icon {
    position: absolute;
    top: 50%;
    left: 17px;
    z-index: 1;
    width: 19px;
    height: 19px;
    color: var(--colour-slate-400);
    pointer-events: none;
    transform: translateY(-50%);
}

.form-control-icon svg {
    width: 100%;
    height: 100%;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    cursor: pointer;
    color: var(--colour-slate-500);
    background: transparent;
    transform: translateY(-50%);
    transition:
        color 160ms ease,
        background-color 160ms ease;
}

.password-toggle:hover {
    color: var(--colour-slate-900);
    background: var(--colour-slate-100);
}

.password-toggle:focus-visible {
    outline: 3px solid rgba(47, 140, 255, 0.2);
    outline-offset: 1px;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
}

.password-toggle-hide {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-show {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-hide {
    display: block;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 57px;
    width: 100%;
    margin-top: 2px;
    padding: 14px 20px;
    border-radius: 13px;
    cursor: pointer;
    color: var(--colour-white);
    background:
        linear-gradient(135deg,
            var(--colour-blue-500),
            var(--colour-blue-600));
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    box-shadow:
        0 14px 28px rgba(30, 116, 216, 0.22);
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        filter 160ms ease;
}

.auth-submit:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
    box-shadow:
        0 18px 34px rgba(30, 116, 216, 0.27);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:focus-visible {
    outline: 4px solid rgba(47, 140, 255, 0.2);
    outline-offset: 3px;
}

.auth-submit svg {
    width: 19px;
    height: 19px;
}

.auth-security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 24px;
    color: var(--colour-slate-500);
    font-size: 11px;
    line-height: 1.5;
}

.auth-security-note svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--colour-success);
}

/*
|--------------------------------------------------------------------------
| Alerts
|--------------------------------------------------------------------------
*/

.auth-alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.55;
}

.auth-alert ul {
    margin: 0;
    padding-left: 19px;
}

.auth-alert-success {
    border-color: var(--colour-success-border);
    color: var(--colour-success);
    background: var(--colour-success-bg);
}

.auth-alert-warning {
    border-color: var(--colour-warning-border);
    color: var(--colour-warning);
    background: var(--colour-warning-bg);
}

.auth-alert-error {
    border-color: var(--colour-error-border);
    color: var(--colour-error);
    background: var(--colour-error-bg);
}

.auth-alert-info {
    border-color: #b2ddff;
    color: #175cd3;
    background: #eff8ff;
}

/*
|--------------------------------------------------------------------------
| Mobile-only brand elements
|--------------------------------------------------------------------------
*/

.auth-mobile-brand,
.auth-mobile-footer {
    display: none;
}

/*
|--------------------------------------------------------------------------
| Tablet
|--------------------------------------------------------------------------
*/

@media (max-width: 1100px) {
    .auth-layout {
        grid-template-columns:
            minmax(360px, 42%) minmax(430px, 58%);
    }

    .auth-brand-panel {
        padding-right: 36px;
        padding-left: 36px;
    }

    .auth-brand-copy {
        margin-top: 72px;
    }

    .auth-brand-copy h1 {
        font-size: clamp(34px, 4.6vw, 48px);
    }

    .auth-feature-card span:last-child {
        display: none;
    }

    .auth-feature-card {
        min-height: 64px;
    }

    .auth-form-panel {
        padding-right: 46px;
        padding-left: 46px;
    }
}

/*
|--------------------------------------------------------------------------
| Mobile and portrait tablet
|--------------------------------------------------------------------------
*/

@media (max-width: 820px) {
    .auth-layout {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 100vh;
        min-height: 100dvh;
        padding:
            max(22px, env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom));
        background:
            radial-gradient(circle at 100% 0,
                rgba(47, 140, 255, 0.08),
                transparent 33%),
            linear-gradient(180deg,
                #ffffff,
                #f8fafc);
    }

    .auth-mobile-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        max-width: 520px;
        margin: 0 auto 34px;
    }

    .auth-mobile-brand img {
        width: 62px;
        height: 62px;
        flex: 0 0 62px;
        padding: 7px;
        object-fit: contain;
        border: 1px solid var(--colour-slate-200);
        border-radius: 15px;
        background: var(--colour-white);
        box-shadow: var(--shadow-md);
    }

    .auth-mobile-brand div {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .auth-mobile-brand strong {
        color: var(--colour-slate-900);
        font-size: 18px;
        letter-spacing: -0.02em;
    }

    .auth-mobile-brand span {
        color: var(--colour-slate-500);
        font-size: 11px;
    }

    .auth-form-wrapper {
        max-width: 520px;
        margin: auto;
        padding: 30px;
        border: 1px solid var(--colour-slate-200);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: var(--shadow-lg);
    }

    .auth-form-heading {
        margin-bottom: 28px;
    }

    .auth-form-heading h2 {
        font-size: 38px;
    }

    .auth-mobile-footer {
        display: block;
        width: 100%;
        max-width: 520px;
        margin: 28px auto 0;
        color: var(--colour-slate-400);
        font-size: 10px;
        text-align: center;
    }
}

/*
|--------------------------------------------------------------------------
| Small mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 520px) {
    .auth-form-panel {
        padding-right: 16px;
        padding-left: 16px;
    }

    .auth-mobile-brand {
        margin-bottom: 24px;
    }

    .auth-mobile-brand img {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
    }

    .auth-form-wrapper {
        width: 100%;
        padding: 24px 20px;
        border-radius: 18px;
        box-shadow:
            0 15px 40px rgba(15, 23, 42, 0.11);
    }

    .auth-form-heading h2 {
        font-size: 34px;
    }

    .auth-form-heading p {
        font-size: 14px;
    }

    .auth-eyebrow {
        margin-bottom: 14px;
        font-size: 10px;
    }

    .form-control-wrap input {
        min-height: 56px;
        font-size: 16px;
    }

    .auth-submit {
        min-height: 58px;
    }
}

/*
|--------------------------------------------------------------------------
| Very small or short screens
|--------------------------------------------------------------------------
*/

@media (max-height: 720px) and (min-width: 821px) {
    .auth-brand-panel {
        padding-top: 26px;
        padding-bottom: 24px;
    }

    .auth-brand-copy {
        margin-top: 34px;
    }

    .auth-brand-copy h1 {
        font-size: 40px;
    }

    .auth-brand-copy p {
        margin-top: 16px;
    }

    .auth-feature-grid {
        margin-top: 24px;
    }

    .auth-feature-card {
        min-height: 58px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .auth-brand-footer {
        margin-top: 28px;
    }
}

/*
|--------------------------------------------------------------------------
| Reduced motion
|--------------------------------------------------------------------------
*/

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

/*
|--------------------------------------------------------------------------
| Authentication secondary actions
|--------------------------------------------------------------------------
*/

.auth-submit-link {
    text-decoration: none;
}

.auth-submit-link svg:first-child {
    order: -1;
}

.auth-secondary-action {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.auth-secondary-action a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--colour-slate-600);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
}

.auth-secondary-action a:hover {
    color: var(--colour-blue-600);
}

.auth-secondary-action svg {
    width: 17px;
    height: 17px;
}

/*
|--------------------------------------------------------------------------
| Password requirements
|--------------------------------------------------------------------------
*/

.password-requirements {
    margin-top: -8px;
    padding: 15px 17px;
    border: 1px solid var(--colour-slate-200);
    border-radius: 12px;
    color: var(--colour-slate-600);
    background: var(--colour-slate-50);
    font-size: 12px;
    line-height: 1.6;
}

.password-requirements strong {
    display: block;
    margin-bottom: 7px;
    color: var(--colour-slate-700);
    font-size: 12px;
}

.password-requirements ul {
    display: grid;
    gap: 3px;
    margin: 0;
    padding-left: 18px;
}

.auth-brand-footer a {
    color: inherit;
    text-decoration: none;
    transition: color 160ms ease;
}

.auth-brand-footer a:hover {
    color: rgba(255, 255, 255, 0.78);
}

/*
|--------------------------------------------------------------------------
| TradeFlowOS authenticated layout
|--------------------------------------------------------------------------
*/

.admin-page {
    min-height: 100vh;
    margin: 0;
    color: #172033;
    background: #f4f6f9;
}

.admin-page,
.admin-page button,
.admin-page input,
.admin-page select,
.admin-page textarea {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.admin-shell {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: 280px;
    color: #ffffff;
    background:
        linear-gradient(180deg,
            var(--company-primary, #102132),
            #0b1722);
    box-shadow: 18px 0 50px rgba(5, 15, 25, 0.08);
}

.admin-sidebar-top {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 86px;
    padding: 18px 18px 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.admin-sidebar-logo,
.admin-sidebar-logo-fallback {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
}

.admin-sidebar-logo img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 5px;
    box-sizing: border-box;
    object-fit: contain;
}

.admin-sidebar-logo-fallback {
    color: var(--company-primary, #102132);
    font-size: 16px;
    font-weight: 900;
}

.admin-sidebar-brand-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.admin-sidebar-brand-copy strong {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-sidebar-brand-copy small {
    color: rgba(255, 255, 255, 0.58);
    font-size: 10px;
    line-height: 1.25;
}

.admin-sidebar-close {
    display: none;
    width: 38px;
    height: 38px;
    margin-left: auto;
    padding: 9px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.admin-sidebar-close svg {
    display: block;
    width: 100%;
    height: 100%;
}

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 14px;
}

.admin-nav-heading {
    display: block;
    padding: 18px 12px 8px;
    color: rgba(255, 255, 255, 0.42);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.admin-nav-heading:first-child {
    padding-top: 0;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    margin: 3px 0;
    padding: 9px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition:
        color 160ms ease,
        background 160ms ease,
        transform 160ms ease;
}

.admin-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(2px);
}

.admin-nav-link.is-active {
    color: #ffffff;
    background: var(--company-accent, #1e74d8);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.13);
}

.admin-nav-icon {
    display: grid;
    flex: 0 0 21px;
    width: 21px;
    height: 21px;
    place-items: center;
}

.admin-nav-icon svg {
    width: 20px;
    height: 20px;
}

.admin-sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.admin-sidebar-user,
.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-sidebar-user {
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.admin-user-avatar {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    background: var(--company-accent, #1e74d8);
    font-size: 12px;
    font-weight: 900;
}

.admin-sidebar-user div,
.admin-topbar-user div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.admin-sidebar-user strong,
.admin-topbar-user strong {
    overflow: hidden;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-sidebar-user span:not(.admin-user-avatar),
.admin-topbar-user span:not(.admin-user-avatar) {
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
}

.admin-sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.05);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.admin-sidebar-logout:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.09);
}

.admin-sidebar-logout svg {
    width: 17px;
    height: 17px;
}

.admin-powered-by {
    display: block;
    margin-top: 13px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
}

.admin-powered-by:hover {
    color: rgba(255, 255, 255, 0.72);
}

.admin-main {
    display: flex;
    min-height: 100vh;
    margin-left: 280px;
    flex-direction: column;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 0 30px;
    border-bottom: 1px solid #e5e9ef;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
}

.admin-menu-button {
    display: none;
    width: 42px;
    height: 42px;
    margin-right: 14px;
    padding: 10px;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    color: #344054;
    background: #ffffff;
    cursor: pointer;
}

.admin-menu-button svg {
    display: block;
    width: 100%;
    height: 100%;
}

.admin-topbar-copy {
    display: grid;
    gap: 2px;
}

.admin-topbar-copy span {
    color: #98a2b3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.admin-topbar-copy strong {
    color: #1d2939;
    font-size: 13px;
}

.admin-topbar-user {
    margin-left: auto;
}

.admin-topbar-user span:not(.admin-user-avatar) {
    color: #667085;
}

.admin-content {
    flex: 1;
    width: min(100%, 1450px);
    margin: 0 auto;
    padding: 34px 34px 50px;
    box-sizing: border-box;
}

.admin-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.admin-page-eyebrow,
.settings-card-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--company-accent, #1e74d8);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.admin-page-heading h1 {
    margin: 0;
    color: #101828;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.admin-page-heading p {
    max-width: 720px;
    margin: 10px 0 0;
    color: #667085;
    font-size: 14px;
    line-height: 1.65;
}

.admin-main-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 19px 34px;
    border-top: 1px solid #e5e9ef;
    color: #98a2b3;
    background: #ffffff;
    font-size: 10px;
}

.admin-main-footer a {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.admin-main-footer a:hover {
    color: var(--company-accent, #1e74d8);
}

.admin-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: rgba(9, 18, 28, 0.55);
    backdrop-filter: blur(3px);
}

/*
|--------------------------------------------------------------------------
| Settings navigation
|--------------------------------------------------------------------------
*/

.settings-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    margin-bottom: 24px;
    padding: 5px;
    border: 1px solid #e1e7ee;
    border-radius: 12px;
    background: #ffffff;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tabs a {
    flex: 0 0 auto;
    padding: 10px 17px;
    border-radius: 8px;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.settings-tabs a:hover {
    color: #344054;
    background: #f5f7fa;
}

.settings-tabs a.is-active {
    color: #ffffff;
    background: var(--company-accent, #1e74d8);
}

/*
|--------------------------------------------------------------------------
| Settings forms
|--------------------------------------------------------------------------
*/

.settings-form {
    display: grid;
    gap: 22px;
}

.settings-card {
    overflow: hidden;
    border: 1px solid #e1e7ee;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 9px 28px rgba(16, 24, 40, 0.04);
}

.settings-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 25px 27px;
    border-bottom: 1px solid #edf0f4;
    background: #fbfcfd;
}

.settings-card-heading h2 {
    margin: 0;
    color: #101828;
    font-size: 19px;
    line-height: 1.25;
}

.settings-card-heading p {
    max-width: 720px;
    margin: 7px 0 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.6;
}

.settings-grid {
    display: grid;
    gap: 22px 24px;
    padding: 27px;
}

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

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

.settings-field {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
}

.settings-field-full {
    grid-column: 1 / -1;
}

.settings-field label {
    color: #344054;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
}

.settings-field label span {
    color: #d92d20;
}

.settings-field input,
.settings-field select,
.settings-field textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #d6dde6;
    border-radius: 9px;
    outline: none;
    color: #172033;
    background: #ffffff;
    font: inherit;
    font-size: 13px;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.settings-field input,
.settings-field select {
    min-height: 47px;
    padding: 10px 13px;
}

.settings-field textarea {
    min-height: 120px;
    padding: 12px 13px;
    resize: vertical;
}

.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
    border-color: var(--company-accent, #1e74d8);
    box-shadow:
        0 0 0 4px color-mix(in srgb,
            var(--company-accent, #1e74d8) 12%,
            transparent);
}

.settings-field input[type="file"] {
    padding: 8px;
}

.settings-field input[type="file"]::file-selector-button {
    min-height: 31px;
    margin-right: 11px;
    padding: 6px 11px;
    border: 0;
    border-radius: 7px;
    color: #344054;
    background: #eef2f6;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.settings-field small {
    color: #98a2b3;
    font-size: 10px;
    line-height: 1.55;
}

.settings-branding-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 27px;
    padding: 27px;
}

.settings-branding-layout .settings-grid {
    padding: 0;
}

.settings-logo-preview {
    display: grid;
    align-content: start;
    gap: 9px;
}

.settings-logo-preview>span {
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.settings-logo-preview-box {
    display: grid;
    min-height: 170px;
    padding: 22px;
    place-items: center;
    border: 1px dashed #cfd8e3;
    border-radius: 12px;
    background:
        linear-gradient(45deg, #f7f9fb 25%, transparent 25%),
        linear-gradient(-45deg, #f7f9fb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f7f9fb 75%),
        linear-gradient(-45deg, transparent 75%, #f7f9fb 75%);
    background-position:
        0 0,
        0 8px,
        8px -8px,
        -8px 0;
    background-size: 16px 16px;
}

.settings-logo-preview-box img {
    display: block;
    max-width: 100%;
    max-height: 125px;
    object-fit: contain;
}

.settings-logo-preview-box strong {
    color: #98a2b3;
    font-size: 12px;
}

.settings-colour-control {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 9px;
}

.settings-colour-picker {
    width: 52px !important;
    padding: 4px !important;
    cursor: pointer;
}

.settings-save-bar {
    position: sticky;
    bottom: 18px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 20px;
    border: 1px solid #dce3eb;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 42px rgba(16, 24, 40, 0.14);
    backdrop-filter: blur(16px);
}

.settings-save-bar>div {
    display: grid;
    gap: 3px;
}

.settings-save-bar strong {
    color: #101828;
    font-size: 13px;
}

.settings-save-bar span {
    color: #667085;
    font-size: 10px;
}

.admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 45px;
    padding: 10px 17px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.admin-button svg {
    width: 17px;
    height: 17px;
}

.admin-button-primary {
    color: #ffffff;
    background: var(--company-accent, #1e74d8);
    box-shadow:
        0 9px 20px color-mix(in srgb,
            var(--company-accent, #1e74d8) 22%,
            transparent);
}

.admin-button-primary:hover {
    filter: brightness(0.92);
}

/*
|--------------------------------------------------------------------------
| Admin alerts
|--------------------------------------------------------------------------
*/

.admin-alert {
    margin-bottom: 20px;
    padding: 15px 17px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.6;
}

.admin-alert strong {
    display: block;
    margin-bottom: 4px;
}

.admin-alert ul {
    margin: 5px 0 0;
    padding-left: 19px;
}

.admin-alert-success {
    border: 1px solid #a9ddbc;
    color: #17663a;
    background: #effbf3;
}

.admin-alert-error {
    border: 1px solid #efb1b1;
    color: #9f2727;
    background: #fff1f1;
}

.admin-alert-warning {
    border: 1px solid #ebd08f;
    color: #815f12;
    background: #fff9e6;
}

/*
|--------------------------------------------------------------------------
| Dashboard placeholders
|--------------------------------------------------------------------------
*/

.dashboard-welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 22px;
    padding: 27px;
    border: 1px solid #e1e7ee;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 9px 28px rgba(16, 24, 40, 0.04);
}

.dashboard-welcome-card h2 {
    margin: 0;
    color: #101828;
    font-size: 23px;
}

.dashboard-welcome-card p {
    max-width: 720px;
    margin: 8px 0 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.65;
}

.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-stat-card {
    display: grid;
    gap: 6px;
    padding: 22px;
    border: 1px solid #e1e7ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.035);
}

.dashboard-stat-card>span {
    color: #667085;
    font-size: 11px;
    font-weight: 800;
}

.dashboard-stat-card strong {
    color: #101828;
    font-size: 29px;
    letter-spacing: -0.04em;
}

.dashboard-stat-card small {
    color: #98a2b3;
    font-size: 10px;
}

/*
|--------------------------------------------------------------------------
| Responsive admin layout
|--------------------------------------------------------------------------
*/

@media (max-width: 1180px) {

    .settings-grid-three,
    .dashboard-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        width: min(86vw, 300px);
        transform: translateX(-105%);
        transition: transform 220ms ease;
    }

    .admin-sidebar-is-open {
        overflow: hidden;
    }

    .admin-sidebar-is-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-is-open .admin-sidebar-overlay {
        display: block;
    }

    .admin-sidebar-close,
    .admin-menu-button {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-topbar {
        padding: 0 20px;
    }

    .admin-content {
        padding: 28px 20px 45px;
    }

    .admin-main-footer {
        padding: 18px 20px;
    }

    .settings-branding-layout {
        grid-template-columns: 190px minmax(0, 1fr);
    }
}

@media (max-width: 680px) {
    .admin-topbar-user div {
        display: none;
    }

    .admin-content {
        padding: 24px 14px 40px;
    }

    .admin-page-heading {
        margin-bottom: 20px;
    }

    .admin-page-heading h1 {
        font-size: 28px;
    }

    .settings-grid-two,
    .settings-grid-three,
    .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }

    .settings-card-heading,
    .settings-grid,
    .settings-branding-layout {
        padding: 20px;
    }

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

    .settings-logo-preview-box {
        min-height: 140px;
    }

    .settings-save-bar {
        bottom: 10px;
        align-items: stretch;
        flex-direction: column;
    }

    .settings-save-bar .admin-button {
        width: 100%;
    }

    .dashboard-welcome-card {
        align-items: stretch;
        flex-direction: column;
        padding: 22px;
    }

    .dashboard-welcome-card .admin-button {
        width: 100%;
        box-sizing: border-box;
    }

    .admin-main-footer {
        align-items: center;
        flex-direction: column;
        text-align: center;
    }
}

/*
|--------------------------------------------------------------------------
| Document settings
|--------------------------------------------------------------------------
*/

.document-sequence-list {
    display: grid;
    gap: 18px;
    padding: 27px;
}

.document-sequence-card {
    overflow: hidden;
    border: 1px solid #e1e7ee;
    border-radius: 13px;
    background: #ffffff;
}

.document-sequence-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border-bottom: 1px solid #e9edf2;
    background: #f8fafc;
}

.document-sequence-heading>div {
    display: grid;
    gap: 5px;
}

.document-sequence-heading>div>span {
    color: #667085;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.document-sequence-heading strong {
    color: #101828;
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.document-preview-label {
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid #d9e2ec;
    border-radius: 999px;
    color: #667085;
    background: #ffffff;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.document-sequence-fields {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.5fr) minmax(130px, 0.7fr) minmax(170px, 0.9fr) minmax(220px, 1.2fr);
    gap: 20px;
    padding: 20px;
}

.document-placeholder-help {
    margin: 0 27px 27px;
    padding: 17px 19px;
    border: 1px solid #dce5ef;
    border-radius: 11px;
    color: #667085;
    background: #f8fafc;
    font-size: 11px;
    line-height: 1.6;
}

.document-placeholder-help>strong {
    display: block;
    margin-bottom: 9px;
    color: #344054;
    font-size: 11px;
}

.document-placeholder-help>div {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 9px;
}

.document-placeholder-help>div>span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border: 1px solid #e0e6ed;
    border-radius: 7px;
    background: #ffffff;
}

.document-placeholder-help p {
    margin: 0;
}

.document-placeholder-help code {
    color: var(--company-accent, #1e74d8);
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
    font-size: 10px;
    font-weight: 800;
}

.settings-field-label {
    color: #344054;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
}

.settings-switch-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 47px;
    padding: 9px 12px;
    box-sizing: border-box;
    border: 1px solid #d6dde6;
    border-radius: 9px;
    color: #475467;
    background: #ffffff;
    cursor: pointer;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.settings-switch-row input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.settings-switch {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #cfd7e1;
    transition: background 160ms ease;
}

.settings-switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(16, 24, 40, 0.22);
    content: "";
    transition: transform 160ms ease;
}

.settings-switch-row input:checked+.settings-switch {
    background: var(--company-accent, #1e74d8);
}

.settings-switch-row input:checked+.settings-switch::after {
    transform: translateX(18px);
}

.settings-switch-row input:focus-visible+.settings-switch {
    outline: 3px solid color-mix(in srgb,
            var(--company-accent, #1e74d8) 20%,
            transparent);
    outline-offset: 2px;
}

.settings-input-suffix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid #d6dde6;
    border-radius: 9px;
    background: #ffffff;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.settings-input-suffix:focus-within {
    border-color: var(--company-accent, #1e74d8);
    box-shadow:
        0 0 0 4px color-mix(in srgb,
            var(--company-accent, #1e74d8) 12%,
            transparent);
}

.settings-input-suffix input {
    min-height: 45px;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.settings-input-suffix>span {
    display: flex;
    align-items: center;
    padding: 0 13px;
    border-left: 1px solid #e1e6ec;
    color: #667085;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 800;
}

@media (max-width: 1250px) {
    .document-sequence-fields {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .document-sequence-list {
        padding: 20px;
    }

    .document-sequence-heading {
        align-items: flex-start;
        flex-direction: column-reverse;
        padding: 17px;
    }

    .document-sequence-heading strong {
        font-size: 17px;
    }

    .document-sequence-fields {
        grid-template-columns: 1fr;
        padding: 17px;
    }

    .document-placeholder-help {
        margin: 0 20px 20px;
    }
}

.page-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px
}

.page-action-buttons {
    display: flex;
    gap: 10px
}

/* ==========================================================================
   Customers
   ========================================================================== */

.page-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.customer-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    flex: 1;
}

.customer-search-form input[type="search"],
.customer-search-form input[type="text"],
.customer-search-form select {
    min-width: 180px;
    padding: 12px 15px;
    border: 1px solid #d8dee7;
    border-radius: 10px;
    background: #fff;
    font-size: .95rem;
    transition: .2s;
}

.customer-search-form input:focus,
.customer-search-form select:focus {
    outline: none;
    border-color: var(--company-primary);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, .12);
}

.customer-list-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e6ebf2;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}

.customer-list-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    border-bottom: 1px solid #edf1f5;
    flex-wrap: wrap;
}

.customer-list-heading strong {
    display: block;
    font-size: 1.2rem;
    color: #111827;
}

.customer-list-heading span {
    color: #6b7280;
    font-size: .92rem;
}

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

.customer-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.customer-table thead {
    background: #f8fafc;
}

.customer-table th {
    text-align: left;
    padding: 16px 22px;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b7280;
    font-weight: 700;
}

.customer-table td {
    padding: 18px 22px;
    border-top: 1px solid #edf1f5;
    vertical-align: top;
}

.customer-table tbody tr {
    transition: .2s;
}

.customer-table tbody tr:hover {
    background: #f9fbfd;
}

.customer-name-link {
    display: block;
    color: #111827;
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 4px;
}

.customer-name-link:hover {
    color: var(--company-primary);
}

.customer-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: var(--company-primary);
    font-size: .72rem;
    font-weight: 600;
    margin-top: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    gap: 6px;
}

.status-active {
    background: #ecfdf3;
    color: #067647;
}

.status-archived {
    background: #fef3f2;
    color: #b42318;
}

.table-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    transition: .2s;
}

.table-action-link:hover {
    background: var(--company-primary);
    color: #fff;
}

.empty-state {
    padding: 70px 30px;
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 22px;
}

/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #fff;
    border: 1px solid #dce3ec;
    color: #374151;
    font-weight: 600;
    transition: .2s;
}

.pagination a:hover {
    background: var(--company-primary);
    color: #fff;
    border-color: var(--company-primary);
}

.pagination a.is-active {
    background: var(--company-primary);
    color: #fff;
    border-color: var(--company-primary);
}

/* Customer Form */

.customer-form {
    display: grid;
    gap: 24px;
}

.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.customer-card {
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.customer-card h3 {
    margin: 0 0 20px;
    font-size: 1.1rem;
}

.customer-card label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.customer-card input,
.customer-card textarea,
.customer-card select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d8dee7;
    border-radius: 10px;
    font-size: .95rem;
    transition: .2s;
    background: #fff;
}

.customer-card textarea {
    min-height: 130px;
    resize: vertical;
}

.customer-card input:focus,
.customer-card textarea:focus,
.customer-card select:focus {
    outline: none;
    border-color: var(--company-primary);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, .12);
}

.customer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Customer Profile */

.customer-profile-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 28px;
}

.customer-sidebar {
    display: grid;
    gap: 20px;
}

.info-list {
    display: grid;
    gap: 14px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #edf1f5;
    padding-bottom: 10px;
}

.info-row strong {
    color: #111827;
}

.customer-timeline {
    display: grid;
    gap: 16px;
}

.timeline-item {
    border-left: 3px solid var(--company-primary);
    padding-left: 18px;
}

.timeline-item time {
    display: block;
    color: #6b7280;
    font-size: .8rem;
    margin-bottom: 4px;
}

/* Mobile */

@media (max-width:992px) {

    .customer-profile-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width:768px) {

    .page-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .customer-search-form {
        flex-direction: column;
    }

    .customer-search-form input,
    .customer-search-form select {
        width: 100%;
    }

    .customer-list-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .customer-grid {
        grid-template-columns: 1fr;
    }

}

/* ==========================================================================
   Staff Management
   ========================================================================== */

.staff-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.staff-summary-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 1px solid #e5eaf1;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.staff-summary-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 76px;
    height: 76px;
    border-radius: 0 0 0 76px;
    background: color-mix(in srgb,
            var(--company-primary) 9%,
            transparent);
}

.staff-summary-card span {
    position: relative;
    z-index: 1;
    display: block;
    margin-bottom: 10px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.staff-summary-card strong {
    position: relative;
    z-index: 1;
    display: block;
    color: #0f172a;
    font-size: 2rem;
    line-height: 1;
}

/* ==========================================================================
   Staff filters
   ========================================================================== */

.staff-filter-form {
    display: grid;
    grid-template-columns:
        minmax(260px, 1fr) minmax(150px, 190px) minmax(170px, 210px) minmax(180px, 220px) auto auto;
    gap: 12px;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #edf1f5;
    background: #fbfcfe;
}

.staff-filter-form input,
.staff-filter-form select {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid #d8dee7;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    font: inherit;
    font-size: 0.92rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.staff-filter-form input::placeholder {
    color: #94a3b8;
}

.staff-filter-form input:focus,
.staff-filter-form select:focus {
    outline: none;
    border-color: var(--company-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb,
            var(--company-primary) 13%,
            transparent);
}

.staff-filter-search {
    min-width: 0;
}

/* ==========================================================================
   Staff table
   ========================================================================== */

.staff-table td {
    vertical-align: middle;
}

.staff-email-link {
    display: block;
    width: fit-content;
    max-width: 280px;
    overflow: hidden;
    margin-top: 3px;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.4;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.staff-email-link:hover {
    color: var(--company-primary);
    text-decoration: underline;
}

.staff-job-title {
    display: block;
    margin-top: 5px;
    color: #94a3b8;
    font-size: 0.79rem;
}

.staff-table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

/* ==========================================================================
   Staff role badges
   ========================================================================== */

.staff-role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.staff-role-admin {
    background: #f3e8ff;
    color: #7e22ce;
}

.staff-role-manager {
    background: #e0f2fe;
    color: #0369a1;
}

.staff-role-staff {
    background: #f1f5f9;
    color: #475569;
}

/* ==========================================================================
   Invitation badges
   ========================================================================== */

.staff-invitation-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.staff-invitation-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

.staff-invitation-pending {
    background: #fff7ed;
    color: #c2410c;
}

.staff-invitation-accepted {
    background: #ecfdf3;
    color: #067647;
}

.staff-invitation-expired {
    background: #fef2f2;
    color: #b42318;
}

.staff-invitation-revoked {
    background: #f1f5f9;
    color: #475569;
}

.staff-invitation-none {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.staff-invitation-meta {
    display: block;
    margin-top: 7px;
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.4;
}

/* ==========================================================================
   Screen reader utility
   ========================================================================== */

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

/* ==========================================================================
   Responsive staff management
   ========================================================================== */

@media (max-width: 1200px) {
    .staff-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .staff-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .staff-filter-search {
        grid-column: 1 / -1;
    }

    .staff-filter-form .admin-button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .staff-summary-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .staff-summary-card {
        padding: 20px;
    }

    .staff-summary-card strong {
        font-size: 1.7rem;
    }

    .staff-filter-form {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .staff-filter-search {
        grid-column: auto;
    }

    .staff-table-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .staff-email-link {
        max-width: 220px;
    }
}

@media (max-width: 520px) {

    .staff-role-badge,
    .staff-invitation-badge,
    .status-badge {
        font-size: 0.7rem;
    }

    .staff-table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .staff-table-actions .table-action-link {
        width: 100%;
    }
}