﻿/**
 * Shared UI primitives (used with Tailwind CDN fallback or alongside Vite).
 * Brand palette matches resources/css/app.css @theme.
 */

/* Mobile viewport: correct scale + avoid iOS shrinking body text; prevent sideways scroll */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Defensive: no descendant should ever be able to force a horizontal scrollbar
   on phones. Long unbroken strings (emails, transaction IDs) wrap instead. */
img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

@media (max-width: 639px) {
    body,
    body * {
        min-width: 0;
    }
}

/* Sticky nav: full app name on 2 lines max (no single-line "Fâ€¦"); optional single-line short name.
   Font-size scales fluidly with the viewport so long brand names (e.g. "FUEL DEBTORS MANAGEMENT SYSTEM")
   shrink to fit on 320px phones without a manual breakpoint. */
.app-header-brand-title {
    font-size: clamp(0.85rem, 0.65rem + 0.95vw, 1.1rem);
}

/* Station logo in the sticky header.
   - Fluidly sized so the image is clearly visible without dominating the bar
   - `object-cover` (applied on the inner <img>) fills the frame edge-to-edge,
     giving a professional, cropped look for photo logos or badge marks. */
.app-header-logo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(2.75rem, 2rem + 3vw, 3.5rem);
    height: clamp(2.75rem, 2rem + 3vw, 3.5rem);
    border-radius: 0.875rem;
    overflow: hidden;
    background-color: #fff;
    box-shadow:
        0 1px 2px rgb(15 23 42 / 0.08),
        0 0 0 1px rgb(226 232 240 / 0.9);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.app-header-logo:hover,
.app-header-logo:focus-within {
    box-shadow:
        0 6px 18px -6px rgb(15 23 42 / 0.25),
        0 0 0 1px rgb(203 213 225 / 0.9);
    transform: translateY(-1px);
}

.app-header-logo > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Placeholder (shield) variant inherits the same frame but with a brand gradient
   and a centred icon, so the nav still looks finished before a logo is uploaded. */
.app-header-logo--placeholder {
    background-image: linear-gradient(to bottom right, var(--color-brand-700), var(--color-brand-900));
    color: #fff;
    box-shadow:
        0 4px 10px -4px rgb(15 23 42 / 0.35),
        0 0 0 1px rgb(255 255 255 / 0.15);
}

.app-header-logo--placeholder > svg {
    width: 55%;
    height: 55%;
}

.app-header-brand-title--lines {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.app-header-brand-title--single {
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Subtle one-shot entrance for nav brand (honours reduced motion) */
@keyframes app-header-brand-in {
    from {
        opacity: 0;
        transform: translate3d(-0.65rem, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}
@media (prefers-reduced-motion: no-preference) {
    .app-header-brand-entrance .app-header-brand-title {
        animation: app-header-brand-in 1.35s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
    }
    .app-header-brand-entrance .app-header-brand-tagline {
        animation: app-header-brand-in 1.35s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
    }
}

body {
    max-width: 100%;
    /* Respect iOS/Android notch + home indicator so content never hides under the system chrome */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Prevent iOS from auto-zooming on focus: any sub-16px <input>/<select> causes a zoom-in on
   iPhone Safari. Force a 16px minimum on small viewports; we scale back down above sm. */
@media (max-width: 639px) {
    .app-input,
    input.app-input,
    select.app-input,
    textarea.app-input {
        font-size: 16px;
    }
}

/* ---------- Theme palette ----------
   Both naming conventions are declared and kept in sync:
   - `--color-brand-*` and `--color-accent-*` feed Tailwind utilities
     (`bg-brand-700`, `text-accent-500`, etc.) in both Vite and CDN mode.
   - `--brand-*` aliases feed the custom `.app-*` classes further below.
   Switching themes = changing one attribute (`<html data-theme="theme-one">`),
   which swaps the whole palette in one paint. */
:root {
    --color-brand-50: #eef6f5;
    --color-brand-100: #d5ebe8;
    --color-brand-200: #abd5cf;
    --color-brand-300: #7ab8af;
    --color-brand-400: #4d948a;
    --color-brand-500: #357870;
    --color-brand-600: #2a615a;
    --color-brand-700: #234f49;
    --color-brand-800: #1a3f3a;
    --color-brand-900: #122e2b;
    --color-brand-950: #0a1f1d;

    --color-accent-400: #e8cc6a;
    --color-accent-500: #d4af37;
    --color-accent-600: #b8922a;

    --brand-50: var(--color-brand-50);
    --brand-500: var(--color-brand-500);
    --brand-600: var(--color-brand-600);
    --brand-700: var(--color-brand-700);
    --brand-800: var(--color-brand-800);
    --brand-900: var(--color-brand-900);
    --brand-950: var(--color-brand-950);

    /* Page background tints (follow active palette via --color-brand-*) */
    --app-shell-bg-top: color-mix(in srgb, var(--color-brand-50) 55%, rgb(248 250 252));
    --app-shell-bg-bottom: color-mix(in srgb, var(--color-brand-100) 28%, rgb(241 245 249));
    --app-sidebar-width: 17.5rem;
    --app-shell-radius: 1.75rem;
}

/* Theme One â€” Deep Purple / Violet / Pink accent */
:root[data-theme='theme-one'] {
    --color-brand-50: #faf5ff;
    --color-brand-100: #f3e8ff;
    --color-brand-200: #e9d5ff;
    --color-brand-300: #d8b4fe;
    --color-brand-400: #c084fc;
    --color-brand-500: #a855f7;
    --color-brand-600: #9333ea;
    --color-brand-700: #7e22ce;
    --color-brand-800: #6b21a8;
    --color-brand-900: #581c87;
    --color-brand-950: #3b0764;

    --color-accent-400: #f472b6;
    --color-accent-500: #ec4899;
    --color-accent-600: #db2777;
}

/* Theme Two â€” Dark Emerald / Green / Amber accent */
:root[data-theme='theme-two'] {
    --color-brand-50: #ecfdf5;
    --color-brand-100: #d1fae5;
    --color-brand-200: #a7f3d0;
    --color-brand-300: #6ee7b7;
    --color-brand-400: #34d399;
    --color-brand-500: #10b981;
    --color-brand-600: #059669;
    --color-brand-700: #047857;
    --color-brand-800: #065f46;
    --color-brand-900: #064e3b;
    --color-brand-950: #022c22;

    --color-accent-400: #fbbf24;
    --color-accent-500: #f59e0b;
    --color-accent-600: #d97706;
}

/* Theme Three â€” Navy / Indigo / Blue accent */
:root[data-theme='theme-three'] {
    --color-brand-50: #eff6ff;
    --color-brand-100: #dbeafe;
    --color-brand-200: #bfdbfe;
    --color-brand-300: #93c5fd;
    --color-brand-400: #60a5fa;
    --color-brand-500: #3b82f6;
    --color-brand-600: #2563eb;
    --color-brand-700: #1d4ed8;
    --color-brand-800: #1e40af;
    --color-brand-900: #1e3a8a;
    --color-brand-950: #172554;

    --color-accent-400: #38bdf8;
    --color-accent-500: #0ea5e9;
    --color-accent-600: #0284c7;
}

/* Theme Four â€” Olive / Lime */
:root[data-theme='theme-four'] {
    --color-brand-50: #f7fee7;
    --color-brand-100: #ecfccb;
    --color-brand-200: #d9f99d;
    --color-brand-300: #bef264;
    --color-brand-400: #a3e635;
    --color-brand-500: #84cc16;
    --color-brand-600: #65a30d;
    --color-brand-700: #4d7c0f;
    --color-brand-800: #3f6212;
    --color-brand-900: #365314;
    --color-brand-950: #1a2e05;

    --color-accent-400: #bef264;
    --color-accent-500: #a3e635;
    --color-accent-600: #84cc16;
}

/* Theme Five â€” Rose / Blush */
:root[data-theme='theme-five'] {
    --color-brand-50: #fff1f2;
    --color-brand-100: #ffe4e6;
    --color-brand-200: #fecdd3;
    --color-brand-300: #fda4af;
    --color-brand-400: #fb7185;
    --color-brand-500: #f43f5e;
    --color-brand-600: #e11d48;
    --color-brand-700: #be123c;
    --color-brand-800: #9f1239;
    --color-brand-900: #881337;
    --color-brand-950: #4c0519;

    --color-accent-400: #fda4af;
    --color-accent-500: #fb7185;
    --color-accent-600: #f43f5e;
}

/* Theme Six â€” Walnut / Amber gold */
:root[data-theme='theme-six'] {
    --color-brand-50: #fffbeb;
    --color-brand-100: #fef3c7;
    --color-brand-200: #fde68a;
    --color-brand-300: #fcd34d;
    --color-brand-400: #fbbf24;
    --color-brand-500: #f59e0b;
    --color-brand-600: #d97706;
    --color-brand-700: #b45309;
    --color-brand-800: #92400e;
    --color-brand-900: #78350f;
    --color-brand-950: #451a03;

    --color-accent-400: #fde68a;
    --color-accent-500: #fbbf24;
    --color-accent-600: #f59e0b;
}

/* Theme Seven â€” Teal / Mint */
:root[data-theme='theme-seven'] {
    --color-brand-50: #f0fdfa;
    --color-brand-100: #ccfbf1;
    --color-brand-200: #99f6e4;
    --color-brand-300: #5eead4;
    --color-brand-400: #2dd4bf;
    --color-brand-500: #14b8a6;
    --color-brand-600: #0d9488;
    --color-brand-700: #0f766e;
    --color-brand-800: #115e59;
    --color-brand-900: #134e4a;
    --color-brand-950: #042f2e;

    --color-accent-400: #5eead4;
    --color-accent-500: #2dd4bf;
    --color-accent-600: #14b8a6;
}

/* Theme Eight â€” Slate / Ice */
:root[data-theme='theme-eight'] {
    --color-brand-50: #f8fafc;
    --color-brand-100: #f1f5f9;
    --color-brand-200: #e2e8f0;
    --color-brand-300: #cbd5e1;
    --color-brand-400: #94a3b8;
    --color-brand-500: #64748b;
    --color-brand-600: #475569;
    --color-brand-700: #334155;
    --color-brand-800: #1e293b;
    --color-brand-900: #0f172a;
    --color-brand-950: #020617;

    --color-accent-400: #cbd5e1;
    --color-accent-500: #94a3b8;
    --color-accent-600: #64748b;
}

/* Theme Nine â€” Sunset / Coral orange */
:root[data-theme='theme-nine'] {
    --color-brand-50: #fff7ed;
    --color-brand-100: #ffedd5;
    --color-brand-200: #fed7aa;
    --color-brand-300: #fdba74;
    --color-brand-400: #fb923c;
    --color-brand-500: #f97316;
    --color-brand-600: #ea580c;
    --color-brand-700: #c2410c;
    --color-brand-800: #9a3412;
    --color-brand-900: #7c2d12;
    --color-brand-950: #431407;

    --color-accent-400: #fdba74;
    --color-accent-500: #fb923c;
    --color-accent-600: #f97316;
}

/* ---------- Theme-aware layout shell (body, nav, dashboard panels) ---------- */
body.app-station-shell {
    background: linear-gradient(to bottom, var(--app-shell-bg-top), var(--app-shell-bg-bottom)) !important;
}

/* ---------- App shell: sidebar + content (dashboard-style layout) ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-shell-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    background: linear-gradient(180deg, rgb(255 255 255 / 0.92), rgb(248 250 252 / 0.98));
}

@media (min-width: 1024px) {
    .app-shell:has(.app-sidebar) .app-shell-body {
        border-top-left-radius: var(--app-shell-radius);
        box-shadow: -8px 0 32px rgb(10 31 29 / 0.12);
    }

    .app-shell:has(.app-sidebar) .app-topbar.app-site-nav {
        border-top-left-radius: var(--app-shell-radius);
        background: rgb(255 255 255 / 0.72) !important;
        border-bottom-color: rgb(226 232 240 / 0.75) !important;
    }
}

.app-sidebar {
    display: none;
    width: var(--app-sidebar-width);
    flex-shrink: 0;
    flex-direction: column;
    padding: 1.25rem 0.85rem 1rem;
    background: linear-gradient(180deg, var(--color-brand-900) 0%, var(--color-brand-950) 100%);
    color: rgb(226 232 240);
    box-shadow: inset -1px 0 0 rgb(255 255 255 / 0.06);
}

@media (min-width: 1024px) {
    .app-sidebar {
        display: flex;
    }
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid rgb(255 255 255 / 0.08);
    margin-bottom: 1rem;
}

.app-sidebar-logo {
    display: inline-flex;
    height: 2.75rem;
    width: 2.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 0.85rem;
    background: rgb(255 255 255 / 0.08);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12);
}

.app-sidebar-logo > img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.app-sidebar-logo--placeholder {
    color: var(--color-accent-400);
}

.app-sidebar-logo--placeholder > svg {
    height: 1.35rem;
    width: 1.35rem;
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.app-sidebar-avatar {
    height: 2.5rem;
    width: 2.5rem;
    flex-shrink: 0;
    border-radius: 9999px;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgb(255 255 255 / 0.15);
}

.app-sidebar-avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-accent-500), var(--color-accent-600));
    color: var(--color-brand-950);
    font-size: 0.85rem;
    font-weight: 800;
}

.app-sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.15rem;
    overflow-y: auto;
    padding-right: 0.15rem;
    -webkit-overflow-scrolling: touch;
}

.app-sidebar-nav .app-nav-link {
    width: 100%;
    justify-content: flex-start;
    gap: 0.65rem;
    min-height: 2.65rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0 999px 999px 0;
    margin-right: -0.85rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(255 255 255 / 0.72);
}

.app-sidebar-nav .app-nav-link:hover {
    background: rgb(255 255 255 / 0.08);
    color: #fff;
}

.app-sidebar-nav .app-nav-link-active {
    background: #fff;
    color: var(--color-brand-900);
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
    font-weight: 700;
}

.app-sidebar-nav .app-nav-link-active svg {
    color: var(--color-brand-800);
}

.app-sidebar-nav .border-t {
    border-color: rgb(255 255 255 / 0.12) !important;
}

.app-sidebar-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(255 255 255 / 0.08);
}

.app-sidebar .app-appearance-toggle {
    width: 100%;
    justify-content: center;
    border-color: rgb(255 255 255 / 0.15);
    background: rgb(255 255 255 / 0.06);
    color: rgb(255 255 255 / 0.85);
}

.app-sidebar .app-appearance-toggle:hover {
    background: rgb(255 255 255 / 0.12);
    color: #fff;
}

nav.app-site-nav {
    background-color: color-mix(in srgb, var(--color-brand-50) 22%, rgb(255 255 255 / 0.96)) !important;
    border-color: color-mix(in srgb, var(--color-brand-200) 35%, rgb(226 232 240 / 0.88)) !important;
}

.app-dashboard-panel {
    border-color: rgb(226 232 240 / 0.65) !important;
    border-radius: 1.25rem !important;
    background: #fff !important;
    box-shadow:
        0 18px 40px -24px rgb(15 23 42 / 0.18),
        0 0 0 1px rgb(226 232 240 / 0.65) !important;
}

.app-dashboard-card {
    border-color: rgb(226 232 240 / 0.65) !important;
    border-radius: 1.25rem !important;
    background-color: #fff !important;
    box-shadow:
        0 14px 32px -20px rgb(15 23 42 / 0.14),
        0 0 0 1px rgb(226 232 240 / 0.55) !important;
}

.app-page-title {
    font-size: clamp(1.25rem, 4vw + 0.5rem, 1.5rem);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: rgb(15 23 42);
}

@media (min-width: 640px) {
    .app-page-title {
        font-size: 1.5rem;
        line-height: 2rem;
    }
}

.app-page-sub {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(71 85 105);
}

/* ---------- Text motion (page titles, sidebar, section headings) ---------- */
@keyframes app-text-rise {
    from {
        opacity: 0;
        transform: translate3d(-1.75rem, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes app-text-rise-soft {
    from {
        opacity: 0;
        transform: translate3d(-1.15rem, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes app-text-media-in {
    from {
        opacity: 0;
        transform: translate3d(-0.85rem, 0, 0) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .app-text-motion {
        opacity: 0;
        will-change: opacity, transform;
        --app-text-motion-duration: 1.45s;
        --app-text-motion-duration-emphasis: 1.85s;
        --app-text-motion-duration-media: 1.25s;
    }

    .app-text-motion--visible {
        animation: app-text-rise-soft var(--app-text-motion-duration) cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .app-text-motion--emphasis.app-text-motion--visible {
        animation-name: app-text-rise;
        animation-duration: var(--app-text-motion-duration-emphasis);
    }

    .app-text-motion--media.app-text-motion--visible {
        animation: app-text-media-in var(--app-text-motion-duration-media) cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .app-text-motion--d1.app-text-motion--visible {
        animation-delay: 0.2s;
    }

    .app-text-motion--d2.app-text-motion--visible {
        animation-delay: 0.55s;
    }

    .app-text-motion--d3.app-text-motion--visible {
        animation-delay: 0.9s;
    }

    .app-text-motion--d4.app-text-motion--visible {
        animation-delay: 1.25s;
    }

    /* Sidebar nav links: gentle stagger on first paint */
    .app-sidebar-nav .app-nav-link {
        opacity: 0;
        animation: app-text-rise-soft 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .app-sidebar-nav .app-nav-link:nth-child(1) { animation-delay: 0.35s; }
    .app-sidebar-nav .app-nav-link:nth-child(2) { animation-delay: 0.5s; }
    .app-sidebar-nav .app-nav-link:nth-child(3) { animation-delay: 0.65s; }
    .app-sidebar-nav .app-nav-link:nth-child(4) { animation-delay: 0.8s; }
    .app-sidebar-nav .app-nav-link:nth-child(5) { animation-delay: 0.95s; }
    .app-sidebar-nav .app-nav-link:nth-child(6) { animation-delay: 1.1s; }
    .app-sidebar-nav .app-nav-link:nth-child(7) { animation-delay: 1.25s; }
    .app-sidebar-nav .app-nav-link:nth-child(8) { animation-delay: 1.4s; }
    .app-sidebar-nav .app-nav-link:nth-child(n + 9) { animation-delay: 1.55s; }
}

.app-card {
    border-radius: 1.25rem;
    border: 1px solid rgb(226 232 240 / 0.75);
    background-color: #fff;
    padding: 1rem;
    box-shadow:
        0 12px 28px -18px rgb(15 23 42 / 0.14),
        0 0 0 1px rgb(255 255 255 / 0.4);
}

@media (min-width: 640px) {
    .app-card {
        border-radius: 1rem;
        padding: 1.5rem;
    }
}

.app-table-shell {
    overflow: hidden;
    border-radius: 1.25rem;
    border: 1px solid rgb(226 232 240 / 0.75);
    background-color: #fff;
    box-shadow:
        0 12px 28px -18px rgb(15 23 42 / 0.12),
        0 0 0 1px rgb(255 255 255 / 0.35);
    /* Cue users on narrow screens that content scrolls sideways */
    background-image:
        linear-gradient(to right, #fff 30%, rgb(255 255 255 / 0)),
        linear-gradient(to right, rgb(255 255 255 / 0), #fff 70%) 100% 0,
        linear-gradient(to right, rgb(15 23 42 / 0.08), rgb(15 23 42 / 0)),
        linear-gradient(to right, rgb(15 23 42 / 0), rgb(15 23 42 / 0.08)) 100% 0;
    background-repeat: no-repeat;
    background-size: 20px 100%, 20px 100%, 10px 100%, 10px 100%;
    background-attachment: local, local, scroll, scroll;
}

@media (min-width: 640px) {
    .app-table-shell {
        border-radius: 1rem;
        background-image: none;
    }
}

.app-table-shell > .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

/* Wide analytic tables: keep rounded shell while inner area scrolls horizontally. */
.app-table-shell.app-table-shell--fit > .overflow-x-auto {
    margin-inline: -0.125rem;
    padding-inline: 0.125rem;
}

@media (min-width: 1024px) {
    .app-table-shell.app-table-shell--fit > .overflow-x-auto {
        margin-inline: 0;
        padding-inline: 0;
    }
}

.app-overview-mobile-hint {
    border-color: rgb(226 232 240 / 0.9);
    background-color: rgb(248 250 252 / 0.95);
    color: rgb(71 85 105);
}

html[data-appearance='dark'] .app-overview-mobile-hint {
    border-color: rgba(51, 65, 85, 0.85);
    background-color: rgb(15 23 42 / 0.6);
    color: rgb(148 163 184);
}

/* Debtor account card: size its own contents off its width so numbers like
   "15,332,866" always fit without truncation, regardless of phone size. */
.app-debtor-card {
    container-type: inline-size;
    container-name: debtor;
}

.app-debtor-num {
    font-size: clamp(0.78rem, 3.8cqw + 0.2rem, 0.95rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: nowrap;
}

@container debtor (max-width: 340px) {
    .app-debtor-num {
        white-space: normal; /* let long numbers wrap instead of clip on tiny screens */
    }
}

.app-debtor-closing {
    font-size: clamp(0.8rem, 3cqw + 0.4rem, 1rem);
    max-width: 60%;
    overflow-wrap: anywhere;
}

@media (min-width: 640px) {
    .app-debtor-closing {
        max-width: none;
    }
}

.app-label {
    margin-bottom: 0.375rem;
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(51 65 85);
}

/* Toggle switch (checkbox); does not rely on Tailwind peer/after utilities */
.app-toggle-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    height: 1.5rem;
    width: 2.75rem;
    cursor: pointer;
    align-items: center;
    border-radius: 9999px;
    background-color: rgb(203 213 225);
    transition: background-color 0.15s ease;
}

.app-toggle-switch::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    height: 1.25rem;
    width: 1.25rem;
    border-radius: 9999px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.12);
    transition: transform 0.15s ease;
}

.app-toggle-switch:has(input:checked) {
    background-color: var(--brand-600, #2f6284);
}

.app-toggle-switch:has(input:checked)::after {
    transform: translateX(1.25rem);
}

.app-toggle-switch:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.55;
}

.app-toggle-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-input {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(15 23 42);
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-input::placeholder {
    color: rgb(148 163 184);
}

.app-input:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgb(61 122 158 / 0.25);
}

/* Qty / price / amount on invoices: no browser spinners or scroll-to-increment */
.app-input-plain-num::-webkit-outer-spin-button,
.app-input-plain-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.app-input-plain-num {
    -moz-appearance: textfield;
    appearance: textfield;
}

.app-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--color-brand-800), var(--color-brand-950));
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: background-color 0.15s, box-shadow 0.15s;
}

.app-btn-primary:hover {
    background: linear-gradient(135deg, var(--color-brand-700), var(--color-brand-900));
    box-shadow: 0 10px 24px -12px rgb(10 31 29 / 0.45);
}

.app-btn-primary:focus {
    outline: none;
}

.app-btn-primary:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.app-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: rgb(51 65 85);
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.app-btn-secondary:hover {
    background-color: rgb(248 250 252);
    border-color: rgb(203 213 225);
}

.app-btn-secondary:focus {
    outline: none;
}

.app-btn-secondary:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.app-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(254 202 202);
    background-color: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: rgb(185 28 28);
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: background-color 0.15s, box-shadow 0.15s;
}

.app-btn-danger:hover {
    background-color: rgb(254 242 242);
}

.app-btn-danger:focus {
    outline: none;
}

.app-btn-danger:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgb(248 113 113);
}

.app-link {
    font-weight: 500;
    color: var(--brand-700);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
    border-radius: 0.25rem;
}

.app-link:hover {
    color: var(--brand-900);
}

.app-link:focus {
    outline: none;
}

.app-link:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.app-link-danger {
    font-weight: 500;
    color: rgb(220 38 38);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-link-danger:hover {
    color: rgb(153 27 27);
}

.app-link-danger:focus {
    outline: none;
}

.app-link-danger:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgb(248 113 113);
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
    border-radius: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(71 85 105);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.app-nav-link:hover {
    background-color: rgb(241 245 249);
    color: rgb(15 23 42);
}

.app-nav-link:focus {
    outline: none;
}

.app-nav-link:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.app-nav-link svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.app-nav-link-active {
    background-color: var(--brand-50);
    color: var(--brand-900);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 0 var(--brand-600);
}

.app-nav-link-active svg {
    opacity: 1;
    color: var(--brand-700);
}

/* Mobile hamburger â€” 44px min touch target */
.app-nav-menu-trigger {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 2.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    color: rgb(51 65 85);
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: background-color 0.15s, border-color 0.15s;
}

.app-nav-menu-trigger:hover {
    background-color: rgb(248 250 252);
    border-color: rgb(203 213 225);
}

.app-nav-menu-trigger:focus {
    outline: none;
}

.app-nav-menu-trigger:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

/* Mobile drawer link list */
.app-mobile-nav-panel .app-nav-link {
    width: 100%;
    justify-content: flex-start;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.35;
    white-space: normal;
    border-radius: 0.5rem;
}

.app-mobile-nav-panel .app-nav-link-active {
    box-shadow: inset 4px 0 0 0 var(--brand-600);
}

.app-mobile-nav-panel .app-nav-icon {
    height: 1.25rem;
    width: 1.25rem;
}

.app-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    min-width: 2.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: rgb(71 85 105);
    cursor: pointer;
    transition: background-color 0.15s;
}

.app-icon-btn:hover {
    background-color: rgb(241 245 249);
    color: rgb(15 23 42);
}

.app-icon-btn:focus {
    outline: none;
}

.app-icon-btn:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

body.app-mobile-nav-open {
    overflow: hidden;
}

/* Scrollable list inside the drawer (fixed to viewport, not inside blurred nav) */
.app-mobile-nav-list {
    -webkit-overflow-scrolling: touch;
}

/* Compact icon-only on very small screens â€” label stays visible for clarity */
.app-nav-icon {
    height: 1.125rem;
    width: 1.125rem;
}

/* Logout + secondary header actions */
.app-btn-nav-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(51 65 85);
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.app-btn-nav-outline:hover {
    background-color: rgb(248 250 252);
    border-color: rgb(203 213 225);
}

.app-btn-nav-outline:focus {
    outline: none;
}

.app-btn-nav-outline:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

/* Page header action row â€” consistent spacing */
.app-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.app-kpi {
    border-radius: 1.15rem;
    border-width: 1px;
    padding: 0.875rem 1rem;
    box-shadow:
        0 14px 30px -18px rgb(15 23 42 / 0.16),
        0 0 0 1px rgb(255 255 255 / 0.35);
    container-type: inline-size;
    container-name: kpi;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-kpi:hover {
    transform: translateY(-2px);
    box-shadow:
        0 18px 36px -16px rgb(15 23 42 / 0.2),
        0 0 0 1px rgb(255 255 255 / 0.45);
}

.app-kpi--accent {
    border-color: transparent !important;
    background: linear-gradient(135deg, var(--color-accent-500) 0%, var(--color-accent-600) 100%) !important;
    color: var(--color-brand-950);
}

.app-kpi--accent > div:first-child {
    color: rgb(18 46 43 / 0.78) !important;
}

.app-kpi--brand {
    border-color: transparent !important;
    background: linear-gradient(135deg, var(--color-brand-800) 0%, var(--color-brand-950) 100%) !important;
    color: #fff;
}

.app-kpi--brand > div:first-child,
.app-kpi--brand > div:last-child {
    color: rgb(255 255 255 / 0.72) !important;
}

.app-kpi--soft {
    border-color: rgb(226 232 240 / 0.7) !important;
    background: #fff !important;
}

/* Large KPI value autosizes by container width: the same card looks small on
   a phone (2-up grid) and large on desktop (4-up grid) without media queries. */
.app-kpi .app-kpi-value,
.app-kpi > div:nth-child(2) {
    font-size: clamp(1rem, 7cqw + 0.35rem, 1.6rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (min-width: 640px) {
    .app-kpi {
        border-radius: 1rem;
        padding: 1.1rem 1.25rem;
    }
    .app-kpi .app-kpi-value,
    .app-kpi > div:nth-child(2) {
        font-size: clamp(1.25rem, 5cqw + 0.65rem, 1.875rem);
    }
}

/* Password fields with show/hide toggle */
.app-input-password-toggle {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.375rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.375rem;
    color: rgb(100 116 139);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}

.password-toggle:hover {
    color: rgb(51 65 85);
    background-color: rgb(241 245 249);
}

.password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.password-toggle:focus:not(:focus-visible) {
    box-shadow: none;
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

/* ---------- Notifications bell ---------- */
.app-bell {
    position: relative;
    display: inline-flex;
}

.app-bell-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    color: rgb(51 65 85);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.app-bell-trigger:hover {
    background-color: rgb(248 250 252);
    color: rgb(15 23 42);
    border-color: rgb(203 213 225);
}

.app-bell-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

.app-bell--open .app-bell-trigger {
    background-color: rgb(241 245 249);
    border-color: rgb(148 163 184);
    color: rgb(15 23 42);
}

.app-bell-badge {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background-color: rgb(220 38 38);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}

.app-bell-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: min(22rem, calc(100vw - 1.5rem));
    max-height: calc(100vh - 5rem);
    overflow: hidden;
    background-color: #fff;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.875rem;
    box-shadow:
        0 10px 30px -10px rgb(15 23 42 / 0.25),
        0 4px 10px -4px rgb(15 23 42 / 0.1);
    z-index: 60;
}

/* Phones/tablets: anchor sync + notification menus to the viewport so a wide
   panel is never clipped by html { overflow-x: hidden } or a narrow trigger. */
@media (max-width: 1023px) {
    .app-bell-panel {
        position: fixed;
        top: max(5.25rem, calc(env(safe-area-inset-top, 0px) + 4.75rem));
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        left: max(0.75rem, env(safe-area-inset-left, 0px));
        width: auto;
        max-width: none;
        transform: none;
        z-index: 250;
    }
}

/* ---------- Left rail: light/dark + palette theme (floating) ---------- */
.app-floating-controls {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    pointer-events: none;
}
.app-floating-controls > * {
    pointer-events: auto;
}
.app-appearance-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 0 9999px 9999px 0;
    background-color: var(--color-brand-800);
    color: #e2e8f0;
    box-shadow: 0 8px 20px -8px rgb(15 23 42 / 0.45), 0 2px 8px -4px rgb(15 23 42 / 0.25);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.app-appearance-toggle:hover,
.app-appearance-toggle:focus-visible {
    background-color: var(--color-brand-700);
    transform: translateX(2px);
}
.app-appearance-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-brand-500);
}

/* Compact control in the desktop nav cluster (full pill; no sideways nudge). */
.app-appearance-toggle--header {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    box-shadow:
        0 1px 2px rgb(15 23 42 / 0.08),
        0 2px 8px -4px rgb(15 23 42 / 0.2);
}
.app-appearance-toggle--header:hover,
.app-appearance-toggle--header:focus-visible {
    transform: translateY(-1px);
}

.app-appearance-icon {
    width: 1.3rem;
    height: 1.3rem;
    flex-shrink: 0;
}
/* ---------- Theme switcher (gear opens palette panel) ---------- */
/* Panel is position:absolute so this strip stays only as wide as the gear button.
   Otherwise a wide in-flow panel + html { overflow-x: hidden } can clip the whole
   floating rail on desktop. */
.app-theme-switcher {
    position: relative;
    display: block;
    width: max-content;
    /* Avoid disabling pointer events on the wrapper: some desktop browsers
       fail to deliver wheel/trackpad scroll to the panel when an ancestor
       has pointer-events: none. The switcher is max-content width, so it
       won't block the page behind it. */
    pointer-events: auto;
}

.app-theme-toggle {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 0 9999px 9999px 0;
    background-color: var(--color-accent-500);
    color: #fff;
    box-shadow: 0 10px 25px -10px rgb(15 23 42 / 0.35), 0 4px 10px -4px rgb(15 23 42 / 0.25);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.app-theme-toggle:hover,
.app-theme-toggle:focus-visible {
    background-color: var(--color-accent-600);
    transform: translateX(2px);
}

.app-theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-brand-500);
}

/* Gear keeps a gentle rotation at rest and spins on open. */
.app-theme-toggle svg {
    width: 1.35rem;
    height: 1.35rem;
    animation: app-theme-gear-idle 12s linear infinite;
    transition: transform 0.4s ease;
}

.app-theme-switcher--open .app-theme-toggle svg {
    animation: app-theme-gear-spin 1.2s linear infinite;
}

@keyframes app-theme-gear-idle {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes app-theme-gear-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .app-theme-toggle svg {
        animation: none;
    }
}

.app-theme-panel {
    pointer-events: auto;
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 71;
    width: 17.5rem;
    max-width: calc(100vw - 3rem);
    max-height: min(75vh, 26rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    background-color: #fff;
    border: 1px solid rgb(226 232 240);
    border-left: none;
    border-radius: 0 0.875rem 0.875rem 0;
    box-shadow: 0 15px 35px -10px rgb(15 23 42 / 0.35), 0 6px 12px -4px rgb(15 23 42 / 0.15);
    padding: 1rem 1rem 1.1rem;
    transform-origin: left center;
    transform: translateX(-110%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.2s ease, visibility 0.2s;
}

.app-theme-switcher--open .app-theme-panel {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.app-theme-panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: rgb(15 23 42);
    margin: 0 0 0.35rem;
}

.app-theme-panel-hint {
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgb(100 116 139);
    margin: 0 0 0.75rem;
}

.app-theme-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.625rem 0.75rem 0.75rem;
    margin-bottom: 0.6rem;
    border-radius: 0.625rem;
    background-color: #fff;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.app-theme-option:hover {
    background-color: rgb(248 250 252);
}

.app-theme-option[aria-pressed='true'] {
    border-color: var(--color-brand-500);
    background-color: rgb(248 250 252);
}

.app-theme-option-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgb(51 65 85);
    margin-bottom: 0.4rem;
}

.app-theme-swatch {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    height: 1.65rem;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgb(15 23 42 / 0.08);
}

.app-theme-switcher--collapsed-on-mobile {
    display: none;
}

@media (max-width: 640px) {
    .app-appearance-toggle {
        width: 2.4rem;
        height: 2.4rem;
    }
    .app-theme-toggle {
        width: 2.4rem;
        height: 2.4rem;
    }
    .app-theme-panel {
        width: 14.5rem;
    }
}

/* ---------- Live clock + calendar ---------- */
.app-datetime {
    position: relative;
    display: inline-flex;
    max-width: 100%;
}

.app-datetime-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.625rem;
    background: rgb(255 255 255 / 0.92);
    color: rgb(15 23 42);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.app-datetime-trigger:hover {
    border-color: rgb(203 213 225);
    background: #fff;
}

.app-datetime-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgb(255 255 255), 0 0 0 5px var(--color-brand-500);
}

.app-datetime--open .app-datetime-trigger {
    border-color: var(--color-brand-400);
    box-shadow: 0 0 0 2px rgb(61 122 158 / 0.15);
}

.app-datetime-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--color-brand-700);
}

.app-datetime-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.05rem;
}

.app-datetime-clock {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgb(15 23 42);
}

.app-datetime-date {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgb(100 116 139);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-datetime--compact .app-datetime-trigger {
    padding: 0.3rem 0.5rem;
    min-height: 2rem;
}

.app-datetime--compact .app-datetime-clock {
    font-size: 0.75rem;
}

.app-datetime-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 80;
    width: min(18.5rem, calc(100vw - 1.5rem));
    padding: 0.75rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 18px 40px -14px rgb(15 23 42 / 0.35), 0 6px 14px -6px rgb(15 23 42 / 0.12);
}

.app-datetime-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.app-datetime-panel-title {
    flex: 1;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgb(15 23 42);
}

.app-datetime-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 0.5rem;
    background: rgb(248 250 252);
    color: rgb(51 65 85);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.app-datetime-nav:hover {
    background: rgb(241 245 249);
    color: rgb(15 23 42);
}

.app-datetime-nav svg {
    width: 1rem;
    height: 1rem;
}

.app-datetime-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.2rem;
}

.app-datetime-grid-head {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgb(100 116 139);
}

.app-datetime-grid-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.85rem;
    border: none;
    border-radius: 0.45rem;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(51 65 85);
    cursor: default;
}

.app-datetime-grid-day--blank {
    pointer-events: none;
}

.app-datetime-grid-day--today {
    background: var(--color-brand-700);
    color: #fff;
    box-shadow: 0 4px 10px -4px rgb(37 67 88 / 0.55);
}

.app-datetime-panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgb(241 245 249);
}

.app-datetime-today {
    border: none;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-brand-700);
    cursor: pointer;
}

.app-datetime-today:hover {
    color: var(--color-brand-900);
}

.app-datetime-tz {
    font-size: 0.62rem;
    font-weight: 600;
    color: rgb(148 163 184);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9rem;
}

/* Sidebar (dark) variant */
.app-datetime--sidebar {
    display: block;
    width: 100%;
}

.app-datetime--sidebar .app-datetime-trigger {
    width: 100%;
    border-color: rgb(255 255 255 / 0.12);
    background: rgb(255 255 255 / 0.06);
    color: rgb(255 255 255 / 0.92);
}

.app-datetime--sidebar .app-datetime-trigger:hover {
    border-color: rgb(255 255 255 / 0.22);
    background: rgb(255 255 255 / 0.1);
}

.app-datetime--sidebar .app-datetime-icon {
    color: rgb(163 230 53 / 0.95);
}

.app-datetime--sidebar .app-datetime-clock {
    color: #fff;
}

.app-datetime--sidebar .app-datetime-date {
    color: rgb(255 255 255 / 0.55);
}

.app-datetime--sidebar .app-datetime-panel {
    left: 0;
    right: auto;
}

/* Inverse (dark pages: welcome, login) */
.app-datetime--inverse .app-datetime-trigger {
    border-color: rgb(255 255 255 / 0.14);
    background: rgb(255 255 255 / 0.08);
    color: #fff;
}

.app-datetime--inverse .app-datetime-trigger:hover {
    border-color: rgb(255 255 255 / 0.24);
    background: rgb(255 255 255 / 0.12);
}

.app-datetime--inverse .app-datetime-icon {
    color: rgb(163 230 53);
}

.app-datetime--inverse .app-datetime-clock {
    color: #fff;
}

.login-datetime-wrap {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top));
    right: max(0.75rem, env(safe-area-inset-right));
    z-index: 40;
}

@media (max-width: 1023px) {
    .app-datetime-panel {
        /* JS sets fixed coords on small screens when open */
    }
}

html[data-appearance='dark'] .app-datetime-trigger {
    border-color: rgb(51 65 85);
    background: rgb(30 41 59 / 0.85);
    color: rgb(241 245 249);
}

html[data-appearance='dark'] .app-datetime-trigger:hover {
    border-color: rgb(71 85 105);
    background: rgb(30 41 59);
}

html[data-appearance='dark'] .app-datetime-clock {
    color: rgb(248 250 252);
}

html[data-appearance='dark'] .app-datetime-date {
    color: rgb(148 163 184);
}

html[data-appearance='dark'] .app-datetime-panel {
    border-color: rgb(51 65 85);
    background: rgb(15 23 42);
    box-shadow: 0 18px 40px -14px rgb(0 0 0 / 0.55);
}

html[data-appearance='dark'] .app-datetime-panel-title,
html[data-appearance='dark'] .app-datetime-grid-day {
    color: rgb(226 232 240);
}

html[data-appearance='dark'] .app-datetime-nav {
    background: rgb(30 41 59);
    color: rgb(203 213 225);
}

html[data-appearance='dark'] .app-datetime-panel-foot {
    border-top-color: rgb(51 65 85);
}

/* ---------- Back-to-top floating button ---------- */
.app-back-to-top {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    z-index: 65;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 0.9rem;
    background-color: var(--color-brand-700);
    color: #fff;
    cursor: pointer;
    box-shadow:
        0 12px 28px -10px rgb(15 23 42 / 0.4),
        0 6px 12px -6px rgb(15 23 42 / 0.25);
    opacity: 0;
    transform: translateY(14px) scale(0.9);
    visibility: hidden;
    transition:
        opacity 0.2s ease,
        transform 0.25s ease,
        visibility 0.2s,
        background-color 0.2s ease;
}

.app-back-to-top svg {
    width: 1.4rem;
    height: 1.4rem;
}

.app-back-to-top:hover {
    background-color: var(--color-brand-800);
}

.app-back-to-top:focus-visible {
    outline: none;
    box-shadow:
        0 12px 28px -10px rgb(15 23 42 / 0.4),
        0 0 0 3px #fff,
        0 0 0 5px var(--color-brand-500);
}

.app-back-to-top:active {
    transform: translateY(12px) scale(0.95);
}

.app-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Subtle attention pulse on the icon while the button is visible. */
.app-back-to-top.is-visible svg {
    animation: app-back-to-top-nudge 2.4s ease-in-out infinite;
}

@keyframes app-back-to-top-nudge {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .app-back-to-top,
    .app-back-to-top.is-visible svg {
        transition: opacity 0.15s, visibility 0.15s;
        animation: none;
    }
}

/* Avoid sitting on top of the mobile logout button area on very short viewports. */
@media (max-width: 640px) {
    .app-back-to-top {
        width: 2.75rem;
        height: 2.75rem;
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: calc(0.9rem + env(safe-area-inset-bottom));
        border-radius: 0.75rem;
    }
    .app-back-to-top svg {
        width: 1.2rem;
        height: 1.2rem;
    }
}

/* =============================================================================
   Light / dark appearance: <html data-appearance="light|dark">, localStorage app-appearance
   ============================================================================= */
html[data-appearance='dark'] {
    color-scheme: dark;
    --app-shell-bg-top: color-mix(in srgb, var(--color-brand-950) 68%, #0f172a);
    --app-shell-bg-bottom: color-mix(in srgb, var(--color-brand-900) 44%, #1e293b);
}

/* Core shell (overrides layout Tailwind utility colors) */
html[data-appearance='dark'] body.app-station-shell {
    background: linear-gradient(to bottom, var(--app-shell-bg-top), var(--app-shell-bg-bottom) 52%, var(--app-shell-bg-top)) !important;
    color: #e2e8f0 !important;
}
html[data-appearance='dark'] nav.app-site-nav {
    background: color-mix(in srgb, var(--color-brand-950) 58%, rgba(15, 23, 42, 0.97)) !important;
    border-color: color-mix(in srgb, var(--color-brand-800) 32%, rgba(51, 65, 85, 0.72)) !important;
}
html[data-appearance='dark'] .app-dashboard-panel {
    border-color: color-mix(in srgb, var(--color-brand-800) 48%, rgb(51 65 85 / 0.95)) !important;
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--color-brand-950) 82%, #1e293b),
        #0f172a
    ) !important;
    box-shadow:
        0 12px 28px -14px rgb(0 0 0 / 0.45),
        0 0 0 1px color-mix(in srgb, var(--color-brand-800) 38%, rgb(51 65 85 / 0.75)) !important;
}
html[data-appearance='dark'] .app-dashboard-card {
    border-color: color-mix(in srgb, var(--color-brand-800) 42%, rgb(51 65 85 / 0.95)) !important;
    background-color: color-mix(in srgb, var(--color-brand-950) 58%, #1e293b) !important;
    box-shadow:
        0 10px 22px -12px rgb(0 0 0 / 0.38),
        0 0 0 1px color-mix(in srgb, var(--color-brand-800) 32%, rgb(51 65 85 / 0.68)) !important;
}
html[data-appearance='dark'] #main-content {
    color: #e2e8f0;
}
html[data-appearance='dark'] body > footer {
    background: rgba(15, 23, 42, 0.88) !important;
    border-color: rgba(51, 65, 85, 0.55) !important;
    color: #94a3b8 !important;
}

/* Design-system components from this file */
html[data-appearance='dark'] .app-page-title {
    color: #f1f5f9 !important;
}
html[data-appearance='dark'] .app-page-sub {
    color: #94a3b8 !important;
}
html[data-appearance='dark'] .app-label {
    color: #cbd5e1 !important;
}
html[data-appearance='dark'] .app-input {
    border-color: rgb(51 65 85) !important;
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.2);
}
html[data-appearance='dark'] .app-input::placeholder {
    color: #64748b !important;
}
html[data-appearance='dark'] .app-input:focus {
    border-color: var(--color-brand-500) !important;
    box-shadow: 0 0 0 3px rgb(61 122 158 / 0.35) !important;
}
html[data-appearance='dark'] .app-toggle-switch {
    background-color: rgb(71 85 105);
}
html[data-appearance='dark'] .app-toggle-switch::after {
    background-color: #f8fafc;
}
html[data-appearance='dark'] .app-card {
    border-color: rgba(51, 65, 85, 0.85) !important;
    background-color: #1e293b !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.25) !important;
}
html[data-appearance='dark'] .app-table-shell {
    border-color: rgba(51, 65, 85, 0.85) !important;
    background-color: #1e293b !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.25) !important;
    background-image: none;
}
html[data-appearance='dark'] .app-header-logo {
    background-color: #1e293b;
    box-shadow:
        0 1px 2px rgb(0 0 0 / 0.25),
        0 0 0 1px rgb(51 65 85 / 0.8);
}
html[data-appearance='dark'] .app-btn-secondary {
    background-color: #1e293b !important;
    border-color: rgb(71 85 105) !important;
    color: #e2e8f0 !important;
}
html[data-appearance='dark'] .app-btn-secondary:hover {
    background-color: #334155 !important;
    border-color: #64748b !important;
}
html[data-appearance='dark'] .app-bell-panel {
    background-color: #1e293b !important;
    border-color: rgb(71 85 105) !important;
    box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.45), 0 4px 10px -4px rgb(0 0 0 / 0.3);
}
html[data-appearance='dark'] .app-theme-panel,
html[data-appearance='dark'] .app-theme-option {
    background-color: #1e293b !important;
    border-color: rgb(71 85 105) !important;
}
html[data-appearance='dark'] .app-theme-panel-title {
    color: #f1f5f9 !important;
}
html[data-appearance='dark'] .app-theme-panel-hint {
    color: #94a3b8 !important;
}
html[data-appearance='dark'] .app-theme-option:hover {
    background-color: #334155 !important;
}
html[data-appearance='dark'] .app-theme-option[aria-pressed='true'] {
    background-color: #334155 !important;
}
html[data-appearance='dark'] .app-theme-option-label {
    color: #e2e8f0 !important;
}
html[data-appearance='dark'] .app-icon-btn,
html[data-appearance='dark'] .app-nav-menu-trigger {
    color: #e2e8f0;
}
html[data-appearance='dark'] .app-btn-nav-outline {
    background-color: #1e293b !important;
    border-color: rgb(71 85 105) !important;
    color: #e2e8f0 !important;
}
html[data-appearance='dark'] .app-btn-nav-outline:hover {
    background-color: #334155 !important;
    border-color: #64748b !important;
}
html[data-appearance='dark'] .app-kpi {
    background-color: #1e293b !important;
    border-color: rgba(51, 65, 85, 0.9) !important;
    color: #e2e8f0;
}
html[data-appearance='dark'] .app-nav-link {
    color: #cbd5e1 !important;
}
html[data-appearance='dark'] .app-nav-link:hover {
    background-color: rgba(51, 65, 85, 0.45) !important;
    color: #f1f5f9 !important;
}
html[data-appearance='dark'] .app-nav-link-active {
    background-color: rgba(61, 122, 158, 0.2) !important;
    color: #e0f2fe !important;
    box-shadow: inset 0 -2px 0 0 var(--color-brand-500) !important;
}
html[data-appearance='dark'] .app-nav-link-active svg {
    color: var(--color-brand-300) !important;
}
html[data-appearance='dark'] .app-nav-menu-trigger {
    background-color: #1e293b !important;
    border-color: rgb(71 85 105) !important;
    color: #e2e8f0 !important;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.2);
}
html[data-appearance='dark'] .app-nav-menu-trigger:hover {
    background-color: #334155 !important;
}
html[data-appearance='dark'] .app-icon-btn:hover {
    background-color: rgba(51, 65, 85, 0.5) !important;
}
html[data-appearance='dark'] .border-slate-200\/70,
html[data-appearance='dark'] .border-slate-100 {
    border-color: rgba(51, 65, 85, 0.75) !important;
}

/* Common Tailwind text / surface utilities used across pages */
html[data-appearance='dark'] .text-slate-900,
html[data-appearance='dark'] .text-slate-800 {
    color: #e2e8f0 !important;
}
html[data-appearance='dark'] .text-slate-700,
html[data-appearance='dark'] .text-slate-600,
html[data-appearance='dark'] .text-slate-500 {
    color: #94a3b8 !important;
}
html[data-appearance='dark'] .text-brand-950 {
    color: #f1f5f9 !important;
}
/* Panels that use white / soft gradients: force a dark surface */
html[data-appearance='dark'] .bg-white {
    background-color: #1e293b !important;
}
html[data-appearance='dark'] .bg-gradient-to-b {
    background-image: linear-gradient(to bottom, #1e293b, #0f172a) !important;
}
html[data-appearance='dark'] .bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, #1e293b, #0f172a) !important;
}
html[data-appearance='dark'] .border-slate-200,
html[data-appearance='dark'] .border-slate-200\/80,
html[data-appearance='dark'] .border-slate-200\/90,
html[data-appearance='dark'] .ring-slate-200,
html[data-appearance='dark'] .ring-slate-200\/60,
html[data-appearance='dark'] .ring-amber-200 {
    border-color: rgb(51 65 85) !important;
    --tw-ring-color: rgba(51, 65, 85, 0.5) !important;
}
html[data-appearance='dark'] .divide-slate-100 {
    --tw-divide-opacity: 1;
    border-color: rgb(51 65 85) !important;
}
html[data-appearance='dark'] tr:hover {
    background-color: rgba(51, 65, 85, 0.35) !important;
}
html[data-appearance='dark'] .bg-slate-50,
html[data-appearance='dark'] .bg-slate-50\/80,
html[data-appearance='dark'] .bg-slate-50\/90 {
    background-color: #0f172a !important;
}
html[data-appearance='dark'] .bg-slate-100,
html[data-appearance='dark'] .bg-slate-200 {
    background-color: #1e293b !important;
}
html[data-appearance='dark'] .bg-slate-100\/50 {
    background-color: rgba(30, 41, 59, 0.5) !important;
}
html[data-appearance='dark'] .bg-white\/60,
html[data-appearance='dark'] .bg-white\/95 {
    background-color: rgba(30, 41, 59, 0.95) !important;
}
html[data-appearance='dark'] .shadow-slate-900\/5,
html[data-appearance='dark'] .shadow-slate-900 {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.2) !important;
}
html[data-appearance='dark'] .bg-amber-50,
html[data-appearance='dark'] .bg-amber-50\/80,
html[data-appearance='dark'] .bg-amber-100,
html[data-appearance='dark'] .border-amber-200,
html[data-appearance='dark'] .border-amber-200\/90 {
    background-color: rgba(120, 53, 15, 0.25) !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
    color: #fde68a !important;
}
html[data-appearance='dark'] .from-amber-50 {
    --tw-gradient-from: #1e293b !important;
}

/* Mobile drawer */
html[data-appearance='dark'] .app-mobile-nav-panel,
html[data-appearance='dark'] #app-mobile-nav-panel {
    background: #0f172a !important;
    border-color: rgb(51 65 85) !important;
    color: #e2e8f0;
}
html[data-appearance='dark'] .app-mobile-nav-list a {
    color: #e2e8f0;
}

/* Login: sign-in card */
html[data-appearance='dark'] .login-side {
    background: rgba(15, 23, 42, 0.65) !important;
}
html[data-appearance='dark'] .login-card {
    background: rgba(30, 41, 59, 0.96) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(51, 65, 85, 0.4) !important;
}
html[data-appearance='dark'] .login-card .text-slate-900,
html[data-appearance='dark'] .login-card h2 {
    color: #f1f5f9 !important;
}
html[data-appearance='dark'] .login-card .text-slate-600,
html[data-appearance='dark'] .login-card label {
    color: #94a3b8 !important;
}
html[data-appearance='dark'] .login-footer-note {
    color: #94a3b8 !important;
}

html[data-appearance='dark'] .app-shell-body {
    background: linear-gradient(180deg, rgb(15 23 42 / 0.92), rgb(15 23 42 / 0.98)) !important;
}

html[data-appearance='dark'] .app-sidebar {
    background: linear-gradient(180deg, rgb(10 31 29 / 0.98), rgb(5 15 14)) !important;
}

html[data-appearance='dark'] .app-sidebar-nav .app-nav-link-active {
    background: rgb(248 250 252) !important;
    color: var(--color-brand-900) !important;
}

/* ---------- Dashboard charts ---------- */
.app-chart-card {
    padding: 1.15rem 1.15rem 1rem;
}

@media (min-width: 640px) {
    .app-chart-card {
        padding: 1.35rem 1.35rem 1.15rem;
    }
}

.app-chart-card__header {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .app-chart-card__header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}

.app-chart-card__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgb(15 23 42);
}

.app-chart-card__sub {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: rgb(100 116 139);
}

.app-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.app-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    border: 1px solid rgb(226 232 240 / 0.9);
    background: rgb(248 250 252 / 0.9);
    padding: 0.28rem 0.65rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(51 65 85);
}

.app-chart-legend__item::before {
    content: '';
    height: 0.55rem;
    width: 0.55rem;
    border-radius: 999px;
    background: currentColor;
}

.app-chart-legend__item--brand {
    color: var(--color-brand-800);
}

.app-chart-legend__item--brand::before {
    background: var(--color-brand-700);
}

.app-chart-legend__item--accent {
    color: var(--color-accent-600);
}

.app-chart-legend__item--accent::before {
    background: var(--color-accent-500);
}

.app-chart-shell {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid rgb(226 232 240 / 0.65);
    background:
        linear-gradient(180deg, rgb(248 250 252 / 0.65), rgb(255 255 255 / 0.95)),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 23px,
            rgb(148 163 184 / 0.06) 23px,
            rgb(148 163 184 / 0.06) 24px
        );
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.8);
}

.app-chart-shell--area {
    height: min(40vh, 16rem);
}

.app-chart-shell--line {
    height: min(36vh, 14rem);
}

@media (min-width: 640px) {
    .app-chart-shell--line {
        height: 15rem;
    }
}

.app-chart-shell--hbar {
    height: min(44vh, 16rem);
}

@media (min-width: 640px) {
    .app-chart-shell--hbar {
        height: 17rem;
    }
}

.app-chart-shell--grouped {
    height: min(44vh, 17rem);
}

@media (min-width: 640px) {
    .app-chart-shell--grouped {
        height: 19rem;
    }
}

@media (min-width: 768px) {
    .app-chart-shell--grouped {
        height: 20rem;
    }
}

.app-chart-shell--donut-sm {
    height: min(44vh, 16rem);
}

@media (min-width: 640px) {
    .app-chart-shell--donut-sm {
        height: 17rem;
    }
}

@media (min-width: 640px) {
    .app-chart-shell--area {
        height: 17rem;
    }
}

@media (min-width: 768px) {
    .app-chart-shell--area {
        height: 18rem;
    }
}

.app-chart-shell--bar {
    height: min(52vh, 17rem);
}

@media (min-width: 640px) {
    .app-chart-shell--bar {
        height: 18rem;
    }
}

@media (min-width: 768px) {
    .app-chart-shell--bar {
        height: 20rem;
    }
}

.app-chart-shell--donut {
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(48vh, 18rem);
    max-width: 100%;
}

@media (min-width: 640px) {
    .app-chart-shell--donut {
        height: 20rem;
    }
}

@media (min-width: 768px) {
    .app-chart-shell--donut {
        height: 22rem;
    }
}

.app-chart-shell canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    padding: 0.65rem 0.45rem 0.35rem;
}

.app-chart-foot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed rgb(203 213 225 / 0.85);
}

.app-chart-foot--single {
    grid-template-columns: 1fr;
}

@media (min-width: 480px) {
    .app-chart-foot--single {
        max-width: 14rem;
    }
}

.app-chart-stat {
    min-width: 0;
    border-radius: 0.85rem;
    border: 1px solid rgb(226 232 240 / 0.8);
    background: rgb(248 250 252 / 0.75);
    padding: 0.55rem 0.65rem;
}

.app-chart-stat--accent {
    border-color: color-mix(in srgb, var(--color-accent-500) 35%, white);
    background: color-mix(in srgb, var(--color-accent-500) 12%, white);
}

.app-chart-stat__label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.app-chart-stat__value {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgb(15 23 42);
    font-variant-numeric: tabular-nums;
}

.app-chart-stat--accent .app-chart-stat__value {
    color: var(--color-accent-600);
}

.app-chart-donut-center {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.app-chart-donut-center__value {
    font-size: clamp(1.35rem, 4vw, 1.85rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: rgb(15 23 42);
    font-variant-numeric: tabular-nums;
}

.app-chart-donut-center__value--muted {
    color: rgb(100 116 139);
}

.app-chart-donut-center__label {
    margin-top: 0.35rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

html[data-appearance='dark'] .app-chart-card__title {
    color: #f1f5f9 !important;
}

html[data-appearance='dark'] .app-chart-card__sub,
html[data-appearance='dark'] .app-chart-stat__label,
html[data-appearance='dark'] .app-chart-donut-center__label {
    color: #94a3b8 !important;
}

html[data-appearance='dark'] .app-chart-shell {
    border-color: rgb(51 65 85 / 0.75);
    background:
        linear-gradient(180deg, rgb(15 23 42 / 0.55), rgb(15 23 42 / 0.82)),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 23px,
            rgb(148 163 184 / 0.05) 23px,
            rgb(148 163 184 / 0.05) 24px
        );
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
}

html[data-appearance='dark'] .app-chart-legend__item {
    border-color: rgb(51 65 85 / 0.85);
    background: rgb(15 23 42 / 0.55);
    color: #cbd5e1;
}

html[data-appearance='dark'] .app-chart-foot {
    border-top-color: rgb(51 65 85 / 0.75);
}

html[data-appearance='dark'] .app-chart-stat {
    border-color: rgb(51 65 85 / 0.8);
    background: rgb(15 23 42 / 0.45);
}

html[data-appearance='dark'] .app-chart-stat__value,
html[data-appearance='dark'] .app-chart-donut-center__value {
    color: #f1f5f9 !important;
}

/* ---------- Quick actions & customer search ---------- */
.app-quick-actions {
    padding: 1.15rem 1.15rem 1.1rem;
}

@media (min-width: 640px) {
    .app-quick-actions {
        padding: 1.35rem 1.35rem 1.2rem;
    }
}

.app-quick-actions__header {
    margin-bottom: 1rem;
}

.app-quick-actions__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgb(15 23 42);
}

.app-quick-actions__sub {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: rgb(100 116 139);
}

.app-quick-actions__grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .app-quick-actions__grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        gap: 1.25rem;
        align-items: start;
    }
}

.app-quick-actions__recent {
    margin-top: 0.85rem;
}

.app-quick-actions__recent-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.app-quick-actions__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.app-quick-actions__chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgb(226 232 240 / 0.95);
    background: rgb(248 250 252 / 0.9);
    padding: 0.32rem 0.7rem 0.32rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(51 65 85);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.app-quick-actions__chip:hover {
    border-color: color-mix(in srgb, var(--color-brand-600) 35%, white);
    background: color-mix(in srgb, var(--color-brand-600) 8%, white);
    color: var(--color-brand-900);
}

.app-quick-actions__chip-dot {
    height: 0.45rem;
    width: 0.45rem;
    shrink: 0;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgb(15 23 42 / 0.08);
}

.app-quick-actions__tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

@media (min-width: 640px) {
    .app-quick-actions__tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.app-quick-action {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(226 232 240 / 0.9);
    background: linear-gradient(180deg, rgb(255 255 255), rgb(248 250 252 / 0.95));
    padding: 0.75rem 0.8rem;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.app-quick-action:hover {
    border-color: color-mix(in srgb, var(--color-brand-600) 28%, white);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.06);
    transform: translateY(-1px);
}

.app-quick-action__icon {
    display: inline-flex;
    height: 2.15rem;
    width: 2.15rem;
    shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: rgb(241 245 249);
    color: rgb(51 65 85);
}

.app-quick-action__icon svg {
    height: 1.15rem;
    width: 1.15rem;
}

.app-quick-action__icon--brand {
    background: color-mix(in srgb, var(--color-brand-700) 14%, white);
    color: var(--color-brand-800);
}

.app-quick-action__icon--accent {
    background: color-mix(in srgb, var(--color-accent-500) 18%, white);
    color: var(--color-accent-600);
}

.app-quick-action__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.app-quick-action__label {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgb(15 23 42);
}

.app-quick-action__hint {
    font-size: 0.65rem;
    line-height: 1.25;
    color: rgb(100 116 139);
}

.app-quick-search {
    position: relative;
}

.app-quick-search__label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.app-quick-search__field {
    position: relative;
    display: flex;
    align-items: center;
}

.app-quick-search__icon {
    pointer-events: none;
    position: absolute;
    left: 0.85rem;
    z-index: 1;
    display: inline-flex;
    color: rgb(100 116 139);
}

.app-quick-search__icon svg {
    height: 1.05rem;
    width: 1.05rem;
}

.app-quick-search__input {
    width: 100%;
    min-height: 2.75rem;
    border-radius: 0.9rem;
    border: 1px solid rgb(203 213 225 / 0.95);
    background: rgb(255 255 255);
    padding: 0.65rem 0.85rem 0.65rem 2.45rem;
    font-size: 0.875rem;
    color: rgb(15 23 42);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.8);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-quick-search__input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--color-brand-600) 45%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand-600) 18%, transparent);
}

.app-quick-search--compact .app-quick-search__input {
    min-height: 2.5rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 0.82rem;
}

.app-quick-search__hint {
    pointer-events: none;
    position: absolute;
    right: 0.75rem;
    border-radius: 0.45rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(248 250 252);
    padding: 0.12rem 0.38rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgb(100 116 139);
}

.app-quick-search__list {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 120;
    margin-top: 0.35rem;
    max-height: 16rem;
    overflow-y: auto;
    border-radius: 0.95rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(255 255 255);
    padding: 0.35rem;
    box-shadow: 0 16px 40px rgb(15 23 42 / 0.12);
}

.app-quick-search__item {
    border-radius: 0.7rem;
    cursor: pointer;
}

.app-quick-search__item--active,
.app-quick-search__item:hover {
    background: color-mix(in srgb, var(--color-brand-600) 8%, white);
}

.app-quick-search__item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
}

.app-quick-search__item-name {
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgb(15 23 42);
}

.app-quick-search__item-actions {
    display: inline-flex;
    shrink: 0;
    gap: 0.35rem;
}

.app-quick-search__item-link {
    border-radius: 999px;
    border: 1px solid rgb(226 232 240);
    background: rgb(255 255 255);
    padding: 0.18rem 0.55rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-brand-800);
    text-decoration: none;
}

.app-quick-search__item-link--accent {
    border-color: color-mix(in srgb, var(--color-accent-500) 35%, white);
    color: var(--color-accent-600);
}

.app-quick-search__item-link:hover {
    background: rgb(248 250 252);
}

html[data-appearance='dark'] .app-quick-actions__title,
html[data-appearance='dark'] .app-quick-action__label,
html[data-appearance='dark'] .app-quick-search__item-name {
    color: #f1f5f9;
}

html[data-appearance='dark'] .app-quick-actions__sub,
html[data-appearance='dark'] .app-quick-action__hint,
html[data-appearance='dark'] .app-quick-actions__recent-label,
html[data-appearance='dark'] .app-quick-search__label,
html[data-appearance='dark'] .app-quick-search__hint {
    color: #94a3b8;
}

html[data-appearance='dark'] .app-quick-action,
html[data-appearance='dark'] .app-quick-actions__chip,
html[data-appearance='dark'] .app-quick-search__input,
html[data-appearance='dark'] .app-quick-search__list {
    border-color: rgb(51 65 85 / 0.85);
    background: rgb(15 23 42 / 0.55);
}

html[data-appearance='dark'] .app-quick-action__icon {
    background: rgb(30 41 59 / 0.85);
    color: #cbd5e1;
}

html[data-appearance='dark'] .app-quick-search__hint {
    background: rgb(30 41 59);
}

html[data-appearance='dark'] .app-quick-search__item-link {
    background: rgb(15 23 42);
    border-color: rgb(51 65 85);
    color: #e2e8f0;
}

/* ---------- Ledger filter form ---------- */
.app-ledger-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .app-ledger-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app-ledger-filter-grid {
        grid-template-columns: minmax(9rem, auto) minmax(9rem, auto) minmax(14rem, 1fr) auto;
        align-items: end;
    }
}

.app-ledger-product-field {
    grid-column: 1 / -1;
}

@media (min-width: 1024px) {
    .app-ledger-product-field {
        grid-column: auto;
    }
}

.app-ledger-filter-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

@media (min-width: 640px) {
    .app-ledger-filter-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}

@media (min-width: 1024px) {
    .app-ledger-filter-actions {
        grid-column: auto;
        flex-direction: column;
        align-items: stretch;
    }
}

.app-ledger-product-checks {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    max-height: 11rem;
    overflow-y: auto;
    border-radius: 0.9rem;
    border: 1px solid rgb(203 213 225 / 0.95);
    background: rgb(255 255 255);
    padding: 0.55rem;
}

@media (min-width: 640px) {
    .app-ledger-product-checks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app-ledger-product-checks {
        max-height: 9.5rem;
    }
}

.app-ledger-product-check {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    border-radius: 0.65rem;
    border: 1px solid transparent;
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: rgb(51 65 85);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.app-ledger-product-check:hover {
    background: rgb(248 250 252);
}

.app-ledger-product-check:has(input:checked) {
    border-color: color-mix(in srgb, var(--color-brand-600) 35%, white);
    background: color-mix(in srgb, var(--color-brand-600) 8%, white);
}

.app-ledger-product-check input {
    margin-top: 0.15rem;
    height: 1rem;
    width: 1rem;
    shrink: 0;
    accent-color: var(--color-brand-700);
}

.app-ledger-product-check span {
    min-width: 0;
    word-break: break-word;
}

html[data-appearance='dark'] .app-ledger-product-checks {
    border-color: rgb(51 65 85 / 0.85);
    background: rgb(15 23 42 / 0.55);
}

html[data-appearance='dark'] .app-ledger-product-check {
    color: #cbd5e1;
}

html[data-appearance='dark'] .app-ledger-product-check:hover {
    background: rgb(30 41 59 / 0.65);
}

html[data-appearance='dark'] .app-ledger-product-check:has(input:checked) {
    border-color: color-mix(in srgb, var(--color-brand-500) 45%, rgb(15 23 42));
    background: color-mix(in srgb, var(--color-brand-700) 22%, rgb(15 23 42));
}

/* ---------- Dashboard count-up digits ---------- */
.app-count-up {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

.app-count-up--active {
    filter: brightness(1.04);
}

@media (prefers-reduced-motion: no-preference) {
    .app-kpi .app-count-up--active,
    .app-chart-stat__value .app-count-up--active,
    .app-chart-donut-center__value.app-count-up--active,
    .app-chart-donut-center__value .app-count-up--active {
        transition: filter 0.2s ease;
    }
}

/* ---------- Dashboard inbox & watchlist ---------- */
.app-inbox,
.app-watchlist {
    padding: 1.15rem 1.15rem 1.1rem;
}

@media (min-width: 640px) {
    .app-inbox,
    .app-watchlist {
        padding: 1.35rem;
    }
}

.app-inbox__header {
    margin-bottom: 1rem;
}

.app-inbox__title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgb(15 23 42);
}

.app-inbox__sub {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: rgb(100 116 139);
}

.app-inbox__list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-inbox__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-radius: 0.95rem;
    border: 1px solid rgb(226 232 240 / 0.9);
    padding: 0.75rem 0.85rem;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.app-inbox__item:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.06);
}

.app-inbox__item--amber {
    border-color: color-mix(in srgb, #f59e0b 35%, white);
    background: color-mix(in srgb, #f59e0b 8%, white);
}

.app-inbox__item--rose {
    border-color: color-mix(in srgb, #f43f5e 30%, white);
    background: color-mix(in srgb, #f43f5e 7%, white);
}

.app-inbox__item--brand {
    border-color: color-mix(in srgb, var(--color-brand-600) 30%, white);
    background: color-mix(in srgb, var(--color-brand-600) 7%, white);
}

.app-inbox__item--sky {
    border-color: color-mix(in srgb, #0ea5e9 30%, white);
    background: color-mix(in srgb, #0ea5e9 8%, white);
}

.app-inbox__item-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: rgb(15 23 42);
}

.app-inbox__item-detail {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: rgb(100 116 139);
}

.app-inbox__item-count {
    display: inline-flex;
    min-width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgb(15 23 42);
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
}

.app-inbox__item--amber .app-inbox__item-count {
    background: #b45309;
}

.app-inbox__item--rose .app-inbox__item-count {
    background: #be123c;
}

.app-inbox__item--brand .app-inbox__item-count {
    background: var(--color-brand-800);
}

.app-inbox__item-arrow {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgb(100 116 139);
}

.app-inbox__clear {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.95rem;
    border: 1px dashed rgb(34 197 94 / 0.45);
    background: color-mix(in srgb, #22c55e 8%, white);
    padding: 1.5rem 1rem;
    text-align: center;
}

.app-inbox__clear-icon {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-weight: 700;
}

.app-inbox__clear-text {
    font-size: 0.82rem;
    color: rgb(71 85 105);
}

.app-watchlist__table-wrap {
    overflow-x: auto;
}

.app-watchlist__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.app-watchlist__table th {
    padding: 0.35rem 0.5rem 0.55rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(100 116 139);
    border-bottom: 1px solid rgb(226 232 240);
}

.app-watchlist__table td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid rgb(241 245 249);
    vertical-align: middle;
}

.app-watchlist__name {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    color: rgb(15 23 42);
    text-decoration: none;
}

.app-watchlist__name:hover {
    color: var(--color-brand-800);
}

.app-watchlist__dot {
    height: 0.5rem;
    width: 0.5rem;
    shrink: 0;
    border-radius: 999px;
}

.app-watchlist__util {
    display: inline-block;
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.app-watchlist__util--warn {
    background: rgb(254 243 199);
    color: #92400e;
}

.app-watchlist__util--high {
    background: rgb(255 237 213);
    color: #c2410c;
}

.app-watchlist__util--over {
    background: rgb(254 226 226);
    color: #b91c1c;
}

html[data-appearance='dark'] .app-inbox__title,
html[data-appearance='dark'] .app-inbox__item-label,
html[data-appearance='dark'] .app-watchlist__name {
    color: #f1f5f9;
}

html[data-appearance='dark'] .app-inbox__sub,
html[data-appearance='dark'] .app-inbox__item-detail,
html[data-appearance='dark'] .app-inbox__clear-text {
    color: #94a3b8;
}

html[data-appearance='dark'] .app-inbox__item,
html[data-appearance='dark'] .app-watchlist__table th,
html[data-appearance='dark'] .app-watchlist__table td {
    border-color: rgb(51 65 85 / 0.75);
}

html[data-appearance='dark'] .app-watchlist__table td {
    color: #cbd5e1;
}

/* ---------- Help desk contact icons ----------
   Each channel gets its own idle motion so the row reads as three distinct
   ways to reach a person, not one repeated button. Motion is short with a long
   pause between cycles: enough to draw the eye, not enough to nag.
   Every animation is disabled under prefers-reduced-motion. */

.helpline-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}

.helpline-chip svg {
    transform-origin: center;
}

/* Soft halo that expands on hover. */
.helpline-chip::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 currentColor;
    opacity: 0.45;
    transition: box-shadow 320ms ease, opacity 320ms ease;
    pointer-events: none;
}

.helpline-card:hover .helpline-chip,
.helpline-chip:hover {
    transform: translateY(-2px) scale(1.06);
}

.helpline-card:hover .helpline-chip::after,
.helpline-chip:hover::after {
    box-shadow: 0 0 0 6px currentColor;
    opacity: 0;
}

/* Phone: a handset ringing in its cradle. */
@keyframes helpline-ring {
    0%, 62%, 100% { transform: rotate(0deg); }
    64% { transform: rotate(-15deg); }
    68% { transform: rotate(13deg); }
    72% { transform: rotate(-11deg); }
    76% { transform: rotate(9deg); }
    80% { transform: rotate(-6deg); }
    84% { transform: rotate(4deg); }
    88% { transform: rotate(-2deg); }
}

.helpline-chip--call svg {
    animation: helpline-ring 3.6s ease-in-out infinite;
}

/* WhatsApp: the pop of a message arriving. */
@keyframes helpline-pop {
    0%, 70%, 100% { transform: scale(1); }
    78% { transform: scale(1.16); }
    86% { transform: scale(0.94); }
    92% { transform: scale(1.04); }
}

.helpline-chip--whatsapp svg {
    animation: helpline-pop 3.6s ease-in-out infinite;
}

/* Email: an envelope dropping into a tray. */
@keyframes helpline-nudge {
    0%, 68%, 100% { transform: translateY(0); }
    76% { transform: translateY(-3px); }
    84% { transform: translateY(1.5px); }
    92% { transform: translateY(-1px); }
}

.helpline-chip--email svg {
    animation: helpline-nudge 3.6s ease-in-out infinite;
}

/* Hover hands control back to the user: replay faster while pointing at it. */
.helpline-card:hover .helpline-chip--call svg,
.helpline-card:hover .helpline-chip--whatsapp svg,
.helpline-card:hover .helpline-chip--email svg {
    animation-duration: 1.1s;
}

@media (prefers-reduced-motion: reduce) {
    .helpline-chip,
    .helpline-chip::after,
    .helpline-chip svg,
    .helpline-card:hover .helpline-chip svg {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
