/* =========================================================================
   BidBridge / Tender Brawus — Design System (2026)
   Loaded AFTER theme.css / theme-dashboard.css / page styles.
   Single source of truth for colours, type, spacing, radii, motion,
   density, page guides and SVG micro-animations.
   ========================================================================= */

/* ------------------------------- Tokens --------------------------------- */
:root,
html[data-theme="light"] {
    /* TZ light palette */
    --ds-bg-base: #F7F8FA;
    --ds-bg-surface: #FFFFFF;
    --ds-bg-elevated: #FFFFFF;
    --ds-bg-subtle: #F1F5F9;

    --ds-text-primary: #0F172A;
    --ds-text-secondary: #475569;
    --ds-text-muted: #94A3B8;
    /* Placeholder text is still text: #94A3B8 on white is only 2.4:1. */
    --ds-text-placeholder: #64748B;
    --ds-border: #E2E8F0;
    --ds-border-strong: #CBD5E1;

    --ds-brand: #1E4FD8;
    --ds-brand-hover: #1740B0;
    --ds-brand-soft: rgba(30, 79, 216, 0.10);
    --ds-brand-contrast: #FFFFFF;
    --ds-accent-cn: #C8102E;
    --ds-success: #16A34A;
    --ds-success-soft: rgba(22, 163, 74, 0.12);
    --ds-warning: #D97706;
    --ds-warning-soft: rgba(217, 119, 6, 0.14);
    --ds-danger: #DC2626;
    --ds-danger-soft: rgba(220, 38, 38, 0.12);
    --ds-info: #0891B2;
    --ds-info-soft: rgba(8, 145, 178, 0.12);

    --ds-input-bg: #FFFFFF;
    --ds-input-text: #0F172A;
    --ds-overlay: rgba(15, 23, 42, 0.52);

    --ds-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.08);
    --ds-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.05);
    --ds-shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.18), 0 6px 16px rgba(15, 23, 42, 0.08);

    /* Backwards-compatible aliases used by existing pages */
    --tb-bg: var(--ds-bg-base);
    --tb-surface: var(--ds-bg-surface);
    --tb-surface-2: #F1F5F9;
    --tb-elevated: var(--ds-bg-elevated);
    --tb-text: var(--ds-text-primary);
    --tb-text-muted: var(--ds-text-secondary);
    --tb-heading: var(--ds-text-primary);
    --tb-primary: var(--ds-brand);
    --tb-primary-hover: var(--ds-brand-hover);
    --tb-primary-soft: var(--ds-brand-soft);
    --tb-link: var(--ds-brand);
    /* Short aliases referenced by the design-system brief (focus rings etc.) */
    --brand: var(--ds-brand);
    --brand-hover: var(--ds-brand-hover);
    --tb-success: var(--ds-success);
    --tb-success-soft: var(--ds-success-soft);
    --tb-danger: var(--ds-danger);
    --tb-danger-soft: var(--ds-danger-soft);
    --tb-warning: var(--ds-warning);
    --tb-warning-soft: var(--ds-warning-soft);
    --tb-info: var(--ds-info);
    --tb-info-soft: var(--ds-info-soft);
    --tb-border: var(--ds-border);
    --tb-border-strong: var(--ds-border-strong);
    --tb-input-bg: var(--ds-input-bg);
    --tb-input-text: var(--ds-input-text);
    --tb-header-bg: var(--ds-bg-surface);
    --tb-sidebar-bg: var(--ds-bg-surface);
    --tb-footer-bg: var(--ds-bg-subtle);
    --tb-card-shadow: var(--ds-shadow-sm);
    --tb-radius: 12px;
    --tb-radius-sm: 8px;
    --tb-scrollbar: #CBD5E1;
    --tb-scrollbar-hover: #94A3B8;
    --tb-overlay: var(--ds-overlay);

    --bb-bg: var(--ds-bg-base);
    --bb-surface: var(--ds-bg-surface);
    --bb-surface-2: #F8FAFC;
    --bb-surface-3: #F1F5F9;
    --bb-text: var(--ds-text-primary);
    --bb-text-strong: var(--ds-text-primary);
    --bb-muted: var(--ds-text-secondary);
    --bb-faint: var(--ds-text-muted);
    --bb-border: var(--ds-border);
    --bb-border-soft: #EDF1F7;
    --bb-accent: var(--ds-brand);
    --bb-accent-strong: var(--ds-brand-hover);
    --bb-btn: var(--ds-brand);
    --bb-btn-hover: var(--ds-brand-hover);
    --bb-chip: var(--ds-brand-soft);
    --bb-chip-text: var(--ds-brand);
    --bb-input: var(--ds-input-bg);
    --bb-danger-bg: var(--ds-danger-soft);
    --bb-danger-text: var(--ds-danger);

    /* Typography */
    --ds-font-sans: "Inter", "Noto Sans SC", "Segoe UI", system-ui, -apple-system, sans-serif;
    --ds-font-display: "Manrope", "Inter", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
    --ds-font-cn: "Noto Sans SC", "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
    --ds-font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --ds-text-xs: 12px;
    --ds-text-sm: 14px;
    --ds-text-md: 16px;
    --ds-text-lg: 18px;
    --ds-text-xl: 20px;
    --ds-text-2xl: 24px;
    --ds-text-3xl: 30px;
    --ds-text-4xl: 36px;
    --ds-text-5xl: 48px;

    /* Spacing */
    --ds-space-1: 4px;
    --ds-space-2: 8px;
    --ds-space-3: 12px;
    --ds-space-4: 16px;
    --ds-space-5: 24px;
    --ds-space-6: 32px;
    --ds-space-7: 48px;
    --ds-space-8: 64px;

    /* Radii */
    --ds-radius-sm: 8px;
    --ds-radius-md: 12px;
    --ds-radius-lg: 16px;
    --ds-radius-pill: 999px;

    /* Motion */
    --ds-anim-fast: 150ms;
    --ds-anim-base: 200ms;
    --ds-anim-slow: 300ms;
    --ds-anim-onboarding: 600ms;
    --ds-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --ds-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --ds-guide-width: 420px;
    --ds-header-height: 68px;

    color-scheme: light;
}

html[data-theme="dark"] {
    --ds-bg-base: #0B1220;
    --ds-bg-surface: #111A2E;
    --ds-bg-elevated: #16223B;
    --ds-bg-subtle: #0E1728;

    --ds-text-primary: #E6EDF7;
    --ds-text-secondary: #9FB0C7;
    --ds-text-muted: #64748B;
    --ds-text-placeholder: #94A3B8;
    --ds-border: #1F2D4A;
    --ds-border-strong: #2B3D63;

    --ds-brand: #4C7DFF;
    --ds-brand-hover: #6B95FF;
    --ds-brand-soft: rgba(76, 125, 255, 0.16);
    --ds-brand-contrast: #081020;
    --ds-accent-cn: #E23B52;
    --ds-success: #22C55E;
    --ds-success-soft: rgba(34, 197, 94, 0.16);
    --ds-warning: #F59E0B;
    --ds-warning-soft: rgba(245, 158, 11, 0.16);
    --ds-danger: #F87171;
    --ds-danger-soft: rgba(248, 113, 113, 0.16);
    --ds-info: #22D3EE;
    --ds-info-soft: rgba(34, 211, 238, 0.15);

    --ds-input-bg: #0E1728;
    --ds-input-text: #E6EDF7;
    --ds-overlay: rgba(2, 6, 18, 0.72);

    /* Dark elevation: thin light borders + soft glow instead of heavy shadow */
    --ds-shadow-sm: 0 0 0 1px rgba(159, 176, 199, 0.10), 0 2px 8px rgba(0, 0, 0, 0.22);
    --ds-shadow-md: 0 0 0 1px rgba(159, 176, 199, 0.14), 0 12px 32px rgba(0, 0, 0, 0.38);
    --ds-shadow-lg: 0 0 0 1px rgba(159, 176, 199, 0.18), 0 28px 72px rgba(0, 0, 0, 0.52);

    --tb-bg: var(--ds-bg-base);
    --tb-surface: var(--ds-bg-surface);
    --tb-surface-2: var(--ds-bg-subtle);
    --tb-elevated: var(--ds-bg-elevated);
    --tb-text: var(--ds-text-primary);
    --tb-text-muted: var(--ds-text-secondary);
    --tb-heading: var(--ds-text-primary);
    --tb-primary: var(--ds-brand);
    --tb-primary-hover: var(--ds-brand-hover);
    --tb-primary-soft: var(--ds-brand-soft);
    --tb-link: var(--ds-brand-hover);
    --tb-success: var(--ds-success);
    --tb-success-soft: var(--ds-success-soft);
    --tb-danger: var(--ds-danger);
    --tb-danger-soft: var(--ds-danger-soft);
    --tb-warning: var(--ds-warning);
    --tb-warning-soft: var(--ds-warning-soft);
    --tb-info: var(--ds-info);
    --tb-info-soft: var(--ds-info-soft);
    --tb-border: var(--ds-border);
    --tb-border-strong: var(--ds-border-strong);
    --tb-input-bg: var(--ds-input-bg);
    --tb-input-text: var(--ds-input-text);
    --tb-header-bg: var(--ds-bg-surface);
    --tb-sidebar-bg: var(--ds-bg-surface);
    --tb-footer-bg: var(--ds-bg-subtle);
    --tb-card-shadow: var(--ds-shadow-sm);
    --tb-scrollbar: #1F2D4A;
    --tb-scrollbar-hover: #2B3D63;
    --tb-overlay: var(--ds-overlay);

    --bb-bg: var(--ds-bg-base);
    --bb-surface: var(--ds-bg-surface);
    --bb-surface-2: var(--ds-bg-subtle);
    --bb-surface-3: var(--ds-bg-elevated);
    --bb-text: var(--ds-text-primary);
    --bb-text-strong: var(--ds-text-primary);
    --bb-muted: var(--ds-text-secondary);
    --bb-faint: var(--ds-text-muted);
    --bb-border: var(--ds-border);
    --bb-border-soft: #1A2742;
    --bb-accent: var(--ds-brand);
    --bb-accent-strong: var(--ds-brand-hover);
    --bb-btn: var(--ds-brand);
    --bb-btn-hover: var(--ds-brand-hover);
    --bb-chip: var(--ds-brand-soft);
    --bb-chip-text: var(--ds-brand-hover);
    --bb-input: var(--ds-input-bg);
    --bb-danger-bg: var(--ds-danger-soft);
    --bb-danger-text: var(--ds-danger);

    color-scheme: dark;
}

/* --------------------------- Global foundation -------------------------- */
html {
    background: var(--ds-bg-base);
    scroll-behavior: smooth;
}

body,
body[data-theme-version],
body[data-theme] {
    font-family: var(--ds-font-sans);
    color: var(--ds-text-primary);
    background-color: var(--ds-bg-base);
    font-size: var(--ds-text-md);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html[lang="zh"] body,
body:lang(zh) {
    font-family: var(--ds-font-cn);
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.dashboard_bar,
.topbar h1,
.card-title,
.page-title {
    font-family: var(--ds-font-display);
    font-weight: 600;
    color: var(--ds-text-primary);
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h1, .h1 { font-size: var(--ds-text-3xl); }
h2, .h2 { font-size: var(--ds-text-2xl); }
h3, .h3 { font-size: var(--ds-text-xl); }
h4, .h4 { font-size: var(--ds-text-lg); }
h5, .h5 { font-size: var(--ds-text-md); }
h6, .h6 { font-size: var(--ds-text-sm); }

code, pre, kbd, samp,
.font-mono,
.tender-number,
.erp-number,
.hs-code,
.amount,
.money,
.balance-value {
    font-family: var(--ds-font-mono);
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--ds-brand);
    transition: color var(--ds-anim-fast) var(--ds-ease);
}
a:hover { color: var(--ds-brand-hover); }

::selection {
    background: var(--ds-brand);
    color: var(--ds-brand-contrast);
}

:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
#theme-toggle-btn:focus-visible {
    outline: 2px solid var(--ds-brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* The template sometimes removes outlines — restore for keyboard users. */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) { outline: none; }

/* ----------------------------- Surfaces --------------------------------- */
html, body, #main-wrapper, .content-body, .dashboard, .main {
    background-color: var(--ds-bg-base) !important;
    color: var(--ds-text-primary);
}

.nav-header,
.header,
.topbar {
    background-color: var(--ds-bg-surface) !important;
    border-color: var(--ds-border) !important;
    color: var(--ds-text-primary);
}

.deznav,
.sidebar,
.dashboard-sidebar {
    background-color: var(--ds-bg-surface) !important;
    border-color: var(--ds-border) !important;
}

/* ------------------------------- Footer ---------------------------------- */
/* Showcase footer ("site-footer"): a dark night band with a brand glow, four
   link columns, contacts, language pills and the copyright line. It stays dark
   in both themes on purpose — it marks the end of the page in the light admin
   area, too.
   The .footer class is kept as an anchor: the #main-wrapper > .footer rules
   further down still shift the content column past the fixed sidebar. */
.footer.site-footer {
    --sf-bg: #0B1220;
    --sf-bg-elev: #101B31;
    --sf-ink: rgba(230, 237, 247, 0.82);
    --sf-ink-strong: #EEF3FB;
    --sf-muted: rgba(203, 213, 225, 0.58);
    --sf-line: rgba(148, 163, 184, 0.2);
    --sf-link: #9BBAFF;
    --sf-link-hover: #D2DEFF;

    position: relative;
    overflow: hidden;
    isolation: isolate;
    background-color: var(--sf-bg) !important;
    color: var(--sf-ink);
    border-top: 1px solid var(--sf-line);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Decorative layer: brand glow + fading grid, clipped by overflow: hidden. */
.site-footer__glow {
    position: absolute;
    top: -25%;
    left: -10%;
    right: -10%;
    height: 150%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(46rem 22rem at 8% -10%, rgba(59, 119, 255, 0.26), transparent 62%),
        radial-gradient(38rem 20rem at 88% 0%, rgba(22, 54, 166, 0.34), transparent 64%);
}

.site-footer__glow::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
    background-size: 5rem 5rem;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 68%);
    mask-image: linear-gradient(to bottom, #000, transparent 68%);
}

.site-footer__inner {
    position: relative;
    z-index: 1;
    max-width: 78rem;
    margin: 0 auto;
    padding: 2.75rem 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(17rem, 1.1fr) minmax(0, 2fr);
    gap: 2.5rem 3rem;
    align-items: start;
}

/* Brand column */
.site-footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    color: var(--sf-ink-strong);
    text-decoration: none;
}

.site-footer__mark {
    display: inline-flex;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    filter: drop-shadow(0 6px 14px rgba(30, 79, 216, 0.45));
}

.site-footer__mark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.site-footer__brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.site-footer__brand-name {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.site-footer__brand-tagline {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sf-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-footer__lead {
    margin: 1rem 0 0;
    max-width: 34rem;
    color: var(--sf-ink);
}

.site-footer__assure {
    list-style: none;
    margin: 1.125rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.site-footer__assure li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--sf-line);
    border-radius: var(--ds-radius-pill);
    background: rgba(148, 163, 184, 0.07);
    font-size: 0.8125rem;
    color: var(--sf-muted);
}

.site-footer__assure li::before {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: var(--sf-link);
    flex: 0 0 auto;
}

.site-footer__cta {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.site-footer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.55rem 1.35rem;
    border-radius: var(--ds-radius-pill);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                border-color var(--ds-anim-fast) var(--ds-ease),
                color var(--ds-anim-fast) var(--ds-ease);
}

.site-footer__btn--primary {
    border: 1px solid transparent;
    background: var(--ds-brand);
    color: #fff;
}

.site-footer__btn--primary:hover,
.site-footer__btn--primary:focus-visible {
    background: var(--ds-brand-hover);
    color: #fff;
    transform: translateY(-1px);
}

.site-footer__btn--ghost {
    border: 1px solid var(--sf-line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--sf-ink-strong);
}

.site-footer__btn--ghost:hover,
.site-footer__btn--ghost:focus-visible {
    border-color: var(--sf-link);
    color: #fff;
    transform: translateY(-1px);
}

.site-footer__cta-note {
    margin: 0.75rem 0 0;
    max-width: 30rem;
    font-size: 0.8125rem;
    color: var(--sf-muted);
}

/* Link columns */
.site-footer__nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 1.75rem 2rem;
}

.site-footer__title {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sf-ink-strong);
}

.site-footer__col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-footer__col a {
    color: var(--sf-ink);
    text-decoration: none;
    transition: color var(--ds-anim-fast) var(--ds-ease);
}

.site-footer__col a:hover,
.site-footer__col a:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer__hint {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: var(--sf-muted);
}

.site-footer__contacts li {
    align-items: flex-start;
    gap: 0.55rem;
}

.site-footer__contacts svg {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin-top: 0.3rem;
    color: var(--sf-link);
}

.site-footer__contacts span {
    color: var(--sf-muted);
}

/* Bottom row: copyright + languages */
.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--sf-line);
}

.site-footer .copyright {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.site-footer .copyright p {
    margin: 0;
    text-align: left;
    font-size: 0.875rem;
    color: var(--sf-muted);
}

.site-footer .copyright a {
    color: var(--sf-link);
    font-weight: 600;
    text-decoration: none;
}

.site-footer .copyright a:hover,
.site-footer .copyright a:focus-visible {
    color: var(--sf-link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer__rights {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: rgba(203, 213, 225, 0.42);
}

.site-footer__langs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--sf-line);
    border-radius: var(--ds-radius-pill);
    background: rgba(148, 163, 184, 0.08);
}

.site-footer__lang {
    padding: 0.3rem 0.7rem;
    border-radius: var(--ds-radius-pill);
    font-size: 0.8125rem;
    color: var(--sf-muted);
    text-decoration: none;
    transition: color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease);
}

.site-footer__lang:hover,
.site-footer__lang:focus-visible {
    color: #fff;
}

.site-footer__lang.is-active {
    background: var(--ds-brand);
    color: #fff;
}

[data-density="compact"] .site-footer__inner {
    padding-top: 2rem;
    gap: 1.75rem;
}

@media (max-width: 1199.98px) {
    .site-footer__grid {
        grid-template-columns: minmax(15rem, 1fr) minmax(0, 1.6fr);
        gap: 2rem;
    }
}

@media (max-width: 991.98px) {
    .site-footer__grid {
        grid-template-columns: 1fr;
    }
    .site-footer__inner {
        padding: 2.25rem 1.25rem 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .site-footer__inner {
        padding: 1.75rem 1rem 1rem;
        gap: 1.75rem;
    }
    .site-footer__nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .site-footer__brand-tagline {
        white-space: normal;
    }
    .site-footer__cta {
        flex-direction: column;
        align-items: stretch;
    }
    .site-footer__btn {
        width: 100%;
    }
    .site-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    .site-footer .copyright p {
        text-align: center;
        width: 100%;
    }
    .site-footer__langs {
        align-self: center;
    }
}

/* --------------------- Footer in auth + dashboard shells ------------------ */
/* Both shells use a flex row that centers their single child. With the
   showcase footer as a body sibling it would land beside the card/shell
   instead of below it — turn the shells into columns and let the content
   wrapper keep the vertical centering. */

/* Auth: .auth-page__body handles the original centering, footer spans full width. */
.auth-page {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
}
.auth-page > .auth-page__body {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}
.auth-page > .auth-page__body > .auth-page__inner {
    max-width: 460px;
    width: 100%;
}
.auth-page > .footer.site-footer {
    align-self: stretch;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .auth-page > .auth-page__body { padding: 24px 16px; }
}
@media (max-height: 620px) and (min-width: 481px) {
    .auth-page > .auth-page__body { padding-top: 28px; }
}

/* Dashboard: body becomes a column so .dashboard stays centered above footer.
   180px bottom padding was for breathing room; reduced since footer is below. */
body.dashboard-shell {
    flex-direction: column;
    align-items: stretch;
}
body.dashboard-shell > .dashboard {
    flex: 1 0 auto;
    padding-bottom: 56px;
}
body.dashboard-shell > .footer.site-footer {
    flex-shrink: 0;
    width: 100%;
}

.card,
.dashboard-card,
.auth-card,
.tender-card,
.stat-card,
.panel,
.modal-content,
.dropdown-menu,
.topbar-user__dropdown {
    background-color: var(--ds-bg-surface);
    color: var(--ds-text-primary);
    border-color: var(--ds-border);
}

.card,
.dashboard-card,
.tender-card,
.stat-card,
.panel {
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-sm);
}

.modal-content,
.dropdown-menu,
.topbar-user__dropdown,
.popover {
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
}

.dropdown-menu,
.topbar-user__dropdown {
    border: 1px solid var(--ds-border);
}

.dropdown-item {
    color: var(--ds-text-primary);
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--ds-brand-soft);
    color: var(--ds-brand-hover);
}

hr { border-color: var(--ds-border); }

.text-muted { color: var(--ds-text-secondary) !important; }
.text-black { color: var(--ds-text-primary) !important; }
.text-primary { color: var(--ds-brand) !important; }
.text-success { color: var(--ds-success) !important; }
.text-danger { color: var(--ds-danger) !important; }
.text-warning { color: var(--ds-warning) !important; }
.text-info { color: var(--ds-info) !important; }

.bg-white, .bg-light { background-color: var(--ds-bg-surface) !important; }
.border { border-color: var(--ds-border) !important; }

/* ----------------------------- Controls --------------------------------- */
.btn {
    border-radius: var(--ds-radius-sm);
    font-weight: 600;
    font-family: var(--ds-font-sans);
    transition: background-color var(--ds-anim-fast) var(--ds-ease),
                border-color var(--ds-anim-fast) var(--ds-ease),
                color var(--ds-anim-fast) var(--ds-ease),
                transform var(--ds-anim-fast) var(--ds-ease),
                box-shadow var(--ds-anim-fast) var(--ds-ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.55; transform: none; }

.btn-primary,
.btn-brand {
    background-color: var(--ds-brand);
    border-color: var(--ds-brand);
    color: var(--ds-brand-contrast);
}
.btn-primary:hover, .btn-primary:focus,
.btn-brand:hover, .btn-brand:focus {
    background-color: var(--ds-brand-hover);
    border-color: var(--ds-brand-hover);
    color: var(--ds-brand-contrast);
}
.btn-outline-primary {
    color: var(--ds-brand);
    border-color: var(--ds-brand);
    background: transparent;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background: var(--ds-brand);
    border-color: var(--ds-brand);
    color: var(--ds-brand-contrast);
}
.btn-secondary, .btn-light {
    background: var(--ds-bg-subtle);
    border-color: var(--ds-border);
    color: var(--ds-text-primary);
}
.btn-secondary:hover, .btn-light:hover {
    background: var(--ds-brand-soft);
    border-color: var(--ds-brand);
    color: var(--ds-brand-hover);
}
.btn-success { background: var(--ds-success); border-color: var(--ds-success); color: #fff; }
.btn-danger { background: var(--ds-danger); border-color: var(--ds-danger); color: #fff; }
.btn-warning { background: var(--ds-warning); border-color: var(--ds-warning); color: #1F1300; }
.btn-info { background: var(--ds-info); border-color: var(--ds-info); color: #04252C; }

.form-control,
.form-select,
.custom-select,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea {
    background-color: var(--ds-input-bg);
    color: var(--ds-input-text);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    transition: border-color var(--ds-anim-fast) var(--ds-ease),
                box-shadow var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease);
}
.form-control:focus,
.form-select:focus,
select:focus,
input:focus,
textarea:focus {
    background-color: var(--ds-input-bg);
    color: var(--ds-input-text);
    border-color: var(--ds-brand);
    box-shadow: 0 0 0 3px var(--ds-brand-soft);
}
.form-control::placeholder,
input::placeholder,
textarea::placeholder { color: var(--ds-text-placeholder); opacity: 1; }

/* ------------------------------- Tables --------------------------------- */
.table {
    color: var(--ds-text-primary);
    border-color: var(--ds-border);
    --bs-table-bg: transparent;
    --bs-table-color: var(--ds-text-primary);
    --bs-table-border-color: var(--ds-border);
    --bs-table-hover-bg: var(--ds-brand-soft);
}
.table > :not(caption) > * > * {
    border-color: var(--ds-border);
    background-color: transparent;
    color: var(--ds-text-primary);
}
.table thead th {
    color: var(--ds-text-secondary);
    font-weight: 600;
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--ds-bg-subtle);
    border-bottom: 1px solid var(--ds-border);
}
.table tbody tr { transition: background-color var(--ds-anim-fast) var(--ds-ease); }
.table tbody tr:hover { background-color: var(--ds-brand-soft); }
.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: color-mix(in srgb, var(--ds-bg-subtle) 65%, transparent);
}

/* ------------------------------- Badges --------------------------------- */
.badge,
.chip,
.status-badge,
.ticket-status {
    border-radius: var(--ds-radius-pill);
    font-weight: 600;
    font-size: var(--ds-text-xs);
    line-height: 1.35;
    padding: 0.28em 0.7em;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.badge-primary, .badge-brand { background: var(--ds-brand-soft); color: var(--ds-brand-hover); border-color: color-mix(in srgb, var(--ds-brand) 28%, transparent); }
.badge-success { background: var(--ds-success-soft); color: var(--ds-success); border-color: color-mix(in srgb, var(--ds-success) 30%, transparent); }
.badge-warning { background: var(--ds-warning-soft); color: var(--ds-warning); border-color: color-mix(in srgb, var(--ds-warning) 30%, transparent); }
.badge-danger { background: var(--ds-danger-soft); color: var(--ds-danger); border-color: color-mix(in srgb, var(--ds-danger) 30%, transparent); }
.badge-info { background: var(--ds-info-soft); color: var(--ds-info); border-color: color-mix(in srgb, var(--ds-info) 30%, transparent); }
.badge-secondary { background: var(--ds-bg-subtle); color: var(--ds-text-secondary); border-color: var(--ds-border); }

/* ------------------------------ Header ---------------------------------- */
.header,
.topbar {
    min-height: var(--ds-header-height);
    border-bottom: 1px solid var(--ds-border);
    backdrop-filter: saturate(140%) blur(8px);
}

/* .topbar's backdrop-filter creates a stacking context. Lift it above
   content stacking contexts (ds-guide, card containers) so that the
   user dropdown (z-index: 100 inside .topbar) paints above them.
   Kept below ds-help (1080), off-canvas (1045), auth tools (1040). */
.topbar {
    position: relative;
    z-index: 1030;
}

.header-right .nav-link,
.topbar .icon,
.topbar-user__trigger,
.theme-toggle {
    color: var(--ds-text-secondary);
    border-radius: var(--ds-radius-sm);
    transition: color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                transform var(--ds-anim-fast) var(--ds-ease);
}
.header-right .nav-link:hover,
.topbar .icon:hover,
.topbar-user__trigger:hover,
.theme-toggle:hover {
    color: var(--ds-brand);
    background: var(--ds-brand-soft);
}
.header-right .nav-link:active,
.topbar .icon:active,
.theme-toggle:active { transform: scale(0.94); }

.header-right .nav-link .ds-icon,
.topbar .icon .ds-icon,
.theme-toggle .ds-icon {
    width: 22px;
    height: 22px;
    display: block;
}

/* Header search opens the same guide index as the Help button. */
.ds-header-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    min-width: 220px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
    cursor: pointer;
    transition: border-color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                color var(--ds-anim-fast) var(--ds-ease);
}
.ds-header-search:hover,
.ds-header-search:focus-visible {
    border-color: var(--ds-brand);
    background: var(--ds-bg-surface);
    color: var(--ds-text-primary);
}
.ds-header-search__text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
}
.ds-header-search__kbd {
    flex: 0 0 auto;
    padding: 0 5px;
    border: 1px solid var(--ds-border);
    border-radius: 4px;
    background: var(--ds-bg-surface);
    color: var(--ds-text-muted);
    font-family: var(--ds-font-mono);
    font-size: 11px;
    line-height: 17px;
}

/* --------------------------- Header scaling ------------------------------ */
/* Template facts (public/css/style.css):
   .header             height 7.5rem, padding-left 21.563rem (17rem ≤1400px)
   .header-content     padding-left 5.3125rem, padding-right 2.4rem
   .nav-header         21.563rem wide, 5rem from 1199px down
   .nav-control        absolute, right -4.0625rem (-2.75rem ≤767px) → the burger
                       lives *outside* .nav-header, in the header's own area
   .navbar-expand      keeps .navbar-collapse always expanded (no toggler), so
                       the whole icon row has to fit the remaining width.
   Below 992px the sidebar becomes an off-canvas drawer, but the template still
   reserved 17rem of left padding: on a 375px phone only ~100px was left and the
   icon row simply fell off the screen. Drop the sidebar offset, keep just the
   logo + burger lane, and let the title shrink instead of the controls. */
.header .navbar,
.header .navbar-collapse,
.header .header-content,
.header .header-left {
    min-width: 0;
}

.header .navbar-collapse {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.header .header-left {
    flex: 1 1 auto;
}

.header .header-left .dashboard_bar {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    /* 28px/24px fixed sizes of the template did not scale between 1024-1440px. */
    font-size: clamp(1.125rem, 0.55rem + 1.05vw, 1.75rem);
    line-height: 1.25;
}

.header .header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* The search pill is the widest control: let it shrink before the icon row. */
@media only screen and (max-width: 1399.98px) {
    .ds-header-search {
        min-width: 150px;
    }
    .ds-header-search__kbd {
        display: none;
    }
}

@media only screen and (max-width: 991.98px) {
    .header {
        height: 5rem;
        padding-left: 0;
        /* Width of the lane taken by the logo block + the burger (see below). */
        --tb-header-lane: 9.5rem;
    }
    .header .header-content {
        /* 5rem logo block + the burger lane (nav-control right -4.0625rem). */
        padding-left: var(--tb-header-lane);
        padding-right: 0.875rem;
        gap: 0.5rem;
    }
    .header .navbar-collapse {
        gap: 0.5rem;
    }
    .header-right > li:not(:first-child) {
        padding-left: 0;
    }
    .header-right {
        gap: 0.25rem;
    }
    .header-right .nav-item {
        flex: 0 0 auto;
    }
    /* 44px touch targets without growing the visual box. */
    .header-right .nav-link,
    .header-right .ds-header-search {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.75rem;
        min-height: 2.75rem;
        padding: 0.25rem 0.5rem;
        font-size: 1rem;
    }
    /* The name + role block is the first thing to go: the avatar stays. */
    .header-right .header-info {
        display: none;
    }
    .header-profile > .nav-link img {
        width: 2rem;
        height: 2rem;
        border-radius: 50%;
        object-fit: cover;
    }
    .header-profile .dropdown-menu {
        min-width: min(18.75rem, calc(100vw - 1rem));
    }
}

/* Phones: the burger moves closer (nav-control right -2.75rem), so the lane
   can shrink as well. */
@media only screen and (max-width: 767.98px) {
    .header {
        --tb-header-lane: 8.25rem;
    }
    .header .header-content {
        padding-right: 0.625rem;
    }
    /* The template hides the title here too; the page heading lives in the
       content area, and every pixel belongs to the controls. */
    .header .header-left .dashboard_bar {
        display: none;
    }
    .header-right {
        gap: 0.125rem;
    }
    .header-right .nav-link,
    .header-right .ds-header-search {
        min-width: 2.5rem;
        min-height: 2.5rem;
        padding: 0.25rem 0.375rem;
    }
    .header-right .nav-link .ds-icon,
    .header-right .ds-bell {
        width: 20px;
        height: 20px;
    }
}

@media only screen and (max-width: 379.98px) {
    /* 320px devices: the icon row still fits next to the burger lane. */
    .header {
        --tb-header-lane: 7.75rem;
    }
    .header .header-content {
        padding-right: 0.375rem;
    }
    .header-right .nav-link {
        min-width: 2.25rem;
        padding: 0.25rem;
    }
}

/* Notched devices: keep the lane and the right edge clear of the sensor area.
   Declared last so it always wins over the plain breakpoint values above. */
@supports (padding-left: env(safe-area-inset-left)) {
    @media only screen and (max-width: 991.98px) {
        .header .header-content {
            padding-left: calc(var(--tb-header-lane) + env(safe-area-inset-left, 0px));
            padding-right: calc(0.875rem + env(safe-area-inset-right, 0px));
        }
    }
}

.topbar-lang,
.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
}
.topbar-lang a,
.language-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 26px;
    padding: 0 7px;
    border-radius: var(--ds-radius-pill);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    text-decoration: none;
    transition: background-color var(--ds-anim-fast) var(--ds-ease), color var(--ds-anim-fast) var(--ds-ease);
}
.topbar-lang a:hover,
.language-switch a:hover { color: var(--ds-brand); background: var(--ds-brand-soft); }
.topbar-lang a.active,
.language-switch a.active { background: var(--ds-brand); color: var(--ds-brand-contrast); }

.ds-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: var(--ds-radius-sm);
    background: transparent;
    color: var(--ds-text-secondary);
    cursor: pointer;
    transition: color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                transform var(--ds-anim-fast) var(--ds-ease);
}
.ds-icon-btn:hover { color: var(--ds-brand); background: var(--ds-brand-soft); }
.ds-icon-btn:active { transform: scale(0.94); }

/* Theme icon: sun ←→ moon (transform/opacity only, no layout animation) */
.theme-icon {
    width: 22px;
    height: 22px;
    display: block;
    overflow: visible;
}
.theme-icon .ds-sun,
.theme-icon .ds-moon {
    transform-origin: 12px 12px;
    transition: transform var(--ds-anim-base) var(--ds-ease),
                opacity var(--ds-anim-base) var(--ds-ease);
}
.theme-icon .ds-moon { opacity: 0; transform: rotate(-70deg) scale(0.55); }
.theme-icon .ds-sun { opacity: 1; transform: rotate(0) scale(1); }
html[data-theme="dark"] .theme-icon .ds-sun { opacity: 0; transform: rotate(70deg) scale(0.55); }
html[data-theme="dark"] .theme-icon .ds-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-icon .ds-sun-rays { transition: opacity var(--ds-anim-base) var(--ds-ease); }
html[data-theme="dark"] .theme-icon .ds-sun-rays { opacity: 0; }

/* --------------------------- Page guide --------------------------------- */
.ds-guide {
    --ds-guide-accent: var(--ds-brand);
    position: relative;
    margin: 0 0 var(--ds-space-5);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    background: var(--ds-bg-surface);
    box-shadow: var(--ds-shadow-sm);
    overflow: clip;
    /* Lets the bar adapt to its own width (auth column, sidebar layouts)
       instead of guessing from the viewport. */
    container-type: inline-size;
    container-name: page-guide;
}

.ds-guide::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    z-index: 1;
    background: linear-gradient(90deg, var(--ds-brand), var(--ds-info), var(--ds-brand));
    background-size: 200% 100%;
    opacity: 0.85;
    animation: ds-guide-accent 10s linear infinite;
}

@keyframes ds-guide-accent {
    from { background-position: 0% 50%; }
    to { background-position: 200% 50%; }
}

.ds-guide__bar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 9px 12px;
    min-height: 54px;
    background:
        radial-gradient(120% 180% at 0% 0%, var(--ds-brand-soft), transparent 58%),
        linear-gradient(180deg, color-mix(in srgb, var(--ds-bg-surface) 72%, var(--ds-bg-subtle)), var(--ds-bg-surface));
    border-bottom: 1px solid transparent;
    transition: border-color var(--ds-anim-base) var(--ds-ease);
}

/* One-shot sheen on hover; purely decorative. */
.ds-guide__bar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.10) 46%, transparent 64%);
    transform: translateX(-130%);
}

.ds-guide__bar:hover::before {
    animation: ds-guide-sheen 900ms var(--ds-ease) 1;
}

@keyframes ds-guide-sheen {
    from { transform: translateX(-130%); }
    to { transform: translateX(130%); }
}

/* Accent hairline that appears when the guide is open. */
.ds-guide__bar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ds-brand), transparent);
    opacity: 0;
    transition: opacity var(--ds-anim-base) var(--ds-ease);
}

.ds-guide[data-open="true"] .ds-guide__bar { border-bottom-color: var(--ds-border); }
.ds-guide[data-open="true"] .ds-guide__bar::after { opacity: 0.6; }

.ds-guide__toggle {
    display: flex;
    align-items: center;
    flex: 1 1 240px;
    min-width: 0;
    gap: 10px;
    margin: -4px -6px;
    padding: 5px 6px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ds-text-primary);
    font-family: inherit;
    font-size: var(--ds-text-sm);
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--ds-anim-fast) var(--ds-ease);
}

.ds-guide__toggle:hover,
.ds-guide__toggle:focus-visible {
    background: var(--ds-brand-soft);
}

.ds-guide__badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
    padding: 3px 10px 3px 4px;
    border: 1px solid color-mix(in srgb, var(--ds-brand) 20%, transparent);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-brand-soft);
    color: var(--ds-brand-hover);
    font-size: var(--ds-text-xs);
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.ds-guide__badge-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ds-brand) 18%, transparent);
}

.ds-guide__badge-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.ds-guide__badge-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ds-brand) 30%, transparent);
    animation: ds-guide-halo 3.4s var(--ds-ease) infinite;
}

@keyframes ds-guide-halo {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ds-brand) 26%, transparent); }
    50% { box-shadow: 0 0 0 5px transparent; }
}

/* The check "draws itself" on hover/open. */
.ds-guide__check {
    --ds-dash: 24;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
}

.ds-guide__toggle:hover .ds-guide__check,
.ds-guide__toggle:focus-visible .ds-guide__check,
.ds-guide[data-open="true"] .ds-guide__check {
    animation: ds-draw 520ms var(--ds-ease-out) forwards;
}

.ds-guide__heading {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.ds-guide__heading-label {
    color: var(--ds-text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.ds-guide__heading-title {
    min-width: 0;
    overflow: hidden;
    color: var(--ds-text-primary);
    font-size: var(--ds-text-sm);
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-guide__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    margin-left: auto;
    border: 1px solid var(--ds-border);
    border-radius: 50%;
    background: var(--ds-bg-surface);
    color: var(--ds-text-secondary);
    transition: transform var(--ds-anim-base) var(--ds-ease),
                color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                border-color var(--ds-anim-fast) var(--ds-ease);
}

.ds-guide__chevron svg { width: 14px; height: 14px; display: block; }

.ds-guide[data-open="true"] .ds-guide__toggle .ds-guide__chevron {
    transform: rotate(180deg);
    color: var(--ds-brand);
    background: var(--ds-brand-soft);
    border-color: color-mix(in srgb, var(--ds-brand) 35%, transparent);
}

.ds-guide__meta {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 6px;
    margin-left: auto;
}

.ds-guide__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--ds-border);
    border-radius: 9px;
    background: color-mix(in srgb, var(--ds-bg-surface) 82%, var(--ds-bg-subtle));
    color: var(--ds-text-secondary);
    font-family: inherit;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                border-color var(--ds-anim-fast) var(--ds-ease),
                transform var(--ds-anim-fast) var(--ds-ease),
                box-shadow var(--ds-anim-fast) var(--ds-ease);
}

.ds-guide__action:hover,
.ds-guide__action:focus-visible {
    color: var(--ds-brand);
    background: var(--ds-brand-soft);
    border-color: color-mix(in srgb, var(--ds-brand) 45%, transparent);
    transform: translateY(-1px);
}

.ds-guide__action:active { transform: translateY(0); }

.ds-guide__action--primary {
    color: var(--ds-brand-contrast);
    background: linear-gradient(180deg, var(--ds-brand), var(--ds-brand-hover));
    border-color: transparent;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ds-brand) 30%, transparent);
}

.ds-guide__action--primary:hover,
.ds-guide__action--primary:focus-visible {
    color: var(--ds-brand-contrast);
    background: linear-gradient(180deg, var(--ds-brand-hover), var(--ds-brand));
    border-color: transparent;
    filter: brightness(1.04);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--ds-brand) 38%, transparent);
}

.ds-guide__action-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    transition: transform var(--ds-anim-fast) var(--ds-ease);
}

.ds-guide__action[data-guide-copy]:hover .ds-guide__action-icon { transform: rotate(-7deg) scale(1.06); }
.ds-guide__action[data-guide-print]:hover .ds-guide__action-icon { transform: translateY(2px); }
.ds-guide__action[data-help-open]:hover .ds-guide__action-icon { transform: rotate(-6deg) scale(1.05); }
.ds-guide__action--primary:hover .ds-guide__action-icon { animation: ds-guide-wave 620ms var(--ds-ease); }

@keyframes ds-guide-wave {
    0%, 100% { transform: rotate(0) scale(1); }
    30% { transform: rotate(-8deg) scale(1.08); }
    65% { transform: rotate(6deg) scale(1.04); }
}

.ds-guide__action.is-copied {
    color: var(--ds-success);
    background: var(--ds-success-soft);
    border-color: color-mix(in srgb, var(--ds-success) 45%, transparent);
}

.ds-guide__action.is-copied .ds-guide__action-icon {
    animation: ds-guide-pop 420ms var(--ds-ease-out);
}

@keyframes ds-guide-pop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.16); }
    100% { transform: scale(1); }
}

/* Narrow containers: icons only, then a single compact row. */
@container page-guide (max-width: 859.98px) {
    .ds-guide__action-label { display: none; }
    .ds-guide__action {
        width: 32px;
        padding: 0;
    }
}

@container page-guide (max-width: 599.98px) {
    .ds-guide__bar { gap: 8px; padding: 8px 10px; }
    .ds-guide__badge { padding: 3px; }
    .ds-guide__badge-text { display: none; }
    .ds-guide__heading-label { display: none; }
    .ds-guide__toggle { flex: 1 1 140px; gap: 8px; }
    .ds-guide__meta { gap: 4px; }
}

@container page-guide (max-width: 399.98px) {
    /* Wrapping beats an ellipsis: page titles are short, and truncating
       "Вход в аккаунт" to "Вход в ак…" reads like a bug. */
    .ds-guide__heading-title {
        font-size: 13px;
        white-space: normal;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    .ds-guide__chevron { width: 24px; height: 24px; }
    .ds-guide__action { width: 30px; height: 30px; }
}

/* Fallback for engines without container queries. */
@supports not (container-type: inline-size) {
    @media (max-width: 859.98px) {
        .ds-guide__action-label { display: none; }
        .ds-guide__action { width: 32px; padding: 0; }
    }
    @media (max-width: 599.98px) {
        .ds-guide__badge-text,
        .ds-guide__heading-label { display: none; }
        .ds-guide__badge { padding: 3px; }
    }
}

.ds-guide__body {
    display: none;
    padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-5);
    animation: ds-fade-in var(--ds-anim-base) var(--ds-ease);
}
.ds-guide[data-open="true"] .ds-guide__body { display: block; }

.ds-guide__toolbar {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    flex-wrap: wrap;
    margin-bottom: var(--ds-space-4);
}
.ds-guide__tabs {
    display: inline-flex;
    padding: 3px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
    border: 1px solid var(--ds-border);
}
.ds-guide__tab {
    border: 0;
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--ds-radius-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color var(--ds-anim-fast) var(--ds-ease), color var(--ds-anim-fast) var(--ds-ease);
}
.ds-guide__tab[aria-selected="true"] {
    background: var(--ds-bg-surface);
    color: var(--ds-brand-hover);
    box-shadow: var(--ds-shadow-sm);
}
.ds-guide__lang {
    margin-left: auto;
    display: inline-flex;
    gap: 2px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    padding: 2px;
    background: var(--ds-bg-subtle);
}
.ds-guide__lang button {
    border: 0;
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--ds-radius-pill);
    cursor: pointer;
}
.ds-guide__lang button[aria-pressed="true"] { background: var(--ds-brand); color: var(--ds-brand-contrast); }

.ds-guide__search {
    flex: 1 1 220px;
    min-width: 180px;
}
.ds-guide__search input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    font-size: var(--ds-text-sm);
}

.ds-guide__panel[hidden] { display: none !important; }
.ds-guide__panel h4 {
    font-size: var(--ds-text-lg);
    margin: 0 0 var(--ds-space-2);
}
.ds-guide__lead {
    color: var(--ds-text-secondary);
    margin: 0 0 var(--ds-space-4);
    font-size: var(--ds-text-sm);
}
.ds-guide__section {
    margin: 0 0 var(--ds-space-4);
    padding: 0;
}
.ds-guide__section h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: var(--ds-text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ds-text-secondary);
    font-weight: 700;
}
.ds-guide__steps {
    margin: 0;
    padding-left: 22px;
    color: var(--ds-text-primary);
    font-size: var(--ds-text-sm);
}
.ds-guide__steps li { margin-bottom: 6px; }
.ds-guide__steps li::marker { color: var(--ds-brand); font-weight: 700; }

.ds-guide__notes {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ds-guide__note {
    display: flex;
    gap: 9px;
    padding: 9px 11px;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-border);
    background: var(--ds-bg-subtle);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
}
.ds-guide__note strong { color: var(--ds-text-primary); }
.ds-guide__note--tip { border-left: 3px solid var(--ds-success); }
.ds-guide__note--warn { border-left: 3px solid var(--ds-warning); }
.ds-guide__note--error { border-left: 3px solid var(--ds-danger); }
.ds-guide__note--info { border-left: 3px solid var(--ds-info); }

.ds-guide__faq {
    border-top: 1px solid var(--ds-border);
    padding-top: var(--ds-space-3);
}
.ds-guide__faq details {
    border-bottom: 1px solid var(--ds-border);
    padding: 8px 0;
}
.ds-guide__faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ds-text-primary);
    font-size: var(--ds-text-sm);
}
.ds-guide__faq details p {
    margin: 7px 0 0;
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
}

.ds-guide__related {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--ds-space-3);
}
.ds-guide__related a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    text-decoration: none;
}
.ds-guide__related a:hover { color: var(--ds-brand); border-color: var(--ds-brand); background: var(--ds-brand-soft); }
.ds-guide__related-soon {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px dashed var(--ds-border-strong);
    border-radius: var(--ds-radius-pill);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
}

.ds-guide__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: var(--ds-space-4);
    padding-top: var(--ds-space-3);
    border-top: 1px solid var(--ds-border);
}
.ds-guide__version {
    margin-left: auto;
    color: var(--ds-text-secondary);
    font-size: 11px;
}

/* While search is active, hide sections without matches. */
.ds-guide__panel.is-search .ds-guide__section:not(.is-match):not(.ds-guide__faq),
.ds-guide__panel.is-search .ds-guide__lead:not(.is-match) { display: none; }
.ds-guide__faq.is-search details:not(.is-match) { display: none; }

/* --------------------------- Help centre -------------------------------- */
.ds-help {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--ds-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ds-anim-base) var(--ds-ease), visibility var(--ds-anim-base);
}
.ds-help[data-open="true"] { opacity: 1; visibility: visible; }
.ds-help__dialog {
    width: min(860px, 100%);
    max-height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
    overflow: hidden;
    transform: translateY(10px) scale(0.985);
    transition: transform var(--ds-anim-base) var(--ds-ease);
}
.ds-help[data-open="true"] .ds-help__dialog { transform: translateY(0) scale(1); }
.ds-help__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--ds-border);
}
.ds-help__head h3 { margin: 0; font-size: var(--ds-text-lg); }
.ds-help__head p { margin: 2px 0 0; color: var(--ds-text-secondary); font-size: var(--ds-text-xs); }
.ds-help__close { margin-left: auto; }
.ds-help__search {
    padding: 14px 18px;
    border-bottom: 1px solid var(--ds-border);
}
.ds-help__search input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: var(--ds-text-md);
}
.ds-help__list {
    overflow: auto;
    padding: 12px;
    display: grid;
    gap: 8px;
}
.ds-help__item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-bg-surface);
    color: var(--ds-text-primary);
    text-decoration: none;
    transition: border-color var(--ds-anim-fast) var(--ds-ease),
                background-color var(--ds-anim-fast) var(--ds-ease),
                transform var(--ds-anim-fast) var(--ds-ease);
}
.ds-help__item:hover {
    border-color: var(--ds-brand);
    background: var(--ds-brand-soft);
    color: var(--ds-text-primary);
    transform: translateY(-1px);
}
.ds-help__item strong { font-size: var(--ds-text-sm); }
.ds-help__item span { color: var(--ds-text-secondary); font-size: var(--ds-text-xs); }
.ds-help__tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-brand-soft);
    color: var(--ds-brand-hover) !important;
    font-size: 10px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.ds-help__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
}
.ds-help__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--ds-border);
    background: var(--ds-bg-subtle);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
}

/* --------------------------- Preferences -------------------------------- */
.ds-prefs {
    display: grid;
    gap: 10px;
    padding: 10px 12px 12px;
}.ds-prefs__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    font-weight: 600;
}
.ds-seg {
    display: inline-flex;
    width: 100%;
    padding: 3px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
}
.ds-seg button {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--ds-text-secondary);
    padding: 5px 6px;
    border-radius: var(--ds-radius-pill);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--ds-anim-fast) var(--ds-ease), color var(--ds-anim-fast) var(--ds-ease);
}
.ds-seg button[aria-pressed="true"] { background: var(--ds-brand); color: var(--ds-brand-contrast); }
.ds-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 38px;
    height: 22px;
    padding: 2px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-subtle);
    cursor: pointer;
    transition: background-color var(--ds-anim-fast) var(--ds-ease), border-color var(--ds-anim-fast) var(--ds-ease);
}
.ds-switch::after {
    content: "";
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ds-bg-surface);
    box-shadow: var(--ds-shadow-sm);
    transform: translateX(0);
    transition: transform var(--ds-anim-fast) var(--ds-ease), background-color var(--ds-anim-fast) var(--ds-ease);
}
.ds-switch[aria-checked="true"] { background: var(--ds-brand); border-color: var(--ds-brand); }
.ds-switch[aria-checked="true"]::after { transform: translateX(16px); background: #fff; }

/* --------------------------- 12-column grid ----------------------------- */
/* The brief asks for a 12-column grid inside a 1440px container. Existing
   screens keep their own layouts; new blocks should opt in with these
   utilities so gutters and breakpoints stay consistent. */
:root {
    --ds-container-max: 1440px;
    --ds-grid-gap: var(--ds-space-5);
    --ds-grid-gutter: clamp(16px, 2.2vw, 32px);
}
.ds-container {
    width: 100%;
    max-width: var(--ds-container-max);
    margin-inline: auto;
    padding-inline: var(--ds-grid-gutter);
}
.ds-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--ds-grid-gap);
}
.ds-span-1 { grid-column: span 1; }
.ds-span-2 { grid-column: span 2; }
.ds-span-3 { grid-column: span 3; }
.ds-span-4 { grid-column: span 4; }
.ds-span-5 { grid-column: span 5; }
.ds-span-6 { grid-column: span 6; }
.ds-span-7 { grid-column: span 7; }
.ds-span-8 { grid-column: span 8; }
.ds-span-9 { grid-column: span 9; }
.ds-span-10 { grid-column: span 10; }
.ds-span-11 { grid-column: span 11; }
.ds-span-12 { grid-column: span 12; }

/* ------------------------------ Density --------------------------------- */
html[data-density="compact"] {
    --ds-space-4: 12px;
    --ds-space-5: 18px;
    --ds-space-6: 26px;
    --ds-header-height: 58px;
}
html[data-density="compact"] body { font-size: 14px; }
html[data-density="compact"] .content-body { padding-top: 14px; }
html[data-density="compact"] .container-fluid { padding-left: 18px; padding-right: 18px; }
html[data-density="compact"] .card-body,
html[data-density="compact"] .dashboard-card { padding: 14px 16px; }
html[data-density="compact"] .table > :not(caption) > * > * { padding: 0.45rem 0.55rem; }
html[data-density="compact"] .ds-guide__body { padding: 12px 14px 16px; }
html[data-density="compact"] .ds-guide { margin-bottom: 16px; }
html[data-density="compact"] .btn { padding: 0.3rem 0.65rem; font-size: 13px; }

/* ------------------------- Animation primitives ------------------------- */
@keyframes ds-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes ds-breathe {
    0%, 100% { opacity: 0.82; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.035); }
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.78); }
}
@keyframes ds-draw {
    from { stroke-dashoffset: var(--ds-dash, 48); }
    to { stroke-dashoffset: 0; }
}
@keyframes ds-bell-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(13deg); }
    40% { transform: rotate(-11deg); }
    60% { transform: rotate(7deg); }
    80% { transform: rotate(-4deg); }
}
@keyframes ds-globe-wave {
    0%, 100% { transform: translateX(0) rotate(0); }
    35% { transform: translateX(2px) rotate(6deg); }
    70% { transform: translateX(-2px) rotate(-4deg); }
}
@keyframes ds-underline {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
@keyframes ds-progress-shine {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}
@keyframes ds-onboarding-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ds-lock-snap {
    0% { transform: translateY(-4px); opacity: 0; }
    55% { transform: translateY(0); opacity: 1; }
    70% { transform: translateX(-1.5px); }
    82% { transform: translateX(1.5px); }
    100% { transform: translateX(0); }
}

.ds-spinner { width: 22px; height: 22px; animation: ds-spin 900ms linear infinite; transform-origin: 50% 50%; }
.ds-logo-breathe { animation: ds-breathe 6s ease-in-out infinite; transform-origin: 50% 50%; }
.ds-empty-illustration { animation: ds-breathe 5.5s ease-in-out infinite; transform-origin: 50% 50%; }
.ds-bell.is-ringing { animation: ds-bell-shake 700ms var(--ds-ease); transform-origin: 50% 10%; }
.ds-price-min { position: relative; color: var(--ds-success); font-weight: 700; white-space: nowrap; }
.ds-price-min::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -3px;
    height: 2px;
    background: linear-gradient(90deg, var(--ds-success), color-mix(in srgb, var(--ds-success) 30%, transparent));
    border-radius: 2px;
    transform-origin: left;
    animation: ds-underline 500ms var(--ds-ease-out) both;
}
.ds-status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ds-success);
    box-shadow: 0 0 0 3px var(--ds-success-soft);
    animation: ds-pulse-dot 2s ease-in-out infinite;
}
.ds-progress { position: relative; overflow: hidden; border-radius: var(--ds-radius-pill); background: var(--ds-bg-subtle); }
.ds-progress .progress-bar,
.ds-progress-bar {
    background: linear-gradient(90deg, var(--ds-brand), var(--ds-info));
    position: relative;
    overflow: hidden;
}
.ds-progress .progress-bar::after,
.ds-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 45%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: ds-progress-shine 2.4s var(--ds-ease) infinite;
    transform: translateX(-100%);
}
.ds-onboarding > * { animation: ds-onboarding-in var(--ds-anim-onboarding) var(--ds-ease-out) both; }
.ds-onboarding > *:nth-child(2) { animation-delay: 90ms; }
.ds-onboarding > *:nth-child(3) { animation-delay: 180ms; }
.ds-onboarding > *:nth-child(4) { animation-delay: 270ms; }
.ds-onboarding > *:nth-child(5) { animation-delay: 360ms; }
.ds-onboarding > *:nth-child(6) { animation-delay: 450ms; }
.ds-verified .ds-check { stroke-dasharray: 30; stroke-dashoffset: 30; animation: ds-draw 700ms var(--ds-ease-out) forwards; }
.ds-escrow .ds-lock { animation: ds-lock-snap 600ms var(--ds-ease-out) both; transform-origin: 50% 50%; }
.ds-translate .ds-globe { animation: ds-globe-wave 2.8s ease-in-out infinite; transform-origin: 50% 50%; }

/* Status semantics are never colour-only: dot/icon + text. */
.ds-status { display: inline-flex; align-items: center; gap: 7px; }
.ds-status .ds-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.ds-status--active { color: var(--ds-success); }
.ds-status--escrow { color: var(--ds-info); }
.ds-status--verified { color: var(--ds-success); }
.ds-status--signed { color: var(--ds-brand); }
.ds-status--warning { color: var(--ds-warning); }
.ds-status--danger { color: var(--ds-danger); }

/* Country chips */
.ds-country { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--ds-radius-pill); border: 1px solid var(--ds-border); font-size: 11px; font-weight: 700; }
.ds-country--ru { background: color-mix(in srgb, var(--ds-brand) 10%, transparent); color: var(--ds-brand-hover); }
.ds-country--cn { background: color-mix(in srgb, var(--ds-accent-cn) 11%, transparent); color: var(--ds-accent-cn); border-color: color-mix(in srgb, var(--ds-accent-cn) 28%, transparent); }

/* ------------------------ Motion preferences ----------------------------- */
html[data-animations="off"] *,
html[data-animations="off"] *::before,
html[data-animations="off"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
        scroll-behavior: auto !important;
    }
    .ds-spinner { animation: ds-spin 1.2s linear infinite !important; } /* critical loading indicator */
}

/* ------------------------------ Mobile ---------------------------------- */
.auth-page__tools {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1040;
    display: flex;
    gap: 8px;
}
.auth-page__tools .ds-icon-btn {
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-sm);
}
.header-profile .dropdown-menu,
.topbar-user__dropdown {
    min-width: 300px;
}
.header-profile .dropdown-menu .ds-prefs,
.topbar-user__dropdown .ds-prefs {
    min-width: 276px;
}

/* Legacy forms use a visually hidden file input for photo uploads. Some
   templates size it with a broad input rule, which pushed the document
   scrollWidth ~724px past the viewport. Keep it focusable and clickable
   from its label, but out of layout flow. */
.photo-input-hidden {
    position: fixed !important;
    left: -10000px !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    max-width: 1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
}

/* The pill with a label needs ~220px, which the header does not have next to
   the sidebar below 1200px. Collapse it to an icon button instead of removing
   the guide search entirely. */
@media (max-width: 1199.98px) {
    .ds-header-search {
        min-width: 0;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    .ds-header-search__text,
    .ds-header-search__kbd {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .ds-header-search {
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* Dashboard-new topbar: title plus icon row. With theme/language/notifications
   (and the guide search icon) the row exceeded the 1024px content column and
   pushed the document 3-32px wide. Allow wrapping and tighten gaps. */
.topbar { flex-wrap: wrap; gap: 10px 20px; }
.topbar h1 { min-width: 0; }
.topbar .icons { flex-wrap: wrap; justify-content: flex-end; min-width: 0; margin-left: auto; }

@media (max-width: 1199.98px) {
    .topbar { gap: 10px 14px; }
    .topbar .icons { gap: 14px; }
    .topbar-user__name { max-width: 110px; }
}

@media (max-width: 767.98px) {
    :root { --ds-guide-width: 100%; }
    .ds-guide__toolbar { align-items: stretch; }
    .ds-guide__lang { margin-left: 0; }
    .ds-help { padding: 10px; }
    .ds-help__dialog { max-height: 88vh; }
    .header .dashboard_bar { font-size: 16px; }
    .topbar { gap: 6px; }
    .topbar-lang a { min-width: 26px; padding: 0 5px; }
    .ds-grid > [class*="ds-span-"] { grid-column: 1 / -1; }
}

/* Admin / legacy layouts keep a fixed 345px sidebar offset in style.css.
   Below 992px that offset squeezed .content-body to 15px at 360px wide.
   Turn the sidebar into an off-canvas drawer instead. */
@media only screen and (max-width: 991.98px) {
    #main-wrapper .content-body {
        margin-left: 0 !important;
        width: auto;
    }
    #main-wrapper .deznav {
        position: fixed;
        top: 5rem;
        left: 0;
        width: min(86vw, 21.563rem);
        height: calc(100% - 5rem);
        padding-top: 1rem;
        transform: translateX(-102%);
        transition: transform var(--ds-anim-base) var(--ds-ease);
        z-index: 1045;
        overflow-y: auto;
    }
    #main-wrapper.menu-toggle .deznav {
        transform: translateX(0);
    }
    #main-wrapper .footer {
        padding-left: 0;
    }
    #main-wrapper .admin-sidebar-stable {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .ds-help__item { padding: 10px 11px; }
    .ds-guide__search { flex-basis: 100%; }
}

/* --------------------- Legacy page responsive fixes --------------------- */
/* applicationsNew.blade.php hard-codes a 1fr/auto grid with 34px side
   padding and three unwrapped 18px tabs. At 360px that pushed the document
   to 392px. Keep the form column fluid and let the tabs wrap. */
@media (max-width: 991.98px) {
    .content-body:has(> .content-col-form) {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .content-body:has(> .content-col-form).tab-completed {
        padding-left: 0;
        padding-right: 0;
    }
    .content-tabs {
        flex-wrap: wrap;
        gap: 8px 10px;
        margin-bottom: 22px;
    }
    .content-tab {
        flex: 0 1 auto;
        min-width: 0;
        height: auto;
        padding: 8px 14px;
        font-size: 15px;
        line-height: 20px;
    }
    .content-body.tab-completed .content-col-form .content-tabs {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* profileUserNew.blade.php keeps a 180px label column via a more
       specific selector than its own mobile media query. Its 125px photo
       label then overflowed a 360px viewport by 27px. */
    .main .content {
        max-width: 100%;
        padding: 24px 18px;
    }
    .main .content .form-group,
    .main .content .form-group-photo,
    .main .content .grid-left .card:last-child .form-group,
    .main .content .grid-left .card:last-child .form-group-photo {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }
    .main .content .photo-upload,
    .main .content .photo-upload-label,
    .main .content .photo-thumbs {
        min-width: 0;
        max-width: 100%;
    }
    .main .content .photo-upload-label {
        flex-wrap: wrap;
        word-break: break-word;
    }
}

/* ------------------------------ Sticky footer --------------------------- */
/* Short pages (/notifications with an empty list, /wallet, /tariffs) left the
   footer floating in the middle of the viewport: #main-wrapper had no height
   of its own and .content-body no min-height, so .footer simply followed the
   last line of text. .nav-header, .deznav and .chatbox are positioned out of
   the flow, so making the wrapper a flex column only affects .header,
   .content-body and .footer — the sidebar and header keep their offsets. */
#main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main-wrapper > .content-body {
    flex: 1 0 auto;
}

#main-wrapper > .footer {
    flex-shrink: 0;
}

/* --------------------- Desktop sidebar: own scrollbar ------------------- */
/* Admin pages load only vendor/global/global.min.js, so custom.js and
   deznav-init.js never run there: <body> never gets
   data-sidebar-position="fixed" / data-layout="vertical", .deznav stays
   position:absolute with height:100%. On long pages (/admin/tariffs,
   /admin/audit) #main-wrapper grows with the content, the sidebar becomes as
   tall as the page and .deznav-scroll never overflows — the menu cannot be
   scrolled, it just rides along with the document.
   Pin the sidebar (and the logo block above it) to the viewport and give
   .deznav-scroll its own overflow. Below 992px the off-canvas drawer rules
   further up stay in charge. */
@media only screen and (min-width: 992px) {
    #main-wrapper > .nav-header {
        position: fixed;
        top: 0;
        left: 0;
    }

    #main-wrapper > .deznav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: auto;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #main-wrapper > .deznav > .deznav-scroll {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: var(--ds-border-strong) transparent;
    }

    #main-wrapper > .deznav > .deznav-scroll::-webkit-scrollbar {
        width: 6px;
    }

    #main-wrapper > .deznav > .deznav-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    #main-wrapper > .deznav > .deznav-scroll::-webkit-scrollbar-thumb {
        background: var(--ds-border-strong);
        border-radius: 999px;
    }

    #main-wrapper > .deznav > .deznav-scroll::-webkit-scrollbar-thumb:hover {
        background: var(--ds-text-muted);
    }
}

/* 992-1199px: style.css narrows .nav-header to 5rem but keeps .footer at
   17rem, which shifted the copyright off-centre. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    #main-wrapper > .footer {
        padding-left: 21.563rem;
    }
}

/* Burger collapse on desktop. Admin pages never run js/custom.js, so the
   template's data-sidebar-style="collapsed" path does not initialise;
   design-system.js toggles the same .sidebar-hide class. Below 992px the
   off-canvas drawer rules above stay in charge. */
@media only screen and (min-width: 992px) {
    #main-wrapper > .deznav {
        transition: transform var(--ds-anim-base) var(--ds-ease);
    }
    #main-wrapper.sidebar-hide > .deznav {
        transform: translateX(-102%);
    }
    #main-wrapper.sidebar-hide > .content-body,
    #main-wrapper.sidebar-hide > .footer,
    #main-wrapper.sidebar-hide > .header {
        padding-left: 0;
    }
    /* The logo block is the header of the sidebar: it has to narrow together
       with it, otherwise a 21.5rem white strip stayed on screen. The burger
       lives in .nav-header, so it stays reachable after collapsing. */
    #main-wrapper.sidebar-hide > .nav-header {
        width: 5rem;
    }
    #main-wrapper.sidebar-hide .brand-text {
        display: none;
    }
    #main-wrapper.sidebar-hide > .nav-header .brand-logo {
        padding-left: 0;
        padding-right: 0;
        gap: 0;
        justify-content: center;
    }
    /* .nav-control sticks out to the right of .nav-header, so the header row
       needs the same lane as on tablets. */
    #main-wrapper.sidebar-hide > .header > .header-content {
        padding-left: 9.5rem;
    }
}

/* ----------------------------- Brand lockup ----------------------------- */
/* Vector logo: a blue badge with a bridge span plus a real text wordmark, so
   it stays crisp at any DPI and follows the theme tokens. Replaces the old
   raster pair (logo.png missing, logo-text.png 1536x1024 squeezed into 120px). */
.nav-header .brand-logo {
    padding-left: 26px;
    padding-right: 20px;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.brand-mark {
    display: inline-flex;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
}

.brand-mark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    gap: 2px;
}

.brand-name {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.4px;
    color: var(--ds-text-primary);
    white-space: nowrap;
}

.brand-name__accent {
    color: var(--ds-brand);
}

.brand-tagline {
    font-size: 9.5px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ds-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ≤1199px the template shrinks .nav-header to 5rem (80px) and hides
   .brand-title — keep only the mark, centred and without the desktop padding,
   otherwise the 40px badge was clipped by the 46px of padding. */
@media only screen and (max-width: 1199.98px) {
    .brand-text {
        display: none;
    }

    .nav-header .brand-logo {
        padding-left: 0;
        padding-right: 0;
        gap: 0;
        justify-content: center;
    }
}

/* Same lockup inside the dashboard-new sidebar card. There is no .nav-header
   wrapper there, so the flex row and the custom-logo <img> variants are
   declared locally: style.css, which sizes .logo-abbr/.brand-title, is not
   loaded on that layout, so an uploaded logo would have rendered at its
   natural (huge) size. */
.sidebar .brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.sidebar .brand-mark {
    transition: transform var(--ds-anim-base) var(--ds-ease);
}

.sidebar .brand-logo:hover .brand-mark {
    transform: translateY(-1px);
}

.sidebar .brand-logo .logo-abbr {
    display: block;
    height: 36px;
    width: auto;
    max-width: 64px;
    object-fit: contain;
}

.sidebar .brand-logo .brand-title {
    display: block;
    height: 26px;
    width: auto;
    max-width: 148px;
    object-fit: contain;
}

/* The compact wordmark is only meaningful in the collapsed AdminLTE rail. */
.sidebar .brand-logo .logo-compact {
    display: none;
}

/* --------------------------- Demo read-only mode ------------------------- */
/* Плашка поверх контента, когда внутри демо-учётка Администратора площадки
   (QaTestAccounts::isReadOnly). Кнопки на странице не выключаются — блокирует
   middleware EnforceDemoReadOnly, а здесь показывается его ответ, если
   сохранение всё-таки попробовали отправить. */
.demo-notice {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ds-space-2) var(--ds-space-3);
    margin: 0 0 var(--ds-space-4);
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--ds-warning) 34%, transparent);
    border-left: 3px solid var(--ds-warning);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-warning-soft);
    color: var(--ds-text-primary);
    font-size: 13px;
    line-height: 1.45;
}

.demo-notice__icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--ds-warning);
}

.demo-notice__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.demo-notice__text {
    font-weight: 600;
}

.demo-notice__blocked {
    padding: 3px 10px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-danger-soft);
    color: var(--ds-danger);
    font-size: 12.5px;
    font-weight: 600;
}

/* ------------------------------ Pagination ------------------------------ */
/* Laravel's default links() view is written for Tailwind, which this project
   does not ship: `w-5 h-5` never applied, so the chevron SVGs expanded to the
   full width of the container and pushed the page numbers off screen.
   resources/views/vendor/pagination/tb.blade.php renders this markup instead;
   the SVGs below are sized explicitly, never by a utility class. */
.tb-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    width: 100%;
}

.tb-pagination__info {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ds-text-secondary);
}

.tb-pagination__list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tb-pagination__item {
    display: flex;
}

.tb-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-bg-surface);
    color: var(--ds-text-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* Explicit box: without it the inline SVG falls back to its intrinsic size. */
.tb-pagination__btn svg {
    display: block;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

a.tb-pagination__btn:hover {
    border-color: var(--ds-brand);
    background: var(--ds-bg-subtle);
    color: var(--ds-brand);
    text-decoration: none;
}

.tb-pagination__btn:focus-visible {
    outline: 2px solid var(--ds-brand);
    outline-offset: 2px;
}

.tb-pagination__item--current .tb-pagination__btn {
    border-color: var(--ds-brand);
    background: var(--ds-brand);
    color: var(--ds-brand-contrast);
}

.tb-pagination__item--disabled .tb-pagination__btn {
    color: var(--ds-text-muted);
    opacity: .55;
    cursor: default;
}

.tb-pagination__gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 36px;
    color: var(--ds-text-muted);
    font-size: 13px;
}

@media (max-width: 575.98px) {
    .tb-pagination {
        justify-content: center;
    }

    .tb-pagination__info {
        width: 100%;
        text-align: center;
    }

    .tb-pagination__btn {
        min-width: 40px;
        height: 40px;
        padding: 0 8px;
    }

    .tb-pagination__gap {
        height: 40px;
        min-width: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tb-pagination__btn {
        transition: none;
    }
}

/* ------------------------------- Print ---------------------------------- */
@media print {
    .header, .nav-header, .deznav, .sidebar, .footer, .ds-guide__bar,
    .ds-guide__toolbar, .ds-guide__footer, .ds-help, .theme-toggle { display: none !important; }
    .ds-guide { border: 0; box-shadow: none; }
    .ds-guide__body { display: block !important; padding: 0; }
    body { background: #fff !important; color: #000 !important; }
}
