@font-face {
    font-family: Sarabun;
    src: url("fonts/Sarabun-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: Sarabun;
    src: url("fonts/Sarabun-Medium.ttf") format("truetype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: Sarabun;
    src: url("fonts/Sarabun-SemiBold.ttf") format("truetype");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: Sarabun;
    src: url("fonts/Sarabun-Bold.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: Sarabun;
    src: url("fonts/Sarabun-ExtraBold.ttf") format("truetype");
    font-style: normal;
    font-weight: 800;
    font-display: swap;
}

:root {
    /* Palette: https://coolors.co/264653-2a9d8f-e9c46a-f4a261-e76f51 */
    --brand-aqua: #2a9d8f;
    --ink: #213d47;
    --muted: #4d6469;
    --line: #dce7e3;
    --canvas: #f4f7f6;
    --accent-tint: #e5f4ee;
    --blue: #17675d;
    --blue-dark: #124e47;
    --gold-tint: #f8e8bc;
    --total-background: linear-gradient(145deg, #19786a, #14584f);
    --surface: #fff;
    --surface-radius: .9rem;
    --surface-shadow: 0 2px 8px #173d3208;
    --table-heading: #e5f0eb;
    --table-heading-ink: #325450;
    --table-line: #e6eeeb;
    --field-line: #89aaa2;
    --focus: #08786c;
    --focus-shadow: 0 0 0 .18rem #2a9d8f38;
    --status-pending-ink: #79541c;
    --status-working-ink: #205a76;
    --status-complete-ink: #1f6b52;
    --status-cancelled-ink: #9b3930;
    --bs-body-font-family: Sarabun, "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--canvas);
    --bs-link-color-rgb: 23, 103, 93;
    --bs-link-hover-color-rgb: 18, 78, 71;
    --bs-primary-rgb: 23, 103, 93;
    --bs-success-rgb: 31, 107, 82;
    --bs-danger-rgb: 155, 57, 48;
}

html[data-bs-theme="dark"] {
    --ink: #e3efec;
    --muted: #adc1bd;
    --line: #354e4e;
    --canvas: #101c20;
    --accent-tint: #203d39;
    --blue: #81d7c9;
    --blue-dark: #a5e7db;
    --gold-tint: #49371d;
    --surface: #18282d;
    --surface-shadow: 0 2px 8px #0003;
    --table-heading: #243b3d;
    --table-heading-ink: #d0e5e0;
    --table-line: #354e4e;
    --field-line: #688582;
    --focus: #8be6d5;
    --status-pending-ink: #f5cd84;
    --status-working-ink: #a9def5;
    --status-complete-ink: #9cdec0;
    --status-cancelled-ink: #ffb7aa;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--canvas);
    --bs-secondary-color: var(--muted);
    --bs-secondary-bg: var(--table-heading);
    --bs-link-color-rgb: 129, 215, 201;
    --bs-link-hover-color-rgb: 165, 231, 219;
    --bs-primary-rgb: 129, 215, 201;
    --bs-success-rgb: 156, 222, 192;
    --bs-danger-rgb: 255, 183, 170;
}

[data-bs-theme="dark"] :is(.btn-primary, .login-form .login-submit) {
    --bs-btn-bg: #17675d;
    --bs-btn-hover-bg: #1a7568;
    --bs-btn-active-bg: #124e47;
}
[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-hover-color: var(--canvas);
    --bs-btn-active-color: var(--canvas);
    --bs-btn-active-bg: var(--blue-dark);
    --bs-btn-active-border-color: var(--blue-dark);
}
[data-bs-theme="dark"] .btn-danger {
    --bs-btn-bg: #9b3930;
    --bs-btn-border-color: #9b3930;
}
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-hover-color: var(--canvas); }
[data-bs-theme="dark"] .form-check-input:checked { background-color: #17675d; }

[data-bs-theme="dark"] .system-alert {
    --alert-bg: #203640;
    --alert-line: #496677;
    --alert-chip: #527b8e;
}
[data-bs-theme="dark"] .system-alert--success {
    --alert-bg: #203a31;
    --alert-line: #436e5f;
    --alert-chip: #4d806f;
}
[data-bs-theme="dark"] .system-alert--error {
    --alert-bg: #402c2c;
    --alert-line: #79514d;
    --alert-chip: #a2655f;
}
[data-bs-theme="dark"] .field-warning {
    --alert-bg: #3b3020;
    --alert-line: #79623c;
    --alert-chip: #e6c784;
}

.sidebar-controls, .guest-controls { display: flex; gap: .4rem; }
.sidebar-controls { display: none; }
.sidebar-controls .theme-toggle { min-width: 0; }
.guest-controls { justify-content: center; margin-block-end: .75rem; }
.theme-toggle { white-space: nowrap; }
.theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.theme-toggle > span { display: inline-block; width: 1em; }
.theme-toggle .theme-icon-dark,
.theme-toggle[aria-pressed="true"] .theme-icon-light { display: none; }
.theme-toggle[aria-pressed="true"] .theme-icon-dark { display: inline-block; }
.theme-toggle[aria-pressed="true"]:not(:hover) { background: var(--accent-tint); }

@media (max-width: 760px) {
    .sidebar-controls { display: flex; align-items: center; justify-content: end; }
    .sidebar-controls .btn { padding-inline: .5rem; font-size: .87rem; }
}

body { min-height: 100vh; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3 { font-weight: 750; line-height: 1.3; }
h1 { font-size: clamp(1.35rem, 2vw, 1.85rem); margin: 0; }
h2 { font-size: 1.18rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; }
.muted, .form-text { color: var(--muted); }
.nowrap { white-space: nowrap; }
.preserve-lines, .text-values dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.form-label { font-weight: 650; margin-bottom: .4rem; }
.form-control, .form-select { background-color: var(--surface); border-color: var(--field-line); min-width: 0; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--focus); box-shadow: var(--focus-shadow); }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue-dark); --bs-btn-hover-border-color: var(--blue-dark); --bs-btn-active-bg: var(--blue-dark); --bs-btn-active-border-color: var(--blue-dark); }
.btn-outline-primary { --bs-btn-color: var(--blue); --bs-btn-border-color: #67978d; --bs-btn-hover-bg: var(--blue); --bs-btn-hover-border-color: var(--blue); }
.btn-danger {
    --bs-btn-bg: var(--status-cancelled-ink);
    --bs-btn-border-color: var(--status-cancelled-ink);
    --bs-btn-hover-bg: #813028;
    --bs-btn-hover-border-color: #813028;
    --bs-btn-active-bg: #692720;
    --bs-btn-active-border-color: #692720;
}
.btn-outline-danger {
    --bs-btn-color: var(--status-cancelled-ink);
    --bs-btn-border-color: var(--status-cancelled-ink);
    --bs-btn-hover-bg: var(--status-cancelled-ink);
    --bs-btn-hover-border-color: var(--status-cancelled-ink);
    --bs-btn-active-bg: #813028;
    --bs-btn-active-border-color: #813028;
}
.btn:not(.btn-sm) { min-height: 2.7rem; font-weight: 650; }
.skip-link { position: absolute; top: .4rem; left: .4rem; padding: .65rem; background: var(--surface); z-index: 5; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.signed-in { display: grid; grid-template-columns: 235px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 2.15rem; background: var(--surface); color: var(--ink); border-inline-end: 1px solid var(--line); min-height: 100vh; padding: 1.6rem .9rem 1.2rem; }
.brand { display: grid; justify-items: center; gap: .55rem; width: 100%; color: var(--ink); text-align: center; text-decoration: none; font-weight: 750; font-size: 1.1rem; }
.brand:hover { color: var(--blue); }
.brand small { display: block; margin-top: .16rem; font-size: .77rem; color: var(--muted); font-weight: 500; }
.brand-logo { display: block; flex: 0 0 auto; width: 5.25rem; height: 4.15rem; object-fit: contain; }
.brand-mark { display: inline-grid; flex: 0 0 auto; place-items: center; width: 2.45rem; height: 2.45rem; border-radius: .8rem; background: #d5efe8; color: #18554c; font: 800 1.55rem/1 system-ui, sans-serif; }
.side-nav { display: grid; gap: .36rem; }
:is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary) {
    align-items: center;
    min-block-size: 2.65rem;
    border-radius: .6rem;
    padding: .65rem .8rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .93rem;
    background: transparent;
}
.side-nav > a, .notif-fallback { display: flex; gap: .35rem; }
.side-nav > a > svg { flex: none; }
:is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is(:hover, [aria-current="page"], .is-current, [aria-expanded="true"]),
.admin-nav[open] > summary { background: var(--accent-tint); color: var(--blue); }
:is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is([aria-current="page"], .is-current) {
    box-shadow: inset 3px 0 var(--blue);
    font-weight: 750;
}
.admin-nav > summary { display: flex; justify-content: space-between; gap: .65rem; list-style: none; cursor: pointer; }
.admin-nav > summary::-webkit-details-marker { display: none; }
.admin-nav > summary::after { content: ''; flex: none; width: .45rem; height: .45rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.admin-nav[open] > summary::after { transform: rotate(225deg); }
.admin-nav-links {
    display: grid;
    gap: .15rem;
    margin: .4rem 0 0;
    padding: .3rem;
    list-style: none;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--surface-radius);
    box-shadow: var(--surface-shadow);
}
.admin-nav-links a {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-block-size: 2.4rem;
    padding: .38rem .55rem;
    color: var(--ink);
    border-radius: .5rem;
    font-size: .88rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.admin-nav-links svg { flex: none; width: 18px; height: 18px; color: var(--blue); }
.admin-nav-links a:hover { background: var(--canvas); }
.admin-nav-links a[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--blue);
    box-shadow: inset 2px 0 var(--blue);
    font-weight: 750;
}
.sidebar .admin-nav-links a:focus-visible { outline-color: var(--focus); outline-offset: -2px; }
.mobile-menu-toggle { display: none; }
.mobile-menu {
    inset: 0 auto 0 0;
    width: min(21rem, 88vw);
    max-width: none;
    height: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 0 2rem #213d4726;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.mobile-menu::backdrop { background: #142c37a6; }
.mobile-menu[open] { display: flex; flex-direction: column; }
.mobile-menu-open { overflow: hidden; }
.mobile-menu-header {
    display: flex;
    flex: none;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
}
.mobile-menu-header h2 { margin: 0; font-size: 1.1rem; }
.mobile-menu .side-nav { display: grid; flex: none; padding: .75rem 1rem; }
.mobile-menu .notif-bell { width: 100%; }
@media (prefers-reduced-motion: no-preference) {
    :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary, .admin-nav-links a) { transition: background-color .14s ease, box-shadow .14s ease; }
    .mobile-menu[open] { animation: mobile-menu-enter .2s ease-out; }
    @keyframes mobile-menu-enter {
        from { transform: translateX(-100%); }
    }
}
.nav-count { border-radius: 20px; padding: .1rem .38rem; color: #1b4843; background: #bcebe0; font-size: .69rem; white-space: nowrap; }
.account {
    display: flex;
    justify-content: flex-end;
    padding-block-start: .8rem;
}
.account > .theme-toggle { flex: none; align-self: center; margin-inline-end: .4rem; }
.account-dropdown { position: relative; min-width: 0; max-width: 22rem; }
.account-profile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .35rem .6rem;
    padding: .45rem .65rem;
    min-height: 2.75rem;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}
.account-profile::-webkit-details-marker { display: none; }
.account-profile:hover,
.account-dropdown[open] > .account-profile { border-color: var(--field-line); }
.account-identity { display: grid; gap: .12rem; overflow-wrap: anywhere; }
.account-identity strong { line-height: 1.3; }
.account-identity span { color: var(--muted); font-size: .79rem; }
.account-chevron { width: 1rem; color: var(--blue); }
.account-dropdown[open] .account-chevron { transform: rotate(180deg); }
.account-dropdown-panel {
    position: absolute;
    z-index: 4;
    inset-block-start: calc(100% + .45rem);
    inset-inline-end: 0;
    width: min(15rem, calc(100vw - 2rem));
    min-width: min(100%, 100vw - 2rem);
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: .85rem;
    background: var(--surface);
    box-shadow: 0 8px 22px #102d3326;
}
.account-dropdown-panel form { margin: .25rem 0 0; padding-block-start: .25rem; border-block-start: 1px solid var(--line); }
.mobile-menu > .account {
    display: block;
    flex: none;
    margin-block-start: auto;
    padding: .75rem 1rem max(1rem, env(safe-area-inset-bottom));
    border-block-start: 1px solid var(--line);
}
.mobile-menu .account-dropdown { max-width: none; }
.mobile-menu .account-dropdown-panel {
    position: static;
    width: 100%;
    margin-block-start: .45rem;
    box-shadow: none;
}
.account-option {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    min-height: 2.75rem;
    padding: .5rem .65rem;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: start;
    text-decoration: none;
}
.account-option svg { flex: none; width: 1.15rem; height: 1.15rem; }
.account-option:is(:hover, [aria-current="page"]) { background: var(--canvas); color: var(--blue-dark); }
.account-option:focus-visible { outline-offset: -2px; }
.account-option.sign-out { color: var(--status-cancelled-ink); }
.account-avatar {
    --account-avatar-size: 2.4rem;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: calc(var(--account-avatar-size) / 24);
    inline-size: var(--account-avatar-size);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--blue-dark);
}
.account-avatar:has(img) { display: block; }
.account-avatar img { display: block; inline-size: 100%; block-size: 100%; border-radius: inherit; object-fit: cover; }
.account-avatar:not(:has(img))::before,
.account-avatar:not(:has(img))::after { content: ''; display: block; background: currentColor; }
.account-avatar::before { inline-size: calc(var(--account-avatar-size) * .23); aspect-ratio: 1; border-radius: 50%; }
.account-avatar::after { inline-size: calc(var(--account-avatar-size) * .44); block-size: calc(var(--account-avatar-size) * .23); border-radius: 65% 65% 15% 15%; }

.main-content { width: 100%; max-width: 1720px; margin-inline: auto; min-width: 0; padding: 0 clamp(.85rem, 1.8vw, 1.65rem) 2rem; }
.main-content:focus { outline: none; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1.25rem; padding: 1.2rem 0 1rem; border-bottom: 2px solid var(--line); }
.page-heading p { margin: .4rem 0 0; color: var(--muted); overflow-wrap: anywhere; }
.eyebrow, .page-heading .eyebrow { margin: 0 0 .25rem; color: var(--blue); font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.3; }
.page-heading > :is(.btn, .state) { flex-shrink: 0; }
.main-content > .alert { margin-top: 1rem; }

/* Alert card design reference: andrew-demchenk0 on Uiverse.io
   https://uiverse.io/andrew-demchenk0/bad-squid-34 */
.system-alert {
    --alert-bg: #eff7fb;
    --alert-line: #bad5e2;
    --alert-chip: #deedf5;
    --alert-ink: var(--status-working-ink);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8h.01M12 11v5'/%3E%3C/svg%3E");
}
.system-alert--success {
    --alert-bg: #edf8f3;
    --alert-line: #b6d9ca;
    --alert-chip: #d7efe3;
    --alert-ink: var(--status-complete-ink);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 2.5 2.5 5.5-5.5'/%3E%3C/svg%3E");
}
.system-alert--error {
    --alert-bg: #fdf1ee;
    --alert-line: #ebc6bf;
    --alert-chip: #f8dfd9;
    --alert-ink: var(--status-cancelled-ink);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6m0 3h.01'/%3E%3C/svg%3E");
}
.system-alert:not(:empty) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: .7rem;
    padding: .75rem .85rem;
    border: 1px solid var(--alert-line);
    border-radius: .8rem;
    background: var(--alert-bg);
    color: var(--alert-ink);
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.system-alert:not(:empty)::before {
    content: '';
    width: 1.95rem;
    height: 1.95rem;
    border-radius: .55rem;
    background-color: var(--alert-chip);
    background-image: var(--alert-icon);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 1.15rem;
}
/* Validation alert design reference: andrew-demchenk0 on Uiverse.io
   https://uiverse.io/andrew-demchenk0/little-monkey-23 */
.field-warning {
    --alert-bg: #fff7e2;
    --alert-line: #e7cc8a;
    --alert-chip: #f9e5b0;
    --alert-ink: var(--status-pending-ink);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2379541c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 20h19L12 3Zm0 6v4m0 3h.01'/%3E%3C/svg%3E");
    width: fit-content;
    max-width: 100%;
    margin: .4rem 0 0;
    font-size: .88rem;
}
.field-warning:not(:empty) { align-items: center; gap: .55rem; padding: .45rem .65rem; }
.field-warning:not(:empty)::before { width: 1.6rem; height: 1.6rem; background-size: 1rem; }
.back-link { display: inline-block; font-size: .9rem; margin: 0 0 .55rem; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--surface-radius); min-width: 0; box-shadow: var(--surface-shadow); }
.padded { --card-padding: clamp(1rem, 2.4vw, 1.55rem); padding: var(--card-padding); }
.spaced { margin-bottom: 1.25rem; }
.panel-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .32rem .65rem;
    min-height: 2.9rem;
    padding: .85rem 1rem;
    border-radius: calc(var(--surface-radius) - 1px) calc(var(--surface-radius) - 1px) 0 0;
    background: var(--surface);
    color: var(--ink);
    border-bottom: 1px solid var(--table-line);
}
.panel-heading h2, h2.panel-heading { margin: 0; font-size: 1rem; }
.panel-heading > span { font-size: .79rem; color: var(--muted); }
.panel-heading a { font-size: .79rem; color: var(--blue); text-underline-offset: .16em; }
.padded > h2.panel-heading { margin: calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding)) 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.stat-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 6.5rem; gap: .5rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; box-shadow: var(--surface-shadow); }
.stat-card span { color: var(--muted); font-size: .85rem; font-weight: 650; }
.stat-card strong { font-size: 1.8rem; font-variant-numeric: tabular-nums; line-height: 1; }
.tone-total, .dashboard-metric.metric-total { background: var(--total-background); border-color: transparent; color: #fff; }
.tone-total span { color: #fff; }
.tone-pending strong { color: var(--status-pending-ink); }
.tone-working strong { color: var(--status-working-ink); }
.tone-complete strong { color: var(--status-complete-ink); }
.report-stats { padding: 0 1.25rem .25rem; }
.filter-bar { display: grid; align-items: end; grid-template-columns: minmax(7rem, 1.5fr) minmax(7rem, .8fr) auto; gap: .65rem; padding: 1rem 1.25rem; }
.table-responsive { position: relative; border-radius: 0 0 var(--surface-radius) var(--surface-radius); }
.work-table, .dashboard-table { margin: 0; --bs-table-bg: transparent; --bs-table-border-color: var(--table-line); }
.work-table { min-width: 560px; }
.work-table th, .work-table td { padding: .8rem .85rem; vertical-align: middle; overflow-wrap: anywhere; }
.work-table th:first-child, .work-table td:first-child { padding-inline-start: 1.25rem; }
.work-table thead th, .dashboard-table thead th { background: var(--table-heading); color: var(--table-heading-ink); }
.work-table thead th { font-size: .83rem; }
.work-table tbody tr:last-child td { border-bottom: 0; }
.work-table td small, .notice-list small, .timeline small { display: block; color: var(--muted); margin-top: .1rem; }
.work-table td .urgency { color: var(--status-cancelled-ink); font-weight: 650; }
.account-list { margin: 0; padding: 0; list-style: none; }
.account-list > li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .65rem 1rem;
    border-top: 1px solid var(--table-line);
    padding: .8rem var(--card-padding, 1rem);
}
.account-list-summary { margin: 0; padding: 0 var(--card-padding, 1rem) .8rem; color: var(--muted); }
.account-identity { display: grid; min-inline-size: 0; gap: .15rem; overflow-wrap: anywhere; }
.account-identity small, .account-row-actions small { color: var(--muted); }
.account-row-selected { background: var(--accent-tint); }
.account-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.account-row-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-block-size: 2.75rem; }
.account-confirmation { max-inline-size: 32rem; }
.account-confirmation .account-identity { padding: .75rem; background: var(--canvas); border: 1px solid var(--line); border-radius: .5rem; }
#cancel-delete, [id^="delete-account-"], #system-feedback { scroll-margin-block: 1rem; }
.state.account-state-active { color: #195940; background: #d9f1e4; }
.ticket-link { font-weight: 750; white-space: nowrap; text-underline-offset: 3px; }
.empty { color: var(--muted); border-top: 1px dashed var(--line); margin: 1rem 1.25rem; padding: 1rem 0 .5rem; }
.pager { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 1rem; padding: .85rem 1.25rem; align-items: center; }
.pager a { padding: .25rem; }
.state { display: inline-block; border-radius: 2rem; font-size: .82rem; font-weight: 700; color: #365850; background: #e4efea; padding: .25rem .63rem; width: fit-content; white-space: nowrap; }
.state-pending, .state-waiting_user, .state-waiting_parts { color: #79541c; background: #fcf0d3; }
.state-working, .state-accepted, .state-in_progress { color: #205a76; background: #e0eff6; }
.state-complete, .state-completed { color: #195940; background: #d9f1e4; }
.state-cancelled { color: #9b3930; background: #fae7df; }
html[data-bs-theme="dark"] .state,
:root[data-theme="dark"] .state { color: #d6ebe5; background: #233a37; }
html[data-bs-theme="dark"] .state-pending,
html[data-bs-theme="dark"] .state-waiting_user,
html[data-bs-theme="dark"] .state-waiting_parts,
:root[data-theme="dark"] .state-pending,
:root[data-theme="dark"] .state-waiting_user,
:root[data-theme="dark"] .state-waiting_parts { color: #f5cd84; background: #423217; }
html[data-bs-theme="dark"] .state-working,
html[data-bs-theme="dark"] .state-accepted,
html[data-bs-theme="dark"] .state-in_progress,
:root[data-theme="dark"] .state-working,
:root[data-theme="dark"] .state-accepted,
:root[data-theme="dark"] .state-in_progress { color: #a9def5; background: #183644; }
html[data-bs-theme="dark"] .state-complete,
html[data-bs-theme="dark"] .state-completed,
html[data-bs-theme="dark"] .state.account-state-active,
:root[data-theme="dark"] .state-complete,
:root[data-theme="dark"] .state-completed,
:root[data-theme="dark"] .state.account-state-active { color: #9cdec0; background: #173a2f; }
html[data-bs-theme="dark"] .state-cancelled,
:root[data-theme="dark"] .state-cancelled { color: #ffb7aa; background: #421f1c; }

.form-surface { max-width: 760px; padding: clamp(1rem, 3vw, 1.8rem); }

html:has(.case-dialog[open]) { overflow: hidden; }
.case-dialog {
    width: min(46rem, calc(100% - 1rem));
    max-width: none;
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    margin: auto;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--surface-radius);
    box-shadow: 0 16px 60px #0004;
}
.case-dialog:not([open]) { display: none; }
.case-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.case-dialog::backdrop { background: #102d3399; }
.case-dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem clamp(.75rem, 3vw, 1.4rem);
    border-bottom: 1px solid var(--line);
}
.case-dialog-heading h2 { margin: 0; font-size: 1.25rem; }
.case-dialog-body {
    min-height: 0;
    padding: .75rem clamp(.75rem, 3vw, 1.4rem);
    overflow: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}

.form-stack, .detail-column { display: grid; gap: 1rem; min-width: 0; }
.profile-card {
    width: min(100%, 42rem);
    margin: clamp(1rem, 3vw, 2rem) auto 0;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: 1rem;
    box-shadow: 0 14px 36px #102d3314;
}
.profile-card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.5rem; }
.profile-card-header h1 { font-size: clamp(1.3rem, 2.2vw, 1.65rem); }
.profile-card-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.profile-card-actions .btn { font-size: .9rem; }
.profile-section + .profile-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.profile-section h2 { display: flex; align-items: center; gap: .5rem; margin-bottom: .9rem; font-size: 1rem; }
.profile-section h2 svg { flex: none; width: 1.15rem; height: 1.15rem; color: var(--blue); }
.profile-photo { display: grid; justify-items: center; text-align: center; }
.profile-photo-picker { display: grid; justify-items: center; gap: .6rem; color: var(--blue); font-weight: 650; cursor: pointer; }
.profile-photo-control { position: relative; }
.profile-photo .account-avatar { --account-avatar-size: clamp(6rem, 14vw, 8rem); }
.profile-photo-icon {
    position: absolute;
    inset-inline-end: 0;
    inset-block-end: 0;
    display: grid;
    place-items: center;
    width: 2.15rem;
    height: 2.15rem;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--blue);
    color: var(--surface);
    pointer-events: none;
}
.profile-photo-icon svg { width: 1.1rem; height: 1.1rem; }
.profile-photo-picker:hover .profile-photo-icon { background: var(--blue-dark); }
.profile-photo-picker:hover #profile-avatar-label { text-decoration: underline; }
.profile-file { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.profile-file:focus-visible + .account-avatar { outline: 3px solid var(--focus); outline-offset: 3px; }
.profile-file[aria-invalid="true"] + .account-avatar { box-shadow: 0 0 0 2px var(--status-cancelled-ink); }
.profile-card .form-label { font-size: .9rem; }
.profile-crop {
    width: min(28rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 1.5rem);
    padding: clamp(.85rem, 4vw, 1.5rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    color: var(--ink);
}
.profile-crop::backdrop { background: #102d3399; }
.profile-crop h2 { margin-bottom: .4rem; }
.profile-crop p { font-size: .9rem; }
.profile-crop p:empty { margin: 0; }
.profile-crop-frame {
    position: relative;
    width: min(100%, 18rem, 44dvh);
    margin: 0 auto .85rem;
    background: var(--canvas);
}
.profile-crop-frame::after {
    position: absolute;
    inset: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    content: '';
    pointer-events: none;
}
.profile-crop-frame canvas { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; }
.profile-crop-frame canvas:active { cursor: grabbing; }
.profile-crop-frame canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.profile-crop .profile-card-actions { justify-content: flex-end; margin-top: .65rem; }
.two-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .8rem; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.detail-grid, .admin-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); align-items: start; gap: 1rem; }
/* Search input design reference: uiverse-astronaut on Uiverse.io
   https://uiverse.io/uiverse-astronaut/orange-starfish-84 */
.admin-search {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0;
    padding: .85rem var(--card-padding, 1rem);
}
.padded > .admin-search { padding: 0 0 .85rem; }
.admin-search-field { position: relative; flex: 1 1 14rem; min-width: 0; max-width: 30rem; }
.admin-search-field svg {
    position: absolute;
    inset-inline-start: .8rem;
    inset-block-start: 50%;
    width: 1.15rem;
    height: 1.15rem;
    transform: translateY(-50%);
    color: var(--blue);
    pointer-events: none;
}
.admin-search-field .form-control {
    min-height: 2.75rem;
    padding-inline-start: 2.4rem;
    border-radius: .65rem;
    background: var(--surface);
}
.admin-search .btn { min-height: 2.75rem; }
.admin-search--audit { align-items: flex-end; }
.admin-search-dates { display: flex; flex-wrap: wrap; gap: .5rem; }
.admin-search-dates > div { flex: 1 1 9rem; min-width: 0; }
.admin-search-dates .form-label { margin-bottom: .25rem; font-size: .88rem; }
.admin-search-dates .form-control { min-height: 2.75rem; border-radius: .65rem; }
@media (max-width: 520px) {
    .admin-search-field { flex-basis: 100%; max-width: none; }
    .admin-search-dates { flex-basis: 100%; }
}
.detail-column { align-content: start; }
.key-values { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; border-bottom: 1px solid var(--line); padding-bottom: .8rem; }
.key-values dt { color: var(--muted); font-size: .85rem; }
.key-values dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.text-values dt { margin-top: .65rem; }
.action-block { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.outcome-fields { border: 1px solid var(--line); border-radius: .5rem; padding: .8rem; }
.outcome-fields legend { float: none; width: auto; margin: 0; padding-inline: .35rem; font-size: .95rem; font-weight: 750; }
.attachment { display: inline-grid; gap: .35rem; font-weight: 600; }
.attachment img { width: min(100%, 320px); max-height: 240px; object-fit: contain; object-position: left; border-radius: .4rem; border: 1px solid var(--line); }
.timeline, .notice-list, .directory-list { margin: 0; padding: 0; list-style: none; }
.timeline li { padding: .65rem 0 .65rem .9rem; border-left: 3px solid #b9d8cd; }
html[data-bs-theme="dark"] .timeline li,
:root[data-theme="dark"] .timeline li { border-left-color: #3a635c; }
.timeline p { margin: .3rem 0 0; }
.timeline .state, .notice-list .state { margin-left: .4rem; }
.notice-list li, .directory-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .85rem; }
.tabs a { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: .48rem; padding: .52rem .8rem; text-decoration: none; }
.tabs a:hover { border-color: var(--field-line); }
.tabs a[aria-current="page"] { background: var(--accent-tint); border-color: var(--field-line); color: var(--blue-dark); font-weight: 750; }
.secondary-tabs { margin-top: -.15rem; }
.knowledge-title, .knowledge-results li > div { min-width: 0; overflow-wrap: anywhere; }
.knowledge-results { margin: 0; padding: 0; list-style: none; }
.knowledge-results li { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--table-line); }
.knowledge-results h3 { margin: .15rem 0 .25rem; }
.knowledge-results p { margin: 0; color: var(--muted); }
.error-card { padding: 1.5rem; max-width: 630px; margin-inline: auto; }
.signed-in .error-card { margin-block-start: 1.2rem; }
.error-card p { margin: .8rem 0; }

.guest { display: grid; place-items: center; padding: min(4vw, 2rem); }
.guest .main-content { padding: 0; }
[hidden] { display: none !important; }

@media (max-width: 1040px) {
    .admin-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .signed-in { grid-template-columns: 198px minmax(0, 1fr); }
}
@media (min-width: 761px) {
    .sidebar {
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow-y: auto;
    }
}
@media (max-width: 760px) {
    .signed-in { display: block; }
    .sidebar { min-height: auto; gap: .65rem; padding: .7rem 1rem; border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .sidebar[data-mobile-menu-ready] {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
    .sidebar[data-mobile-menu-ready] > .side-nav { display: none; }
    .sidebar[data-mobile-menu-ready] + .main-content .account { display: none; }
    .mobile-menu-toggle { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
    .brand { display: flex; align-items: center; width: fit-content; max-width: 100%; text-align: left; overflow-wrap: anywhere; }
    .brand-logo { width: 2.75rem; height: 2.25rem; }
    .sidebar > .side-nav { display: flex; flex-wrap: wrap; gap: .25rem; align-items: flex-start; }
    .sidebar > .side-nav > .admin-nav { flex: 1; min-width: 0; }
    .mobile-menu :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary, .admin-nav-links a) { min-block-size: 2.75rem; }
    .account-profile { column-gap: .45rem; font-size: .9rem; }
    .account-profile .account-avatar { --account-avatar-size: 1.9rem; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .page-heading { align-items: flex-start; flex-direction: column; }
    .filter-bar { grid-template-columns: minmax(0, 1fr); }
    .two-fields, .key-values { grid-template-columns: minmax(0, 1fr); }
    .stat-card { min-height: 5.6rem; }
    .ticket-table { min-width: 0; }
    .ticket-table th, .ticket-table td { padding: .65rem .5rem; }
    .ticket-table th:first-child, .ticket-table td:first-child { padding-inline-start: .7rem; }
    .ticket-table th:nth-child(3), .ticket-table td:nth-child(3),
    .ticket-table th:nth-child(5), .ticket-table td:nth-child(5) { display: none; }
}

/* === Clivo Dark Sidebar Polish === */
.sidebar,
.mobile-menu {
    background: #182421;
    color: #eef5f2;
    border-inline-end-color: rgba(255, 255, 255, 0.08);
}
@media (max-width: 760px) {
    .sidebar {
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
}
.sidebar :is(a, button, summary):focus-visible,
.mobile-menu :is(a, button, summary):focus-visible {
    outline-color: #8be6d5;
}
.sidebar .brand,
.sidebar .sidebar-user,
.mobile-menu .sidebar-user {
    color: #eef5f2;
}
.sidebar .brand:hover {
    color: #ffffff;
}
.sidebar .brand small,
.sidebar .sidebar-user small,
.mobile-menu .sidebar-user small {
    color: #b7cac4;
}
.sidebar .brand-mark {
    background: #243d37;
    color: #8be6d5;
    border: 1px solid rgba(139, 230, 213, 0.28);
}
.sidebar :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary),
.mobile-menu :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary) {
    color: #d5e5e0;
    background: transparent;
}
.sidebar :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):hover,
.mobile-menu :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}
.sidebar :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is([aria-current="page"], .is-current, [aria-expanded="true"]),
.sidebar .admin-nav[open] > summary,
.mobile-menu :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is([aria-current="page"], .is-current, [aria-expanded="true"]),
.mobile-menu .admin-nav[open] > summary {
    background: rgba(129, 215, 201, 0.16);
    color: #ffffff;
}
.sidebar :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is([aria-current="page"], .is-current),
.mobile-menu :is(.side-nav > a, .notif-fallback, .notif-bell, .admin-nav > summary):is([aria-current="page"], .is-current) {
    box-shadow: inset 3px 0 #5fd3c0;
}
.sidebar .admin-nav-links,
.mobile-menu .admin-nav-links {
    background-color: #1f2f2b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
.sidebar .admin-nav-links a,
.mobile-menu .admin-nav-links a {
    color: #d5e5e0;
}
.sidebar .admin-nav-links svg,
.mobile-menu .admin-nav-links svg {
    color: #81d7c9;
}
.sidebar .admin-nav-links a:hover,
.mobile-menu .admin-nav-links a:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}
.sidebar .admin-nav-links a[aria-current="page"],
.mobile-menu .admin-nav-links a[aria-current="page"] {
    background: rgba(129, 215, 201, 0.16);
    color: #ffffff;
    box-shadow: inset 2px 0 #5fd3c0;
}
.sidebar .nav-count,
.sidebar .notif-badge,
.mobile-menu .nav-count,
.mobile-menu .notif-badge {
    background: #1f5349;
    color: #d8faf2;
    border: 1px solid rgba(129, 215, 201, 0.35);
}
.sidebar .sidebar-controls .btn,
.mobile-menu .mobile-menu-header .btn {
    --bs-btn-color: #eef5f2;
    --bs-btn-bg: rgba(255, 255, 255, 0.06);
    --bs-btn-border-color: rgba(255, 255, 255, 0.24);
    --bs-btn-hover-color: #10201c;
    --bs-btn-hover-bg: #81d7c9;
    --bs-btn-hover-border-color: #81d7c9;
    --bs-btn-active-color: #10201c;
    --bs-btn-active-bg: #a5e7db;
    --bs-btn-active-border-color: #a5e7db;
}
.sidebar .sidebar-controls .theme-toggle[aria-pressed="true"]:not(:hover) {
    background: rgba(129, 215, 201, 0.18);
    border-color: rgba(129, 215, 201, 0.45);
    color: #eef5f2;
}
.mobile-menu-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: #eef5f2;
}
.mobile-menu > .account {
    border-block-start-color: rgba(255, 255, 255, 0.08);
}
.mobile-menu .account-profile {
    background: #1f2f2b;
    border-color: rgba(255, 255, 255, 0.14);
    color: #eef5f2;
}
.mobile-menu .account-profile:hover,
.mobile-menu .account-dropdown[open] > .account-profile {
    border-color: rgba(129, 215, 201, 0.45);
}
.mobile-menu .account-identity span {
    color: #b7cac4;
}
.mobile-menu .account-chevron {
    color: #81d7c9;
}
.mobile-menu .account-avatar {
    background: #243d37;
    color: #8be6d5;
}
.mobile-menu .account-dropdown-panel {
    background: #1f2f2b;
    border-color: rgba(255, 255, 255, 0.12);
}
.mobile-menu .account-dropdown-panel form {
    border-block-start-color: rgba(255, 255, 255, 0.1);
}
.mobile-menu .account-option {
    color: #eef5f2;
}
.mobile-menu .account-option:is(:hover, [aria-current="page"]) {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}
.mobile-menu .account-option.sign-out {
    color: #ffb7aa;
}

/* === AI Case Generation Job UI === */
.ai-job-subtitle {
    margin: -.15rem 0 .85rem;
    font-size: .92rem;
}

.ai-job-status-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: .85rem;
}

.ai-job-live-note {
    font-size: .85rem;
    font-weight: 500;
    color: var(--status-working-ink);
    background: color-mix(in srgb, var(--status-working-ink) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-working-ink) 26%, transparent);
    border-radius: 999px;
    padding: .2rem .7rem;
}

.ai-job-summary {
    background: var(--accent-tint);
    border: 1px solid var(--line);
    border-radius: .65rem;
    padding: .75rem .95rem;
    margin-bottom: 1rem;
    font-size: .95rem;
    color: var(--ink);
}

.ai-job-progress-grid {
    margin-bottom: 1rem;
}

.ai-job-provider-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.ai-job-model-tag {
    display: inline-block;
    margin-inline-start: .35rem;
    font-size: .78rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--table-heading);
    border-radius: .35rem;
    padding: .05rem .4rem;
}

.ai-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.2;
    padding: .28rem .7rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.ai-progress-pill--pending {
    color: var(--muted);
    background: var(--table-heading);
    border-color: var(--line);
}

.ai-progress-pill--running {
    color: var(--status-working-ink);
    background: #e1f2fb;
    border-color: #9ecce6;
}

.ai-progress-pill--ok {
    color: var(--status-complete-ink);
    background: #dff3ea;
    border-color: #99d4bb;
}

.ai-progress-pill--failed {
    color: var(--status-cancelled-ink);
    background: #fce7e4;
    border-color: #e8aba2;
}

.ai-progress-pill--skipped {
    color: var(--status-pending-ink);
    background: var(--gold-tint);
    border-color: #e2c57c;
}

.ai-job-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.ai-job-candidate-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: .85rem;
}

.ai-job-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.ai-risk-badge {
    display: inline-flex;
    align-items: center;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.2;
    padding: .24rem .65rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.ai-risk-badge--high {
    color: #9b2c24;
    background: #fde8e6;
    border-color: #eaaba5;
}

.ai-risk-badge--medium {
    color: #7c5210;
    background: #fdf0d0;
    border-color: #e6c474;
}

.ai-risk-badge--low {
    color: #186449;
    background: #dff3ea;
    border-color: #96d1b6;
}

.ai-job-error-pill {
    display: inline-flex;
    align-items: center;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--table-heading);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .24rem .65rem;
}

.ai-job-candidate-fields {
    margin-bottom: .85rem;
}

.ai-job-precautions {
    background: #fef5e1;
    border: 1px solid #e6c474;
    border-inline-start: 4px solid #c98a1c;
    border-radius: .6rem;
    padding: .75rem .95rem;
    margin-bottom: .85rem;
    color: #5e3e0d;
}

.ai-job-precautions strong {
    display: block;
    margin-bottom: .2rem;
}

.ai-job-missing-info {
    margin-bottom: .85rem;
}

.ai-job-evidence {
    margin-bottom: .9rem;
}

.ai-job-evidence-heading {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--ink);
}

.ai-job-evidence-list {
    padding-inline-start: 1.2rem;
}

.ai-job-evidence-list li + li {
    margin-top: .25rem;
}

.ai-job-candidate-actions {
    margin-top: 1rem;
}

html[data-bs-theme="dark"] .ai-progress-pill--running,
:root[data-theme="dark"] .ai-progress-pill--running {
    color: #a9def5;
    background: #183644;
    border-color: #2f657d;
}

html[data-bs-theme="dark"] .ai-progress-pill--ok,
:root[data-theme="dark"] .ai-progress-pill--ok {
    color: #9cdec0;
    background: #173a2f;
    border-color: #2d6f5a;
}

html[data-bs-theme="dark"] .ai-progress-pill--failed,
:root[data-theme="dark"] .ai-progress-pill--failed {
    color: #ffb7aa;
    background: #421f1c;
    border-color: #7d3c35;
}

html[data-bs-theme="dark"] .ai-progress-pill--skipped,
:root[data-theme="dark"] .ai-progress-pill--skipped {
    color: #f5cd84;
    background: #423217;
    border-color: #7a5c28;
}

html[data-bs-theme="dark"] .ai-risk-badge--high,
:root[data-theme="dark"] .ai-risk-badge--high {
    color: #ffb7aa;
    background: #421f1c;
    border-color: #7d3c35;
}

html[data-bs-theme="dark"] .ai-risk-badge--medium,
:root[data-theme="dark"] .ai-risk-badge--medium {
    color: #f5cd84;
    background: #423217;
    border-color: #7a5c28;
}

html[data-bs-theme="dark"] .ai-risk-badge--low,
:root[data-theme="dark"] .ai-risk-badge--low {
    color: #9cdec0;
    background: #173a2f;
    border-color: #2d6f5a;
}

html[data-bs-theme="dark"] .ai-job-precautions,
:root[data-theme="dark"] .ai-job-precautions {
    background: #332713;
    border-color: #6f5425;
    border-inline-start-color: #e2b14c;
    color: #f6dfb0;
}

/* === SLA Badges, Alerts & Summary === */
.sla-badge {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .28rem;
    width: fit-content;
    max-width: 100%;
    padding: .2rem .58rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.sla-overdue {
    color: #9b2620;
    background: #fde8e6;
    border-color: #eaaba5;
}

.sla-near {
    color: #7a4d0e;
    background: #fef3d1;
    border-color: #e5c16c;
}

.sla-paused {
    color: #1c526e;
    background: #e0f1fa;
    border-color: #9cc8e0;
}

.sla-met {
    color: #165c42;
    background: #dcf2e7;
    border-color: #92cfb3;
}

.sla-on-track {
    color: #165c52;
    background: #e0f3ef;
    border-color: #94cfc4;
}

.sla-muted {
    color: #4a6065;
    background: #e9f0ee;
    border-color: #c8d8d4;
}

.sla-detail {
    display: block;
    margin-top: .15rem;
    font-size: .78rem;
    font-weight: 500;
    color: var(--muted);
}

.sla-badge .sla-detail {
    display: inline;
    margin-top: 0;
    font-size: .92em;
    font-weight: 600;
    color: inherit;
}

.sla-cell-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
}

.sla-meta-value {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
}

.sla-alert-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem 1rem;
    margin: 0 0 1rem;
    padding: .65rem 1rem;
    border: 1px solid #e7cc8a;
    border-inline-start: 4px solid #c98a1c;
    border-radius: .75rem;
    background: #fff7e2;
    color: #5e3e0d;
    font-size: .93rem;
    font-weight: 600;
}

.sla-alert-bar--overdue {
    border-color: #ebc6bf;
    border-inline-start-color: #9b3930;
    background: #fdf1ee;
    color: #7c241d;
}

.sla-alert-bar__text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.sla-alert-bar__action {
    flex-shrink: 0;
    font-weight: 650;
}

.tone-sla-breached strong {
    color: var(--status-cancelled-ink);
}

.tabs a.tab-sla-overdue[aria-current="page"] {
    background: #fde8e6;
    border-color: #eaaba5;
    color: #9b2620;
}

html[data-bs-theme="dark"] .sla-overdue,
:root[data-theme="dark"] .sla-overdue {
    color: #ffb7aa;
    background: #421f1c;
    border-color: #7d3c35;
}

html[data-bs-theme="dark"] .sla-near,
:root[data-theme="dark"] .sla-near {
    color: #f5cd84;
    background: #423217;
    border-color: #7a5c28;
}

html[data-bs-theme="dark"] .sla-paused,
:root[data-theme="dark"] .sla-paused {
    color: #a9def5;
    background: #183644;
    border-color: #2f657d;
}

html[data-bs-theme="dark"] .sla-met,
:root[data-theme="dark"] .sla-met {
    color: #9cdec0;
    background: #173a2f;
    border-color: #2d6f5a;
}

html[data-bs-theme="dark"] .sla-on-track,
:root[data-theme="dark"] .sla-on-track {
    color: #8be6d5;
    background: #183a36;
    border-color: #2f6e66;
}

html[data-bs-theme="dark"] .sla-muted,
:root[data-theme="dark"] .sla-muted {
    color: #c4d6d2;
    background: #24373a;
    border-color: #3f585b;
}

html[data-bs-theme="dark"] .sla-alert-bar,
:root[data-theme="dark"] .sla-alert-bar {
    background: #332713;
    border-color: #6f5425;
    border-inline-start-color: #e2b14c;
    color: #f6dfb0;
}

html[data-bs-theme="dark"] .sla-alert-bar--overdue,
:root[data-theme="dark"] .sla-alert-bar--overdue {
    background: #3d2120;
    border-color: #794743;
    border-inline-start-color: #e8877c;
    color: #ffd6ce;
}

html[data-bs-theme="dark"] .tabs a.tab-sla-overdue[aria-current="page"],
:root[data-theme="dark"] .tabs a.tab-sla-overdue[aria-current="page"] {
    background: #421f1c;
    border-color: #7d3c35;
    color: #ffb7aa;
}
