/* =========================
   Design Tokens
   ========================= */

:root {
    /* Font configuration */
    --primary-text: 'Nunito';

    /* Colour configuration */
    --primary-colour: #4c1028;
    --secondary-colour: #a8446a;

    --background-colour: #f8f4f6;

    --offwhite: #fff8fb;
    --offwhite-dim: #eddde5;

    /* Semantic colours for consistency */
    --text-colour: #241920;
    --text-muted: #5f5158;
    --surface-colour: #ffffff;
    --surface-soft: #f3e9ee;
    --border-soft: #d8c7cf;
    --tint-soft: #f3e9ee;
    --tint-soft-strong: #ead9e2;
    --focus-ring: #d06a90;
    --nav-surface: rgba(255, 255, 255, 0.92);

    /* Rounded */
    --radius-sm: 6px;
    --radius-md: 10px;
    --surface-shadow: 0 10px 24px rgba(76, 16, 40, 0.1);

    /* Panel colours */
    --panel-background: var(--primary-colour);
    --panel-accent: rgb(243 233 238 / 0.28);

    /* Footer colours */
    --footer-background: var(--primary-colour);
    --footer-text: #ecdde5;
    --footer-text-muted: #ceb7c2;
    --footer-link: #fff8fb;
    --footer-link-hover: #f8d8e5;
    --footer-divider-colour: rgb(255 248 251 / 0.2);
}


/* =========================
   Base / Reset
   ========================= */

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--background-colour);
    font-family: var(--primary-text), sans-serif;
    color: var(--text-colour);
    line-height: 1.6;
}

p {
    margin-bottom: 0;
}

/* =========================
   Toasts
   ========================= */

.mb-toast-container {
    z-index: 1200;
}

.layout-panel .mb-toast-container {
    inset: 1rem 1rem auto auto !important;
}

.layout-app-shell .mb-toast-container {
    inset: 1rem 1rem auto auto !important;
}

.mb-toast {
    width: min(380px, calc(100vw - 2rem));
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    box-shadow: var(--surface-shadow);
    background: var(--surface-colour);
    color: var(--text-colour);
    overflow: hidden;
}

.mb-toast-header {
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-colour);
    color: var(--text-muted);
    font-size: .78rem;
}

.mb-toast-header strong {
    color: var(--primary-colour);
    font-size: .82rem;
}

.mb-toast-body {
    font-size: .95rem;
    line-height: 1.5;
    padding: .85rem 1rem;
}

.mb-toast-success {
    border-color: #cfe9dc;
    background: #f5fbf7;
}

.mb-toast-info {
    border-color: #e6d5dd;
    background: #fbf7f9;
}

.mb-toast-warning {
    border-color: #f0debc;
    background: #fff8eb;
}

.mb-toast-error {
    border-color: #efc8cd;
    background: #fff1f2;
}

@media (max-width: 575.98px) {
    .mb-toast-container {
        inset: 0 auto auto 0 !important;
        padding: .75rem !important;
        width: 100%;
    }

    .mb-toast {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .layout-panel .mb-toast-container {
        inset: .75rem .75rem auto .75rem !important;
    }

    .layout-panel .mb-toast {
        width: 100%;
    }
}

/* =========================
   Brand Elements
   ========================= */

/* Wordmark */
.wordmark {
    text-decoration: none;
    font-size: 1.2rem;
}

.wordmark .wm-my {
    font-weight: 400;
    font-style: normal;
    color: var(--primary-colour);
}

.wordmark .wm-b {
    font-weight: 800;
    color: var(--secondary-colour);
}

/* End of wordmark */

/* Inverted wordmark */
.wordmark-inv .wm-my {
    color: var(--offwhite);
}

.wordmark-inv .wm-b {
    color: white;
}

/* End of inverted wordmark */

/* =========================
   Buttons
   ========================= */

/* Button styles (in addition to Bootstrap) */
.btn.mb-btn {
    background-color: var(--primary-colour);
    color: white;
    border-color: var(--primary-colour);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(76, 16, 40, 0.18);
}

.btn.mb-btn:hover {
    background-color: var(--secondary-colour);
    border-color: var(--secondary-colour);
    transform: translateY(-1px);
}


.btn.mb-btn-outline {
    background-color: transparent;
    border-color: var(--primary-colour);
    color: var(--primary-colour);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: var(--radius-sm);
}

.btn.mb-btn-outline:hover {
    background-color: var(--primary-colour);
    color: white;
    border-color: var(--primary-colour);
}

.btn.mb-btn-invert {
    background-color: var(--secondary-colour);
    color: white;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: var(--radius-sm);
}

.btn.mb-btn-invert:hover {
    background-color: var(--primary-colour);
    color: white;
 }

.btn.mb-btn-invert-dull {
    background-color: transparent;
    border-color: var(--offwhite-dim);
    color: var(--offwhite);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: var(--radius-sm);
}

.btn.mb-btn-invert-dull:hover {
    background-color: var(--offwhite);
    color: var(--primary-colour);
    border-color: var(--offwhite);
}

/* =========================
   Navigation
   ========================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav {
    border-bottom: 1px solid var(--border-soft);
    box-shadow: 0 8px 20px rgba(76, 16, 40, 0.08);
    background: var(--nav-surface);
    backdrop-filter: blur(6px);
}

.nav-inner {
    display: flex;
    align-items: center;
    min-height: 60px;
    gap: 1.5rem;
}

.nav-top-row {
    display: flex;
    align-items: center;
    min-height: 60px;
    gap: 1.5rem;
    min-width: 0;
}

.nav-menu {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

@media (min-width: 992px) {
    .nav-menu {
        display: flex;
        align-items: center;
        flex: 1;
    }
}



.nav-links {
    list-style: none;
    align-items: center;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: block;
    padding: .4rem .8rem;
    color: var(--text-colour);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background-color .2s, color .2s;
}

.nav-links a:hover {
    background: var(--tint-soft-strong);
    color: var(--primary-colour);
}

.nav-right {
    /* Lock to the right */
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.nav-toggle {
    background: none;
    border: 1px solid var(--border-soft);
    color: var(--primary-colour);
    padding: .3rem .55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-toggle:focus {
    box-shadow: none;
}

.nav-toggle i {
    font-size: 1.25rem;
    line-height: 1;
}

/* End of navbar */

/* =========================
   Shared Sections
   ========================= */

/* Section styles */
.section {
    padding: 5rem 0;
    background: var(--surface-colour);
}

.section-alt {
    background: #7f2a4d;
}

.section-dark {
    background: var(--primary-colour);
}

/* Section labels */
.s-label {
    display: inline-block;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: .75rem;
    color: var(--primary-colour);
}

.s-title {
    color: var(--primary-colour);
    letter-spacing: -0.01em;
}

/* =========================
   Panel Layout
   ========================= */

/* Panel styles */
.panel-container {
    min-height: 100vh;
    display: grid;
    /* Fluid left, with fixed 480px 'sidebar' */
    grid-template-columns: 1fr 480px;
}


.panel-aside {
    background: var(--panel-background);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    position: relative;
    overflow: hidden;
}

.panel-aside::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at -10% 110%, var(--panel-accent), transparent 55%),
    radial-gradient(ellipse 60% 40% at 110% -10%, var(--panel-accent), transparent 55%);
}

.panel-aside-body {
    position: relative;
    z-index: 1;
}

.panel-tagline {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    color: var(--offwhite);
    letter-spacing: -.04em;
    line-height: 1.15;
    margin: 3rem 0 1rem;
}

.panel-tagline em {
    color: var(--secondary-colour);
    font-style: normal;
}

.panel-aside p {
    color: var(--offwhite-dim);
    font-size: .9rem;
    line-height: 1.75;
    max-width: 360px;
    margin: 0;
}

.panel-trust {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    position: relative;
    z-index: 1;
}

.panel-trust-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .8rem;
    color: var(--offwhite-dim);
}

.main-panel {
    background: var(--surface-colour);
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.panel-form-shell {
    width: min(100%, 520px);
}

.panel-form-card {
    background: var(--surface-colour);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--surface-shadow);
    padding: 2rem;
}

.auth-heading {
    color: var(--primary-colour);
    margin: 0 0 .5rem;
}

.auth-meta {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.auth-form .form-control,
.auth-form .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-soft);
    padding: .75rem .9rem;
}

.auth-form .form-control:focus,
.auth-form .form-select:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 .25rem rgb(208 106 144 / 0.18);
}

/* Crispy non-field/login errors still render Bootstrap alerts; restyle them to match app tone. */
.auth-form .alert {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    box-shadow: none;
    padding: .7rem .9rem;
    margin-bottom: 1rem;
    font-size: .92rem;
}

.auth-form .alert-danger,
.auth-form .alert-error {
    border-color: #efc8cd;
    background: #fff1f2;
    color: #6f222a;
}

.auth-form .alert-warning {
    border-color: #f0debc;
    background: #fff8eb;
    color: #7b5312;
}

.auth-form .errorlist,
.auth-form .errorlist.nonfield {
    list-style: none;
    margin: .35rem 0 .75rem;
    padding: 0;
}

.auth-form .errorlist li {
    margin: 0;
    padding: .2rem 0;
}

/* MFA templates from allauth render plain HTML elements via {% element %}.
   These rules bring them in line with panel styling. */
.panel-form-shell.auth-form h1 {
    color: var(--primary-colour);
    margin: 0 0 .65rem;
    font-size: clamp(1.35rem, 2.5vw, 1.8rem);
    letter-spacing: -0.01em;
}

.panel-form-shell.auth-form h2 {
    color: var(--primary-colour);
    margin: 0 0 .55rem;
    font-size: 1.05rem;
}

.panel-form-shell.auth-form p {
    color: var(--text-muted);
    margin: 0 0 .9rem;
}

.panel-form-shell.auth-form hr {
    border-color: var(--border-soft);
    opacity: 1;
    margin: 1rem 0;
}

.panel-form-shell.auth-form form {
    margin: .75rem 0 1rem;
}

.panel-form-shell.auth-form form p {
    margin-bottom: .8rem;
}

.panel-form-shell.auth-form label {
    display: block;
    margin-bottom: .3rem;
    color: var(--text-colour);
    font-weight: 700;
    font-size: .9rem;
}

.panel-form-shell.auth-form input,
.panel-form-shell.auth-form textarea,
.panel-form-shell.auth-form select {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    padding: .7rem .85rem;
    color: var(--text-colour);
    background: #fff;
}

.panel-form-shell.auth-form input:focus,
.panel-form-shell.auth-form textarea:focus,
.panel-form-shell.auth-form select:focus {
    outline: none;
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 .25rem rgb(208 106 144 / 0.18);
}

.panel-form-shell.auth-form button,
.panel-form-shell.auth-form a[role="button"],
.panel-form-shell.auth-form a.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    background: var(--primary-colour);
    color: #fff;
    border: 1px solid var(--primary-colour);
    border-radius: var(--radius-sm);
    padding: .55rem .9rem;
    text-decoration: none;
    font-weight: 700;
    line-height: 1.2;
    margin-right: .45rem;
    margin-bottom: .45rem;
}

.panel-form-shell.auth-form button:hover,
.panel-form-shell.auth-form a[role="button"]:hover,
.panel-form-shell.auth-form a.button:hover {
    background: var(--secondary-colour);
    border-color: var(--secondary-colour);
    color: #fff;
}

.panel-form-shell.auth-form section {
    background: var(--surface-colour);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--surface-shadow);
    padding: 1rem;
    margin-bottom: .9rem;
}

.panel-form-shell.auth-form section ul {
    list-style: none;
    padding: 0;
    margin: .6rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.panel-form-shell.auth-form section ul li {
    margin: 0;
}

.panel-form-links {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    margin-top: 1rem;
    color: var(--text-muted);
}

.panel-form-links a {
    color: var(--primary-colour);
    font-weight: 700;
    text-decoration: none;
}

.panel-form-links a:hover {
    color: var(--secondary-colour);
}

/* =========================
   Footer
   ========================= */

/* Footer styles */
.site-footer {
    background: var(--footer-background);
    padding: 2.4rem 0 1.4rem;
    color: var(--footer-text);
}

.footer-main-row {
    align-items: start;
}

.footer-brand-copy {
    margin-top: .9rem;
    max-width: 32ch;
}

.footer-heading {
    margin: 0 0 .8rem;
    font-size: .8rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--offwhite);
}

.footer-link-list {
    margin: 0;
    font-size: .9rem;
    list-style: none;
}

.footer-link-list li + li {
    margin-top: .2rem;
}

.site-footer a {
    color: var(--footer-link);
    text-decoration: none;
    transition: color .2s ease, opacity .2s ease;
}

.site-footer a:hover {
    color: var(--footer-link-hover);
}

.site-footer a:focus-visible {
    outline-color: var(--footer-link-hover);
}

.footer-divider {
    margin: 1.4rem 0 1.1rem;
    border: 0;
    border-top: 1px solid var(--footer-divider-colour);
    opacity: 1;
}

.footer-legal {
    font-size: .78rem;
    line-height: 1.55;
    color: var(--footer-text-muted);
}

.footer-bottom-row {
    row-gap: .6rem;
}

.footer-email-link {
    color: var(--footer-text);
    font-weight: 600;
}

/* =========================
   Application Views
   ========================= */

.app-page {
    background: var(--background-colour);
    min-height: calc(100vh - 60px);
}

/* ── Page header ── */
.app-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.app-page-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .25rem;
}

.app-page-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--primary-colour);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

.app-page-subtitle {
    color: var(--text-muted);
    font-size: .95rem;
    margin-top: .2rem;
    margin-bottom: 0;
}

.app-breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .85rem;
    transition: color .15s;
    margin-bottom: .25rem;
}

.app-breadcrumb-link:hover {
    color: var(--primary-colour);
}

/* ── Cards ── */
.app-card {
    background: var(--surface-colour);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--surface-shadow);
    overflow: hidden;
}

.app-card--info {
    background: var(--tint-soft);
    box-shadow: none;
}

.app-card--warning {
    background: #fff8eb;
    border-color: #f0debc;
    box-shadow: none;
}

.app-card-header {
    padding: .85rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--tint-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.app-card-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--primary-colour);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .45rem;
}

.app-card-body {
    padding: 1.25rem 1.5rem;
}

.app-card-body.p-0 {
    padding: 0;
}

.app-hero-card {
    padding: 2rem;
}

/* ── Buttons ── */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .1s;
    line-height: 1.3;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}

.app-btn:hover {
    transform: translateY(-1px);
}

.app-btn:active {
    transform: none;
}

.app-btn-primary {
    background: var(--primary-colour);
    color: #fff;
    border-color: var(--primary-colour);
}

.app-btn-primary:hover {
    background: var(--secondary-colour);
    border-color: var(--secondary-colour);
    color: #fff;
}

.app-btn-secondary {
    background: var(--tint-soft);
    color: var(--primary-colour);
    border-color: var(--border-soft);
}

.app-btn-secondary:hover {
    background: var(--tint-soft-strong);
    color: var(--primary-colour);
}

.app-btn-outline {
    background: transparent;
    color: var(--primary-colour);
    border-color: var(--border-soft);
}

.app-btn-outline:hover {
    background: var(--tint-soft);
    color: var(--primary-colour);
}

.app-btn-danger-outline {
    background: transparent;
    color: #b91c1c;
    border-color: #fca5a5;
}

.app-btn-danger-outline:hover {
    background: #fee2e2;
    border-color: #b91c1c;
    color: #b91c1c;
}

.app-btn-sm {
    padding: .3rem .65rem;
    font-size: .82rem;
}

/* ── Badges ── */
.app-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .01em;
    white-space: nowrap;
}

.app-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.app-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.app-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.app-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.app-badge-secondary {
    background: var(--tint-soft);
    color: var(--text-muted);
}

/* ── Definition list ── */
.app-dl {
    display: grid;
    grid-template-columns: minmax(160px, auto) 1fr;
    gap: .6rem 1.25rem;
    margin: 0;
}

.app-dl dt {
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-muted);
    padding-top: .05rem;
}

.app-dl dd {
    margin: 0;
    font-size: .9rem;
    color: var(--text-colour);
}

/* ── Alerts ── */
.app-alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    font-size: .92rem;
    line-height: 1.5;
}

.app-alert--danger {
    background: #fff1f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.app-alert--info {
    background: var(--tint-soft);
    border-color: var(--border-soft);
    color: var(--text-colour);
}

.app-alert--warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #78350f;
}

.app-alert--success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}

/* ── Link ── */
.app-link {
    color: var(--primary-colour);
    text-decoration: none;
    font-weight: 600;
}

.app-link:hover {
    color: var(--secondary-colour);
    text-decoration: underline;
}

/* ── Empty state ── */
.app-empty-icon {
    font-size: 2rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: .75rem;
}

/* ── Stats / Tiles ── */
.app-title {
    color: var(--primary-colour);
    letter-spacing: -0.02em;
    margin: 0;
}

.app-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin-top: .75rem;
}

.app-subtitle-sm {
    font-size: .95rem;
}

.app-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    margin: 1rem 0 1.5rem;
}

.app-meta {
    color: var(--text-muted);
    font-size: .9rem;
}

.app-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .4rem .8rem;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.app-pill-warning {
    background: #fff2d8;
    color: #8b5a00;
}

.app-pill-success {
    background: #dff6ea;
    color: #146c43;
}

.app-stat-grid {
    margin-top: .25rem;
}

.app-stat-card {
    background: var(--tint-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.app-stat-value {
    color: var(--primary-colour);
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: .25rem;
}

.app-stat-label {
    color: var(--text-muted);
    font-size: .9rem;
}

.app-section-title {
    color: var(--primary-colour);
    margin-bottom: 1rem;
}

/* ── Timeline / Activity ── */
.app-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.app-timeline li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .9rem;
}

.app-timeline-marker {
    width: .75rem;
    height: .75rem;
    margin-top: .45rem;
    border-radius: 50%;
    background: var(--secondary-colour);
    box-shadow: 0 0 0 6px rgb(168 68 106 / 0.14);
}

.app-timeline-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .25rem;
}

.app-timeline-title-row h3 {
    color: var(--primary-colour);
    font-size: 1rem;
    margin: 0;
}

.app-timeline p,
.app-activity-list li,
.app-list span {
    color: var(--text-muted);
}

.app-list,
.app-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.app-list li {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}

.app-list i {
    color: var(--secondary-colour);
    margin-top: .15rem;
}

/* ── Table ── */
.app-table-wrap {
    overflow-x: auto;
}

.app-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-colour);
    --bs-table-border-color: var(--border-soft);
    margin: 0;
    font-size: .9rem;
}

.app-table thead th {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--tint-soft);
    border-bottom: 1px solid var(--border-soft);
    padding: .65rem 1rem;
}

.app-table td {
    padding: .75rem 1rem;
    vertical-align: middle;
}

.app-support-note {
    color: var(--text-muted);
    font-size: .9rem;
}

/* ── Form fields ── */
.app-main .form-control,
.app-main .form-select {
    border-color: var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text-colour);
    font-size: .92rem;
    background-color: #fff;
    padding: .55rem .85rem;
}

.app-main .form-control:focus,
.app-main .form-select:focus {
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 .22rem rgb(208 106 144 / 0.18);
    outline: none;
}

.app-main .form-control::placeholder {
    color: var(--text-muted);
    opacity: .7;
}

.app-main .form-label {
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-colour);
    margin-bottom: .3rem;
}

.app-main .form-text {
    font-size: .8rem;
    color: var(--text-muted);
}

.app-main .form-check-input {
    border-color: var(--border-soft);
    margin-top: .2rem;
}

.app-main .form-check-input:checked {
    background-color: var(--primary-colour);
    border-color: var(--primary-colour);
}

.app-main .form-check-input:focus {
    box-shadow: 0 0 0 .22rem rgb(208 106 144 / 0.18);
    border-color: var(--focus-ring);
}

.app-main .invalid-feedback {
    font-size: .82rem;
}

.app-main .input-group-text {
    background: var(--tint-soft);
    border-color: var(--border-soft);
    color: var(--text-muted);
    font-size: .9rem;
}

/* Cost total row */
.app-cost-total {
    background: var(--tint-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-cost-total-label {
    font-weight: 700;
    color: var(--text-colour);
    font-size: .92rem;
}

.app-cost-total-value {
    font-weight: 800;
    color: var(--primary-colour);
    font-size: 1.05rem;
}

/* Step indicator */
.app-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.app-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.app-step-num {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 800;
    background: var(--tint-soft);
    color: var(--text-muted);
    border: 2px solid var(--border-soft);
    flex-shrink: 0;
}

.app-step.is-active .app-step-num {
    background: var(--primary-colour);
    color: #fff;
    border-color: var(--primary-colour);
}

.app-step.is-done .app-step-num {
    background: #d1fae5;
    color: #065f46;
    border-color: #86efac;
}

.app-step-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.app-step.is-active .app-step-label {
    color: var(--primary-colour);
}

.app-step-divider {
    flex: 1 1 1.5rem;
    height: 2px;
    background: var(--border-soft);
    margin: 0 .35rem;
    flex-shrink: 0;
    min-width: 1rem;
    max-width: 3rem;
}

/* Document checklist */
.app-doc-checklist {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.app-doc-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .65rem .85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: #fff;
}

.app-doc-item.is-uploaded {
    background: #f0fdf4;
    border-color: #86efac;
}

.app-doc-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: .05rem;
}

.app-doc-item.is-uploaded .app-doc-item-icon {
    color: #16a34a;
}

.app-doc-item:not(.is-uploaded) .app-doc-item-icon {
    color: var(--text-muted);
}

.app-doc-item-body {
    flex: 1;
    min-width: 0;
}

.app-doc-item-title {
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-colour);
    margin: 0;
}

.app-doc-item-hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0;
}

.app-support-note a {
    color: var(--primary-colour);
    font-weight: 700;
    text-decoration: none;
}

.app-demo-banner {
    margin-bottom: 1rem;
    background: var(--tint-soft);
    border: 1px solid var(--border-soft);
    color: var(--primary-colour);
    border-radius: var(--radius-md);
    padding: .85rem 1rem;
    font-weight: 700;
}

.nav-user-chip {
    display: inline-flex;
    align-items: center;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: var(--tint-soft);
    color: var(--primary-colour);
    font-weight: 700;
    font-size: .9rem;
}

/* =========================
   App Shell / Sidebar Layout
   ========================= */

:root {
    --sidebar-width: 260px;
}

.app-shell {
    display: flex;
    min-height: 100dvh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--primary-colour);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    z-index: 100;
}

.app-sidebar-header {
    padding: 1.5rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.app-sidebar-logo {
    display: block;
    max-height: 44px;
    max-width: 180px;
    object-fit: contain;
}

.app-sidebar-inst-name {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: .6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-nav {
    flex: 1;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    overflow-y: auto;
}

.app-sidebar-section-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, 0.4);
    padding: .9rem .5rem .3rem;
}

.app-sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: .91rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.app-sidebar-nav-link i {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: .8;
}

.app-sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-sidebar-nav-link:hover i {
    opacity: 1;
}

.app-sidebar-nav-link.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 700;
}

.app-sidebar-nav-link.is-active i {
    opacity: 1;
}

.app-sidebar-footer {
    padding: .85rem .75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.app-sidebar-user {
    padding: .1rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.app-sidebar-user-name {
    font-size: .88rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-user-role {
    font-size: .75rem;
    color: rgba(255, 255, 255, 0.5);
}

.app-sidebar-logout {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: .88rem;
    transition: background .15s, color .15s;
    /* reset button defaults */
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.app-sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* App body */
.app-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--background-colour);
}

/* Mobile top bar */
.app-topbar {
    height: 56px;
    background: var(--surface-colour);
    border-bottom: 1px solid var(--border-soft);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(76, 16, 40, 0.06);
}

.app-topbar-logo {
    max-height: 30px;
    max-width: 110px;
    object-fit: contain;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.app-topbar-logout {
    color: var(--text-muted);
    font-size: 1.2rem;
    text-decoration: none;
    padding: .25rem .4rem;
    border-radius: var(--radius-sm);
    transition: color .15s, background .15s;
    /* reset button defaults */
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.app-topbar-logout:hover {
    color: var(--primary-colour);
    background: var(--tint-soft);
}

/* Sidebar toggle */
.app-sidebar-toggle {
    background: none;
    border: 1px solid var(--border-soft);
    color: var(--primary-colour);
    padding: .3rem .55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    line-height: 1;
    transition: background .15s;
}

.app-sidebar-toggle:hover {
    background: var(--tint-soft);
}

.app-sidebar-toggle:focus-visible {
    outline: 2px solid var(--focus-ring);
}

/* Main content */
.app-main {
    flex: 1;
    padding: 2rem;
}

/* Overlay for mobile sidebar */
.app-shell-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 90;
}

.app-shell-overlay.is-visible {
    display: block;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: calc(var(--sidebar-width) * -1);
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left .25s ease;
    }

    .app-sidebar.is-open {
        left: 0;
    }

    .app-main {
        padding: 1.25rem;
    }
}

/* =========================
   Homepage
   ========================= */

/* Public pages */
.public-page-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0 0 1.5rem;
}

.homepage-hero {
    padding-top: 2rem;
}

.homepage-container {
    background: var(--primary-colour);
    color: var(--offwhite-dim);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 3rem;
    border-radius: var(--radius-md);
    box-shadow: var(--surface-shadow);
}

.homepage-container em {
    color: var(--offwhite);
}

.s-label-inv {
    color: var(--offwhite-dim);
}

.homepage-hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    color: var(--offwhite);
    letter-spacing: -0.03em;
    margin: 0;
}

.homepage-hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.7;
}

.homepage-cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.homepage-cta-group .mb-btn-outline {
    color: var(--offwhite);
    border-color: var(--offwhite-dim);
}

.homepage-cta-group .mb-btn-outline:hover {
    border-color: var(--secondary-colour);
}

.homepage-trust-list {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    line-height: 1.5;
}

.homepage-metric-card {
    border: 1px solid var(--border-soft);
    background: var(--surface-colour);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius-md);
}

.homepage-metric-card hr {
    margin: 1.5rem 0;
    border-color: var(--border-soft);
}

.homepage-metric-value {
    color: var(--primary-colour);
    font-weight: 800;
    font-size: 1.15rem;
    margin-bottom: .3rem;
}

.homepage-metric-text {
    color: var(--text-muted);
    line-height: 1.6;
}

.homepage-steps {
    background: var(--surface-colour);
}

.homepage-step {
    background: var(--tint-soft);
    border: 1px solid var(--border-soft);
    padding: 1.3rem;
    border-radius: var(--radius-md);
    transition: transform .2s ease, box-shadow .2s ease;
}

.homepage-step-number {
    color: var(--secondary-colour);
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: .25rem;
}

.homepage-card,
.homepage-feature {
    background: var(--surface-colour);
    border: 1px solid var(--border-soft);
    padding: 1.3rem;
    border-radius: var(--radius-md);
    transition: transform .2s ease, box-shadow .2s ease;
}

.homepage-card-title {
    color: var(--primary-colour);
    font-size: 1.1rem;
    margin-bottom: .35rem;
}

.homepage-card p,
.homepage-feature p {
    color: var(--text-muted);
    line-height: 1.6;
}

.homepage-faq {
    background: var(--surface-colour);
}

/* FAQ */

.faq-list {
    display: grid;
    gap: .75rem;
}

.faq-item {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-colour);
}

.faq-btn {
    width: 100%;
    border: 0;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--primary-colour);
    background: var(--surface-colour);
    font-weight: 700;
    font-size: .96rem;
    line-height: 1.4;
}

.faq-btn:not(.collapsed) {
    color: var(--primary-colour);
    background: var(--tint-soft);
}

.faq-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.faq-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    color: var(--secondary-colour);
}

.faq-icon-plus,
.faq-icon-minus {
    font-size: 1rem;
    line-height: 1;
}

.faq-icon-minus {
    display: none;
}

.faq-btn:not(.collapsed) .faq-icon-plus {
    display: none;
}

.faq-btn:not(.collapsed) .faq-icon-minus {
    display: inline-block;
}

.faq-answer {
    padding: .75rem 1.25rem 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    background: var(--surface-colour);
}

.homepage-step:hover,
.homepage-card:hover,
.homepage-feature:hover {
    transform: translateY(-3px);
    box-shadow: var(--surface-shadow);
}

.homepage-final-cta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.homepage-final-title {
    color: var(--offwhite);
    margin: 0;
}

/* =========================
   Accessibility
   ========================= */

.btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 900px) {
    /* On small screens, take up whole screen */
    .panel-container {
        grid-template-columns: 1fr;
    }

    /* Hide aside */
    .panel-aside {
        display: none;
    }

    .homepage-container {
        padding: 2rem;
    }

    .homepage-metric-card {
        padding: 1.5rem;
    }

    .main-panel {
        padding: 2rem;
    }

}

@media (max-width: 991.98px) {
    .site-footer {
        padding: 2rem 0 1.25rem;
    }

    .footer-brand-copy {
        max-width: none;
    }

    .footer-bottom-row {
        justify-content: flex-start !important;
    }

    /* Mobile nav — links/buttons hidden by default, shown via is-mobile-open */
    .nav-menu,
    .nav-links,
    .nav-right {
        display: none;
    }

    .nav-inner {
        display: block;
        min-height: 60px;
    }

    .nav-top-row {
        gap: 1rem;
    }

    /* Nav becomes a full-screen overlay when open */
    .site-nav.is-mobile-open {
        position: fixed;
        inset: 0;
        z-index: 1099;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        border-bottom: none;
        box-shadow: none;
        background: var(--surface-colour);
        backdrop-filter: none;
    }

    .site-nav.is-mobile-open > .container {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .site-nav.is-mobile-open .nav-inner {
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
    }

    .site-nav.is-mobile-open .nav-top-row {
        min-height: 60px;
        gap: 1rem;
    }

    .site-nav.is-mobile-open .nav-menu {
        display: flex;
        flex: 1;
        flex-direction: column;
        width: 100%;
    }

    .site-nav.is-mobile-open .nav-links {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin: 0;
        padding: 1rem 0 0;
        gap: .35rem;
    }

    .site-nav.is-mobile-open .nav-links li {
        border-bottom: none;
    }

    .site-nav.is-mobile-open .nav-links a {
        padding: .9rem .8rem;
        font-size: 1.05rem;
        font-weight: 600;
        color: var(--text-colour);
        border-radius: var(--radius-sm);
        width: 100%;
    }

    .site-nav.is-mobile-open .nav-right {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        margin-top: auto;
        padding: 1.5rem 0 1rem;
        border-top: 1px solid var(--border-soft);
        gap: .75rem;
    }

    .site-nav.is-mobile-open .nav-right .btn {
        width: 100%;
        text-align: center;
    }

    .site-nav.is-mobile-open .nav-user-chip {
        width: 100%;
        justify-content: center;
    }

    .app-hero-card {
        padding: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .footer-bottom-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: .45rem;
    }
}
