/* ===========================================================================
   IHL CRM — glass theme (Frosted Light + Midnight Glass dark mode)

   DELIBERATELY A SEPARATE FILE. app.css gets regenerated by the build tooling
   and by other editing sessions, so the theme lives here and is loaded AFTER
   it. Selectors carry an extra `html` so this file wins whatever app.css holds.

   Do not fold this back into app.css.
   =========================================================================== */

/* ===========================================================================
   IHL CRM — application styling
   Glass theme. Light ("Frosted Light") is the default, dark ("Midnight Glass")
   switches on via <html data-theme="dark">. All colours are tokens, so the two
   themes share one stylesheet.
   =========================================================================== */

/* --- tokens: light (default) ---------------------------------------------- */

:root {
    color-scheme: light;

    /* page backdrop — the coloured mesh the glass sits on */
    --ihl-bg:            #eef1f8;
    --ihl-mesh-1:        rgba(99,102,241,.32);
    --ihl-mesh-2:        rgba(14,165,233,.28);
    --ihl-mesh-3:        rgba(236,72,153,.18);
    --ihl-mesh-base:     linear-gradient(160deg,#f6f8fd 0%,#e9edf7 100%);

    /* glass surfaces */
    --ihl-glass:         rgba(255,255,255,.58);
    --ihl-glass-strong:  rgba(255,255,255,.72);
    --ihl-glass-border:  rgba(255,255,255,.75);
    --ihl-glass-hover:   rgba(225,229,240,.85);
    --ihl-hover-tint:    rgba(16,24,40,.075);
    --ihl-blur:          blur(20px) saturate(165%);

    /* sidebar */
    --ihl-nav-bg:        rgba(255,255,255,.42);
    --ihl-nav-border:    rgba(255,255,255,.60);
    --ihl-nav-text:      #3c4657;
    --ihl-nav-hover:     rgba(16,24,40,.075);
    --ihl-brand:         #101828;

    /* text */
    --ihl-text:          #101828;
    --ihl-text-soft:     #475467;
    --ihl-muted:         #8b95a8;

    /* accent */
    --ihl-primary:       #4f46e5;
    --ihl-primary-dark:  #4338ca;
    --ihl-primary-soft:  rgba(79,70,229,.14);
    --ihl-primary-glow:  rgba(79,70,229,.30);
    --ihl-on-primary:    #ffffff;

    /* status tints */
    --ihl-amber-bg:      rgba(251,191,36,.18);
    --ihl-amber-line:    rgba(251,191,36,.45);
    --ihl-blue-bg:       rgba(56,189,248,.18);
    --ihl-blue-line:     rgba(56,189,248,.45);
    --ihl-red-bg:        rgba(244,63,94,.16);
    --ihl-red-line:      rgba(244,63,94,.40);
    --ihl-green:         #067647;
    --ihl-red:           #b42318;
    --ihl-row-hover:     rgba(16,24,40,.05);
    --ihl-line:          rgba(16,24,40,.08);

    --ihl-radius:        16px;
    --ihl-radius-sm:     11px;
    --ihl-shadow:        0 8px 32px rgba(17,24,39,.10);
    --ihl-shadow-lg:     0 16px 44px rgba(17,24,39,.16);
}

/* --- tokens: dark --------------------------------------------------------- */

html[data-theme="dark"] {
    color-scheme: dark;

    --ihl-bg:            #080b16;
    --ihl-mesh-1:        rgba(88,101,242,.42);
    --ihl-mesh-2:        rgba(6,182,212,.30);
    --ihl-mesh-3:        rgba(168,85,247,.28);
    --ihl-mesh-base:     linear-gradient(160deg,#0b1020 0%,#070a12 100%);

    --ihl-glass:         rgba(255,255,255,.07);
    --ihl-glass-strong:  rgba(255,255,255,.10);
    --ihl-glass-border:  rgba(255,255,255,.13);
    --ihl-glass-hover:   rgba(255,255,255,.14);
    --ihl-hover-tint:    rgba(255,255,255,.10);

    --ihl-nav-bg:        rgba(255,255,255,.05);
    --ihl-nav-border:    rgba(255,255,255,.10);
    --ihl-nav-text:      #b9c3d6;
    --ihl-nav-hover:     rgba(255,255,255,.10);
    --ihl-brand:         #ffffff;

    --ihl-text:          #eef2f8;
    --ihl-text-soft:     #aab4c6;
    --ihl-muted:         #7c879b;

    --ihl-primary:       #7c8cff;
    --ihl-primary-dark:  #6b7bfb;
    --ihl-primary-soft:  rgba(124,140,255,.20);
    --ihl-primary-glow:  rgba(124,140,255,.35);
    --ihl-on-primary:    #ffffff;

    --ihl-amber-bg:      rgba(251,191,36,.14);
    --ihl-amber-line:    rgba(251,191,36,.32);
    --ihl-blue-bg:       rgba(56,189,248,.14);
    --ihl-blue-line:     rgba(56,189,248,.32);
    --ihl-red-bg:        rgba(244,63,94,.14);
    --ihl-red-line:      rgba(244,63,94,.32);
    --ihl-green:         #4ade80;
    --ihl-red:           #ff8177;
    --ihl-row-hover:     rgba(255,255,255,.075);
    --ihl-line:          rgba(255,255,255,.10);

    --ihl-shadow:        0 8px 32px rgba(0,0,0,.45);
    --ihl-shadow-lg:     0 16px 44px rgba(0,0,0,.55);
}

/* --- base ----------------------------------------------------------------- */

html, html body { min-height: 100%; }

html body {
    background: var(--ihl-bg);
    background-image:
        radial-gradient(900px 620px at 8% -6%,  var(--ihl-mesh-1), transparent 60%),
        radial-gradient(820px 600px at 96% 2%,  var(--ihl-mesh-2), transparent 58%),
        radial-gradient(900px 700px at 66% 104%, var(--ihl-mesh-3), transparent 60%),
        var(--ihl-mesh-base);
    background-attachment: fixed;
    background-size: 160% 160%, 160% 160%, 160% 160%, cover;
    animation: ihl-mesh 30s ease-in-out infinite alternate;
    color: var(--ihl-text);
    font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
}

@keyframes ihl-mesh {
    0%   { background-position: 0% 0%, 100% 0%, 60% 100%, center; }
    100% { background-position: 12% 8%, 88% 10%, 48% 88%, center; }
}

html h1, html h2, html h3, html h4, html h5 { color: var(--ihl-text); font-weight: 620; letter-spacing: -.015em; }
html h1.h3 { font-size: 1.6rem; }

html a { color: var(--ihl-primary); text-decoration: none; }
html a:hover { text-decoration: underline; }

html .text-muted { color: var(--ihl-text-soft) !important; }
html .text-dark { color: var(--ihl-text) !important; }

html .fs-2, html .fs-3, html .fs-4, html .fs-5, html td.text-end, html th.text-end { font-variant-numeric: tabular-nums; }

/* --- shell ---------------------------------------------------------------- */

html .page { display: flex; min-height: 100vh; }

html .sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--ihl-nav-bg);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    border-right: 1px solid var(--ihl-nav-border);
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 1rem;
    transition: background-color .35s ease, border-color .35s ease;
}

html main { flex: 1; min-width: 0; }

html .top-row {
    height: 58px;
    background: var(--ihl-glass);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    border-bottom: 1px solid var(--ihl-glass-border);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 30;
    transition: background-color .35s ease, border-color .35s ease;
}

html .content { padding: 1.5rem 1.75rem 3rem; max-width: 1500px; }

/* --- sidebar brand and links --------------------------------------------- */

html .sidebar .navbar { height: auto; padding: 1.15rem 1.15rem .9rem; display: block; background: transparent; }
html .sidebar .navbar-brand {
    color: var(--ihl-brand); font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; padding: 0;
}
html .sidebar .navbar .small {
    color: var(--ihl-muted); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; margin-top: .25rem;
}

html .nav-scrollable { display: block; }

html .sidebar .nav-item { padding: 0 .6rem; margin-bottom: 2px; }

html .sidebar .nav-link {
    color: var(--ihl-nav-text);
    border-radius: var(--ihl-radius-sm);
    padding: .5rem .7rem;
    font-size: .875rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: .6rem;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
html .sidebar .nav-link:hover {
    background: var(--ihl-nav-hover);
    color: var(--ihl-text);
    text-decoration: none;
    transform: translateX(3px);
}
html .sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--ihl-primary), var(--ihl-primary-dark));
    color: var(--ihl-on-primary);
    font-weight: 560;
    box-shadow: 0 6px 18px var(--ihl-primary-glow);
}
html .sidebar .nav-link.active:hover { color: var(--ihl-on-primary); transform: translateX(3px); }

html .sidebar .nav-section {
    color: var(--ihl-muted);
    font-size: .63rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    padding: 1rem 1.3rem .35rem;
}

html .sidebar .nav-ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: .9; }
html .sidebar .nav-link.active .nav-ico { opacity: 1; }

/* --- theme toggle --------------------------------------------------------- */

html .theme-toggle {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--ihl-glass-border);
    background: var(--ihl-glass);
    color: var(--ihl-text-soft);
    cursor: pointer;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), background-color .2s ease, color .2s ease;
}
html .theme-toggle:hover { background: var(--ihl-glass-hover); color: var(--ihl-text); transform: rotate(-18deg) scale(1.08); }
html .theme-toggle:active { transform: scale(.94); }
html .theme-toggle .ico-sun { display: none; }
html .theme-toggle .ico-moon { display: block; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
html[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* --- glass cards ---------------------------------------------------------- */

html .card {
    background: var(--ihl-glass);
    border: 1px solid var(--ihl-glass-border);
    border-radius: var(--ihl-radius);
    box-shadow: var(--ihl-shadow);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    animation: ihl-rise .45s cubic-bezier(.22,.9,.3,1) both;
    transition: background-color .35s ease, border-color .35s ease, box-shadow .25s ease;
}
html .card-body { padding: 1.15rem 1.25rem; }

@keyframes ihl-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* dashboard alert tiles */
html .stat-tile {
    border-radius: var(--ihl-radius);
    border: 1px solid var(--ihl-glass-border);
    background: var(--ihl-glass);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    box-shadow: var(--ihl-shadow);
    padding: 1.05rem 1.2rem;
    height: 100%;
    position: relative;
    overflow: hidden;
    animation: ihl-rise .45s cubic-bezier(.22,.9,.3,1) both;
    transition: transform .22s ease, box-shadow .22s ease, background-color .35s ease, border-color .35s ease;
}
html .stat-tile:hover { transform: translateY(-3px); box-shadow: var(--ihl-shadow-lg); }

/* hover tint: darkens the surface in the light theme, lightens it in dark */
html .stat-tile::before, html .stage-tile::before, html .card.is-hoverable::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: var(--ihl-hover-tint); opacity: 0;
    transition: opacity .18s ease; pointer-events: none; z-index: 0;
}
html .stat-tile > *, html .stage-tile > * { position: relative; z-index: 1; }
html .stat-tile:hover::before, html a:hover > .stage-tile::before, html .stage-tile:hover::before { opacity: 1; }

/* a soft sheen that sweeps across the tile once on load */
html .stat-tile::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
    transform: translateX(-120%);
    animation: ihl-sheen 2.6s ease-in-out .5s 1;
    pointer-events: none;
}
@keyframes ihl-sheen { to { transform: translateX(120%); } }

html .stat-tile .stat-label {
    font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
    color: var(--ihl-text-soft); font-weight: 600; display: flex; align-items: center; gap: .4rem;
}
html .stat-tile .stat-value { font-size: 2.1rem; font-weight: 620; line-height: 1.12; margin-top: .4rem; font-variant-numeric: tabular-nums; }

html .stat-amber { background: linear-gradient(135deg, var(--ihl-amber-bg), var(--ihl-glass)); border-color: var(--ihl-amber-line); }
html .stat-blue { background: linear-gradient(135deg, var(--ihl-blue-bg),  var(--ihl-glass)); border-color: var(--ihl-blue-line); }
html .stat-red { background: linear-gradient(135deg, var(--ihl-red-bg),   var(--ihl-glass)); border-color: var(--ihl-red-line); }
html .stat-red .stat-value { color: var(--ihl-red); }
html .stat-plain { background: var(--ihl-glass); }

/* stagger the four tiles and the stage row */
html .row > [class*="col-"]:nth-child(1) .stat-tile, html .row > [class*="col-"]:nth-child(1) .stage-tile { animation-delay: .02s; }
html .row > [class*="col-"]:nth-child(2) .stat-tile, html .row > [class*="col-"]:nth-child(2) .stage-tile { animation-delay: .07s; }
html .row > [class*="col-"]:nth-child(3) .stat-tile, html .row > [class*="col-"]:nth-child(3) .stage-tile { animation-delay: .12s; }
html .row > [class*="col-"]:nth-child(4) .stat-tile, html .row > [class*="col-"]:nth-child(4) .stage-tile { animation-delay: .17s; }
html .row > [class*="col-"]:nth-child(5) .stage-tile { animation-delay: .22s; }
html .row > [class*="col-"]:nth-child(6) .stage-tile { animation-delay: .27s; }
html .row > [class*="col-"]:nth-child(7) .stage-tile { animation-delay: .32s; }
html .row > [class*="col-"]:nth-child(8) .stage-tile { animation-delay: .37s; }

/* stage tiles */
html .stage-tile {
    position: relative;
    background: var(--ihl-glass);
    border: 1px solid var(--ihl-glass-border);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    box-shadow: var(--ihl-shadow);
    border-radius: var(--ihl-radius);
    padding: .85rem 1rem;
    height: 100%;
    animation: ihl-rise .45s cubic-bezier(.22,.9,.3,1) both;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background-color .35s ease;
}
html a:hover > .stage-tile {
    border-color: var(--ihl-primary);
    box-shadow: var(--ihl-shadow-lg);
    transform: translateY(-3px);
    text-decoration: none;
}
html .stage-tile .stage-name { color: var(--ihl-text-soft); font-size: .82rem; }
html .stage-tile .stage-count { font-size: 1.55rem; font-weight: 620; font-variant-numeric: tabular-nums; }

html .section-label {
    font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ihl-muted); font-weight: 600; margin-bottom: .6rem;
}

/* --- tables --------------------------------------------------------------- */

html .table { --bs-table-bg: transparent; --bs-table-color: var(--ihl-text); color: var(--ihl-text); margin-bottom: 0; }
html .table > thead > tr > th {
    font-size: .68rem; letter-spacing: .07em; text-transform: uppercase;
    color: var(--ihl-muted); font-weight: 600; border-bottom: 1px solid var(--ihl-glass-border);
    padding: .55rem .6rem; background: transparent;
}
html .table > tbody > tr > td {
    padding: .6rem .6rem; border-bottom: 1px solid var(--ihl-line);
    vertical-align: middle; color: var(--ihl-text); background: transparent;
}
html .table > tbody > tr { transition: background-color .15s ease; }
html .table-hover > tbody > tr:hover > * { background: var(--ihl-row-hover); color: var(--ihl-text); }

/* --- forms ---------------------------------------------------------------- */

html .form-label { color: var(--ihl-text-soft); font-weight: 500; margin-bottom: .25rem; }
html .form-label.small.text-uppercase { font-size: .68rem; letter-spacing: .06em; color: var(--ihl-muted); font-weight: 600; }

html .form-control, html .form-select {
    border: 1px solid var(--ihl-glass-border);
    border-radius: var(--ihl-radius-sm);
    padding: .55rem .8rem;
    font-size: .9rem;
    color: var(--ihl-text);
    background-color: var(--ihl-glass-strong);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
html .form-control:focus, html .form-select:focus {
    border-color: var(--ihl-primary);
    background-color: var(--ihl-glass-strong);
    color: var(--ihl-text);
    box-shadow: 0 0 0 4px var(--ihl-primary-soft);
}
html .form-control:hover, html .form-select:hover { background-color: var(--ihl-glass-hover); }
html .form-control::placeholder { color: var(--ihl-muted); }
html .form-text { color: var(--ihl-muted); font-size: .76rem; }

/* Native dropdown list. The browser paints the popup from the select's own
   colours, and a translucent glass background made it come out white-on-white,
   so both are stated outright here. */
html .form-select, html .form-control { color-scheme: light; }
html .form-select option, html .form-select optgroup {
    background-color: #ffffff;
    color: #101828;
}
html[data-theme="dark"] .form-select, html[data-theme="dark"] .form-control { color-scheme: dark; }
html[data-theme="dark"] .form-select option, html[data-theme="dark"] .form-select optgroup {
    background-color: #131c30;
    color: #eef2f8;
}

html[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23aab4c6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

html .form-check-input { background-color: var(--ihl-glass-strong); border-color: var(--ihl-glass-border); }
html .form-check-input:checked { background-color: var(--ihl-primary); border-color: var(--ihl-primary); }

/* --- buttons -------------------------------------------------------------- */

html .btn {
    border-radius: var(--ihl-radius-sm);
    font-weight: 500;
    padding: .45rem .9rem;
    font-size: .9rem;
    transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
html .btn:active { transform: scale(.97); }
html .btn-lg { padding: .7rem 1rem; font-size: 1rem; }
html .btn-sm { padding: .3rem .7rem; font-size: .8rem; }

html .btn-primary {
    background: linear-gradient(135deg, var(--ihl-primary), var(--ihl-primary-dark));
    border-color: transparent;
    color: var(--ihl-on-primary);
    box-shadow: 0 6px 18px var(--ihl-primary-glow);
}
html .btn-primary:hover, html .btn-primary:focus {
    background: linear-gradient(135deg, var(--ihl-primary-dark), var(--ihl-primary-dark));
    border-color: transparent;
    color: var(--ihl-on-primary);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px var(--ihl-primary-glow);
}

html .btn-outline-secondary {
    border-color: var(--ihl-glass-border);
    background: var(--ihl-glass);
    color: var(--ihl-text-soft);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
html .btn-outline-secondary:hover {
    background: var(--ihl-glass-hover);
    color: var(--ihl-text);
    border-color: var(--ihl-glass-border);
    transform: translateY(-1px);
}

/* --- badges --------------------------------------------------------------- */

html .badge { font-weight: 550; border-radius: 999px; padding: .32em .7em; font-size: .72rem; }
html .badge.bg-light {
    background: var(--ihl-glass) !important;
    color: var(--ihl-text-soft) !important;
    border: 1px solid var(--ihl-glass-border) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
html .badge.bg-secondary {
    background: var(--ihl-primary-soft) !important;
    color: var(--ihl-primary) !important;
    border: 1px solid var(--ihl-primary-soft);
}

/* --- alerts --------------------------------------------------------------- */

html .alert {
    border-radius: var(--ihl-radius);
    border: 1px solid var(--ihl-glass-border);
    background: var(--ihl-glass);
    color: var(--ihl-text);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    font-size: .88rem;
    animation: ihl-rise .3s ease both;
}
html .alert-danger { background: linear-gradient(135deg, var(--ihl-red-bg),   var(--ihl-glass)); border-color: var(--ihl-red-line);   color: var(--ihl-red); }
html .alert-warning { background: linear-gradient(135deg, var(--ihl-amber-bg), var(--ihl-glass)); border-color: var(--ihl-amber-line); }
html .alert-info { background: linear-gradient(135deg, var(--ihl-blue-bg),  var(--ihl-glass)); border-color: var(--ihl-blue-line); }
html .alert-success { color: var(--ihl-green); }

/* --- login ---------------------------------------------------------------- */

html .login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
html .login-card {
    width: 100%; max-width: 380px;
    background: var(--ihl-glass);
    padding: 2.25rem;
    border: 1px solid var(--ihl-glass-border);
    border-radius: 20px;
    box-shadow: var(--ihl-shadow-lg);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    animation: ihl-pop .5s cubic-bezier(.22,.9,.3,1) both;
}
@keyframes ihl-pop {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

/* --- misc ----------------------------------------------------------------- */

html .list-group { border-radius: var(--ihl-radius); overflow: hidden; }
html .list-group-item {
    border-color: var(--ihl-line);
    background: var(--ihl-glass);
    color: var(--ihl-text);
    -webkit-backdrop-filter: var(--ihl-blur);
    backdrop-filter: var(--ihl-blur);
    transition: background-color .15s ease;
}
html .list-group-item:hover { background-color: var(--ihl-glass-hover); }

html .border { border-color: var(--ihl-glass-border) !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ihl-glass-border); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

html #blazor-error-ui {
    background: var(--ihl-amber-bg); bottom: 0; display: none; left: 0; padding: .7rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000; color: var(--ihl-text);
    -webkit-backdrop-filter: var(--ihl-blur); backdrop-filter: var(--ihl-blur);
    box-shadow: 0 -1px 2px rgba(0,0,0,.1);
}
html #blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

html .blazor-error-boundary { background: var(--ihl-red-bg); padding: 1rem; color: var(--ihl-red); border-radius: var(--ihl-radius); }


/* --- fields added after the theme (kept in the glass palette) -------------- */

/* Calculated fields the user cannot type into. */
html .field-readonly {
    background: var(--ihl-glass-hover);
    color: var(--ihl-text);
    border-color: var(--ihl-glass-border);
    font-weight: 600;
}
html .field-readonly:focus {
    background: var(--ihl-glass-hover);
    box-shadow: none;
    border-color: var(--ihl-glass-border);
}

/* A row of "pick exactly one" options in a form header. */
html .pick-one { display: flex; gap: .35rem; flex-wrap: wrap; }
html .pick-one .pick {
    border: 1px solid var(--ihl-glass-border);
    background: var(--ihl-glass);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-radius: 999px;
    padding: .3rem .8rem;
    font-size: .82rem;
    color: var(--ihl-text-soft);
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .15s ease;
}
html .pick-one .pick:hover {
    border-color: var(--ihl-primary);
    color: var(--ihl-primary);
    background: var(--ihl-glass-hover);
}
html .pick-one .pick.on {
    background: linear-gradient(135deg, var(--ihl-primary), var(--ihl-primary-dark));
    border-color: transparent;
    color: var(--ihl-on-primary);
    font-weight: 550;
    box-shadow: 0 6px 18px var(--ihl-primary-glow);
}

/* No up/down spinners on number fields - they get nudged by accident. */
html input[type=number]::-webkit-outer-spin-button, html input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
html input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 991.98px) {
    html .page { flex-direction: column; }
    html .sidebar { width: 100%; flex: none; height: auto; min-height: 0; position: static; border-right: none; border-bottom: 1px solid var(--ihl-nav-border); }
    html .content { padding: 1rem; }
}

/* --- accessibility: honour "reduce motion" -------------------------------- */

@media (prefers-reduced-motion: reduce) {
    html *, html *::before, html *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    html body { animation: none; }
}

/* --- fallback where backdrop-filter is unsupported ------------------------ */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html .card, html .stat-tile, html .stage-tile, html .top-row, html .sidebar, html .login-card, html .list-group-item {
        background: var(--ihl-glass-strong);
    }
}

/* ===========================================================================
   READABILITY FIXES  -  keep this block LAST in the file.

   Three things were wrong:
     1. Input borders were painted in the glass colour, which is white. On the
        light theme that is a white line on a white box - invisible.
     2. Bootstrap styles [readonly] fields itself, and its rule is more
        specific than ours, so calculated boxes (Sale amount) came out white
        with near-white text on the dark theme.
     3. The "Add new party" popup had a hard-coded white background, so on the
        dark theme its labels and inputs vanished.
   =========================================================================== */

:root {
    --ihl-muted:        #5f6b80;             /* was too light to read on white */
    --ihl-field-border: rgba(16,24,40,.20);  /* a border you can actually see  */
    --ihl-field-bg:     #f7f9fd;
    --ihl-surface:      #ffffff;             /* solid panel, for dialogs       */
}

html[data-theme="dark"] {
    --ihl-muted:        #9aa6bd;
    --ihl-field-border: rgba(255,255,255,.22);
    --ihl-field-bg:     rgba(255,255,255,.06);
    --ihl-surface:      #121a2c;
}

/* --- 1. visible field outlines -------------------------------------------- */
html .form-control,
html .form-select,
html textarea.form-control {
    border-color: var(--ihl-field-border);
}
html .form-control::placeholder,
html textarea.form-control::placeholder {
    color: var(--ihl-muted);
    opacity: 1;
}
html .input-group-text { border-color: var(--ihl-field-border); color: var(--ihl-text-soft); }

/* --- 2. calculated (read-only) fields ------------------------------------- */
/* Specific enough to beat Bootstrap's own .form-control[readonly] rule. */
html .form-control[readonly].field-readonly,
html .form-control[disabled].field-readonly,
html .form-control.field-readonly,
html input.field-readonly {
    background-color: var(--ihl-field-bg) !important;
    color: var(--ihl-text) !important;
    border-color: var(--ihl-field-border) !important;
    font-weight: 600;
    opacity: 1;
    -webkit-text-fill-color: var(--ihl-text);
}

/* --- 3. dialogs follow the theme ------------------------------------------ */
html .ihl-modal-backdrop {
    background: rgba(6,10,20,.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
html .ihl-modal {
    background: var(--ihl-surface);
    color: var(--ihl-text);
    border: 1px solid var(--ihl-glass-border);
    border-radius: var(--ihl-radius);
    box-shadow: var(--ihl-shadow-lg);
}
html .ihl-modal h1, html .ihl-modal h2, html .ihl-modal h3,
html .ihl-modal h4, html .ihl-modal h5 { color: var(--ihl-text); }
html .ihl-modal-head,
html .ihl-modal-foot { border-color: var(--ihl-line); }
html .ihl-modal .form-control,
html .ihl-modal .form-select,
html .ihl-modal textarea.form-control {
    background-color: var(--ihl-field-bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
html .ihl-modal .form-control:hover,
html .ihl-modal .form-select:hover { background-color: var(--ihl-field-bg); }
html .ihl-modal .btn-close { filter: none; }
html[data-theme="dark"] .ihl-modal .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* --- PO number: the only thing that opens the order ----------------------- */
/* The rest of the row stays selectable, so figures can be copied out. */
html .po-link {
    color: #5b6be8;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: .01em;
}
html .po-link:hover { text-decoration: underline; }
html[data-theme="dark"] .po-link {
    color: #7c8cff;
    text-shadow: 0 0 14px rgba(124,140,255,.45);
}

/* --- checkboxes: box and its words stay on one line ----------------------- */
html .form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-left: 0;
    min-height: 0;
    margin-bottom: 0;
}
html .form-check .form-check-input { float: none; margin: 0; flex: 0 0 auto; }
html .form-check .form-check-label { white-space: nowrap; cursor: pointer; }

/* --- last three rates, under the sale-rate box ---------------------------- */
html .rate-history { display: flex; flex-direction: column; gap: 2px; }
html .rate-history .rate-row {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    font-size: .74rem;
    padding: 1px 6px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--ihl-text-soft);
    background: var(--ihl-field-bg);
}
html .rate-history .rate-row:hover { background: var(--ihl-hover-tint); color: var(--ihl-text); }
html .rate-history .rate-no   { font-weight: 700; color: var(--ihl-primary); min-width: 52px; }
html .rate-history .rate-date { opacity: .75; }
html .rate-history .rate-val  { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
