:root {
    /* Design tokens — single source of truth for the app's accent + surfaces.
       Promoted to the "Quiet SaaS" language (indigo + Hanken Grotesk) — see the
       login showcase. Most components key off these, so the look cascades. */
    --ds-primary: #4f46e5;
    --ds-primary-dark: #4338ca;
    --ds-link: #4f46e5;
    --ds-surface: #f8fafc;
    --ds-border: #e5e7eb;
    --ds-text: #334155;
    --ds-text-muted: #64748b;
    --ds-section: #94a3b8;
    --ds-hover: #eef2ff;
    --ds-radius: .65rem;
    --ds-radius-sm: .5rem;
    --ds-ink: #0f172a;       /* top-bar / heading ink */
    --ds-card-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 28px rgba(20, 30, 60, .06);

    /* Make Bootstrap 5.3 components share the same accent + radius */
    --bs-primary: var(--ds-primary);
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: var(--ds-link);
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: var(--ds-primary-dark);
    --bs-border-radius: var(--ds-radius-sm);
}

html, body {
    font-family: 'Hanken Grotesk', 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
    color: var(--ds-text);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--ds-link);
}

.btn-primary {
    color: #fff;
    background-color: var(--ds-primary);
    border-color: var(--ds-primary-dark);
}

.btn-primary:hover, .btn-primary:focus {
    color: #fff;
    background-color: var(--ds-primary-dark);
    border-color: var(--ds-primary-dark);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(79, 70, 229, .55);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* App shell: top bar + sidebar + content */
.ds-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Refined dark top bar (replaces flat bg-dark) — deep ink + hairline + soft lift */
.ds-topbar {
    background: var(--ds-ink);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 1px 0 rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
    min-height: 56px;
}

.ds-topbar .navbar-brand {
    font-weight: 800;
    letter-spacing: -.01em;
    color: #fff;
}

.ds-topbar .ds-brand-accent { color: #a5b4fc; }

.ds-topbar .btn-outline-light {
    border-color: rgba(255, 255, 255, .25);
}

.ds-topbar .btn-outline-light:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .4);
}

.ds-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.ds-sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--ds-surface);
    border-right: 1px solid var(--ds-border);
    padding: 1rem .75rem;
}

.ds-sidebar .nav-link {
    color: var(--ds-text);
    border-radius: var(--ds-radius-sm);
    padding: .5rem .75rem;
    margin-bottom: .15rem;
    display: flex;
    align-items: center;
    gap: .55rem;
}

.ds-sidebar .nav-link i {
    width: 1.15rem;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.ds-sidebar .nav-link:hover {
    background: var(--ds-hover);
}

.ds-sidebar .nav-link.active {
    background: var(--ds-primary);
    color: #fff;
}

.ds-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ds-section);
    margin: 1rem .75rem .35rem;
}

.ds-content {
    flex: 1 1 auto;
    padding: 1.75rem;
    min-width: 0;
    background:
        radial-gradient(55rem 32rem at 100% -5%, rgba(79, 70, 229, .04), transparent 60%),
        transparent;
}

/* Refined cards across the authenticated app (kept under .ds-content so MudBlazor is untouched) */
.ds-content .card {
    border: 1px solid #eceef1;
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-card-shadow);
}

.ds-content .card-title,
.ds-content h5 {
    color: var(--ds-ink);
    font-weight: 700;
    letter-spacing: -.01em;
}

/* Workspace context bar (company + period) in the top header */
.ds-workspacebar {
    margin-right: auto;
}

.ds-workspacebar-label {
    color: #adb5bd;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 0 .25rem;
}

.ds-workspacebar-select {
    width: auto;
    min-width: 150px;
}

/* Breadcrumb sits above each workspace page title */
.ds-content .breadcrumb {
    font-size: .85rem;
    margin-bottom: 1rem;
}

/* Clickable dashboard stat cards */
.ds-stat-card {
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
    border: 1px solid #eceef1;
    border-radius: var(--ds-radius);
}

.ds-stat-card:hover {
    box-shadow: 0 .75rem 1.5rem rgba(79, 70, 229, .14) !important;
    transform: translateY(-3px);
    border-color: #dfe2f3;
}

/* Tinted icon chip inside a stat card */
.ds-stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--ds-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ds-stat-icon.tint-blue   { background: #eef2ff; color: #4f46e5; }
.ds-stat-icon.tint-green  { background: #e6f4ea; color: #1e8e3e; }
.ds-stat-icon.tint-purple { background: #efeafc; color: #6f42c1; }
.ds-stat-icon.tint-teal   { background: #e3f4f4; color: #0c8599; }

.ds-stat-card .ds-stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--ds-ink);
}

/* Dashboard "this week" agenda */
.ds-hero-greeting {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ds-ink);
}

.ds-agenda-day {
    border-left: 3px solid var(--ds-border);
    padding-left: .85rem;
    margin-bottom: 1.1rem;
}

.ds-agenda-day.is-today {
    border-left-color: var(--ds-primary);
}

.ds-agenda-daylabel {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ds-text-muted);
    margin-bottom: .4rem;
}

.ds-agenda-item {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    padding: .35rem 0;
    border-bottom: 1px solid var(--ds-border);
}

.ds-agenda-item:last-child {
    border-bottom: none;
}

.ds-agenda-time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
    min-width: 5.5rem;
}

.ds-sidebar-wrap {
    flex-shrink: 0;
}

/* =====================================================================
   Auth pages (showcase — Direction B "Quiet SaaS"). Page-scoped under
   .auth-page so the rest of the app keeps its current Bootstrap look until
   we deliberately promote this language to the global tokens. The brand
   wordmark is a swappable slot for future per-tenant white-labelling.
   ===================================================================== */
.auth-page {
    --au-accent: #4f46e5;
    --au-accent-strong: #4338ca;
    --au-accent-soft: #eef2ff;
    --au-ink: #0f172a;
    --au-label: #475569;
    --au-muted: #64748b;
    --au-line: #e2e8f0;
    --au-field: #fbfcfd;

    font-family: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif;
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    /* Quiet atmosphere: two faint tinted pools over a cool neutral, not a flat fill */
    background:
        radial-gradient(60rem 40rem at 12% -10%, rgba(79, 70, 229, .06), transparent 60%),
        radial-gradient(50rem 38rem at 100% 110%, rgba(13, 148, 136, .05), transparent 55%),
        #f5f6f8;
}

.auth-card {
    width: 100%;
    max-width: 412px;
    background: #fff;
    border: 1px solid #eceef1;
    border-radius: 18px;
    padding: 2.4rem 2.3rem 2.1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 40px rgba(20, 30, 60, .07);
    animation: au-rise .5s cubic-bezier(.22, .61, .36, 1) both;
}

@keyframes au-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Brand slot — swap the text for a tenant <img> logo later, no layout change */
.auth-brand {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    color: var(--au-ink);
    margin-bottom: 1.6rem;
}

.auth-brand span { color: var(--au-accent); }

.auth-title {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--au-ink);
    margin: 0 0 .2rem;
}

.auth-sub {
    font-size: .9rem;
    color: var(--au-muted);
    margin: 0 0 1.5rem;
}

.auth-page .alert-danger {
    border: 0;
    background: #fef2f2;
    color: #b42318;
    border-radius: 10px;
    font-size: .85rem;
}

.auth-field { margin-bottom: 1.05rem; }

.auth-field label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--au-label);
    margin-bottom: .4rem;
}

/* Reach into Bootstrap inputs + the PasswordField component */
.auth-page .form-control {
    height: 46px;
    border-radius: 11px;
    border: 1px solid var(--au-line);
    background: var(--au-field);
    color: var(--au-ink);
    font-size: .95rem;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-page .form-control::placeholder { color: #94a3b8; }

.auth-page .form-control:focus {
    border-color: var(--au-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    outline: none;
}

/* PasswordField is .input-group + a reveal button — keep the seam clean */
.auth-page .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.auth-page .input-group .btn-outline-secondary {
    border-radius: 0 11px 11px 0;
    border: 1px solid var(--au-line);
    border-left: 0;
    color: var(--au-muted);
    background: var(--au-field);
}

.auth-page .input-group .btn-outline-secondary:hover {
    color: var(--au-accent);
    background: #fff;
}

.auth-btn {
    width: 100%;
    height: 48px;
    margin-top: .4rem;
    border: 0;
    border-radius: 11px;
    background: var(--au-accent);
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}

.auth-btn:hover:not(:disabled) {
    background: var(--au-accent-strong);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(79, 70, 229, .26);
}

.auth-btn:active:not(:disabled) { transform: translateY(0); }
.auth-btn:disabled { opacity: .65; cursor: default; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: 1.4rem 0;
    color: #94a3b8;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #eaedf1;
}

.auth-google { display: flex; justify-content: center; }

.auth-foot {
    text-align: center;
    font-size: .87rem;
    color: var(--au-muted);
    margin: 1.5rem 0 0;
}

.auth-foot a {
    color: var(--au-accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-foot a:hover { text-decoration: underline; }

@media (max-width: 767.98px) {
    .ds-main {
        flex-direction: column;
    }

    /* Sidebar is hidden behind the header hamburger until toggled open */
    .ds-sidebar-wrap {
        display: none;
    }

    .ds-sidebar-wrap.open {
        display: block;
    }

    .ds-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--ds-border);
    }

    /* Wide data tables scroll horizontally instead of overflowing the viewport */
    .ds-content .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .ds-content .mud-table {
        overflow-x: auto;
    }
}