/*
 * Visual skin layered on top of Bootstrap 5.3 (loaded before this file in both
 * layouts). Bootstrap 5.3 exposes most component colors as CSS custom
 * properties, so a handful of token overrides here retint cards/badges/alerts/
 * links/focus-rings app-wide without touching the ~40 view files that already
 * use plain Bootstrap classes. Only components that bake literal hex instead of
 * referencing a var (.btn-*, form focus rings) get an explicit override below.
 */

:root {
    /* ---- App tokens ---- */
    --app-ink-900: #10161c;
    --app-ink-700: #3a4550;
    --app-ink-500: #6b7680;
    --app-accent: #0e7c86;
    --app-accent-rgb: 14, 124, 134;
    --app-accent-600: #0b6870;
    --app-accent-050: #e6f3f4;
    --app-surface-0: #ffffff;
    --app-surface-50: #f4f6f6;
    --app-surface-100: #eaeeed;
    --app-border: #dde3e2;
    --app-shadow-card: 0 1px 2px rgba(16, 22, 28, .04), 0 4px 10px rgba(16, 22, 28, .05);
    --app-radius: 10px;
    --app-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --app-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;

    /* ---- Bootstrap bridge: components below already read these via var() ---- */
    --bs-body-font-family: var(--app-font-ui);
    /* Bootstrap's default (1rem/16px) reads oversized next to this app's tightly
       scaled chrome (12-13.5px labels/captions/nav already in place below) —
       every element that reads its font-size from this var (body text, table
       cells, alerts, dropdowns, badges via em, modals) shrinks to match in one
       place instead of needing a per-component override. */
    --bs-body-font-size: 13.5px;
    --bs-body-bg: var(--app-surface-50);
    --bs-body-color: var(--app-ink-900);
    --bs-border-color: var(--app-border);
    --bs-border-color-translucent: var(--app-border);
    --bs-border-radius: 8px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: var(--app-radius);
    --bs-link-color-rgb: var(--app-accent-rgb);
    --bs-link-hover-color-rgb: var(--app-accent-rgb);
    --bs-emphasis-color-rgb: 16, 22, 28;

    --bs-primary: var(--app-accent);
    --bs-primary-rgb: var(--app-accent-rgb);
    --bs-primary-text-emphasis: #06474d;
    --bs-primary-bg-subtle: var(--app-accent-050);
    --bs-primary-border-subtle: #bfe0e2;

    --bs-secondary: #5b6672;
    --bs-secondary-rgb: 91, 102, 114;
    --bs-secondary-text-emphasis: #3a4550;
    --bs-secondary-bg-subtle: #eceeef;
    --bs-secondary-border-subtle: #d7dbde;

    --bs-success: #1f8a5f;
    --bs-success-rgb: 31, 138, 95;
    --bs-success-text-emphasis: #145c3f;
    --bs-success-bg-subtle: #e7f5ee;
    --bs-success-border-subtle: #bfe3d1;

    --bs-warning: #b8791a;
    --bs-warning-rgb: 184, 121, 26;
    --bs-warning-text-emphasis: #7a5011;
    --bs-warning-bg-subtle: #fbf1e2;
    --bs-warning-border-subtle: #efd6a6;

    --bs-danger: #c0392b;
    --bs-danger-rgb: 192, 57, 43;
    --bs-danger-text-emphasis: #7f251c;
    --bs-danger-bg-subtle: #fbeae8;
    --bs-danger-border-subtle: #f0c1bb;

    --bs-info: #4a6fa5;
    --bs-info-rgb: 74, 111, 165;
    --bs-info-text-emphasis: #33507d;
    --bs-info-bg-subtle: #eaf0f8;
    --bs-info-border-subtle: #c3d3e9;
}

/* ---- Base ---- */
body {
    font-family: var(--app-font-ui);
    color: var(--app-ink-900);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 650;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

/* ---- Buttons (Bootstrap bakes literal hex per-variant, so these need explicit overrides) ---- */
.btn {
    font-weight: 600;
    font-size: 13.5px;
    border-radius: var(--bs-border-radius);
}

/* .accordion-active-color/-bg already read the app's retinted --bs-primary-*
   tokens, so the expanded state is on-brand for free — only the literal
   font-size (Bootstrap bakes 1rem here, not a var) needs the same override
   every other component in this file needed. */
.accordion-button {
    font-size: 13.5px;
    font-weight: 650;
}

.btn-primary {
    --bs-btn-bg: var(--app-accent);
    --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-bg: var(--app-accent-600);
    --bs-btn-hover-border-color: var(--app-accent-600);
    --bs-btn-active-bg: var(--app-accent-600);
    --bs-btn-active-border-color: var(--app-accent-600);
    --bs-btn-focus-shadow-rgb: var(--app-accent-rgb);
    --bs-btn-disabled-bg: var(--app-accent);
    --bs-btn-disabled-border-color: var(--app-accent);
}

.btn-success {
    --bs-btn-bg: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
    --bs-btn-hover-bg: #186f4c;
    --bs-btn-hover-border-color: #186f4c;
    --bs-btn-active-bg: #186f4c;
    --bs-btn-active-border-color: #186f4c;
    --bs-btn-focus-shadow-rgb: var(--bs-success-rgb);
    --bs-btn-disabled-bg: var(--bs-success);
    --bs-btn-disabled-border-color: var(--bs-success);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-accent);
    --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-bg: var(--app-accent);
    --bs-btn-hover-border-color: var(--app-accent);
    --bs-btn-active-bg: var(--app-accent);
    --bs-btn-active-border-color: var(--app-accent);
    --bs-btn-focus-shadow-rgb: var(--app-accent-rgb);
    --bs-btn-disabled-color: var(--app-accent);
    --bs-btn-disabled-border-color: var(--app-accent);
}

.btn-outline-secondary {
    --bs-btn-color: var(--app-ink-700);
    --bs-btn-border-color: var(--app-border);
    --bs-btn-hover-bg: var(--app-ink-700);
    --bs-btn-hover-border-color: var(--app-ink-700);
    --bs-btn-active-bg: var(--app-ink-700);
    --bs-btn-active-border-color: var(--app-ink-700);
}

.btn-outline-danger {
    --bs-btn-color: var(--bs-danger);
    --bs-btn-border-color: var(--bs-danger);
    --bs-btn-hover-bg: var(--bs-danger);
    --bs-btn-hover-border-color: var(--bs-danger);
    --bs-btn-active-bg: var(--bs-danger);
    --bs-btn-active-border-color: var(--bs-danger);
    --bs-btn-focus-shadow-rgb: var(--bs-danger-rgb);
}

.btn-outline-warning {
    --bs-btn-color: var(--bs-warning);
    --bs-btn-border-color: var(--bs-warning);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-warning);
    --bs-btn-hover-border-color: var(--bs-warning);
}

/* Bootstrap's .btn-link renders as a bare underlined hyperlink — every
   "Cancel" next to a primary Save button app-wide gets a proper ghost-button
   treatment instead: no underline, muted text, a soft hover fill. */
.btn-link {
    --bs-btn-color: var(--app-ink-500);
    --bs-btn-hover-color: var(--app-ink-900);
    --bs-btn-hover-bg: var(--app-surface-100);
    --bs-btn-active-color: var(--app-ink-900);
    --bs-btn-active-bg: var(--app-surface-100);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--bs-border-radius);
}

.btn-link:hover,
.btn-link:focus {
    text-decoration: none;
}

/* ---- Forms ----
   Bootstrap's .form-control/.form-select render as a thin-outline, white-on-white
   field with a barely-visible focus ring — every field on every admin/ITSM form
   gets a filled, more tactile treatment here instead, plus a stronger focus ring
   (both baked as literal hex/rgba in Bootstrap, so both need an explicit override
   rather than a root-token bridge). */
.form-control,
.form-select,
textarea.form-control {
    background-color: var(--app-surface-50);
    border: 1.5px solid var(--app-border);
    border-radius: var(--bs-border-radius);
    padding: .55rem .8rem;
    font-size: 13.5px;
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}

/* Bootstrap reserves 2.25rem on the right of every .form-select for its
   chevron background-image (fixed at .75rem from the edge) — the shared
   padding override above collapses all four sides to .8rem, which was
   letting long option text run underneath/through that icon. Restored here,
   not above, since .form-control has no icon and shouldn't get the same gap. */
.form-select {
    padding-right: 2.25rem;
}

.form-control:hover,
.form-select:hover {
    border-color: #c7d0cf;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--app-surface-0);
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3.5px rgba(var(--app-accent-rgb), .13);
}

.form-control[readonly] {
    background-color: var(--app-surface-100);
    color: var(--app-ink-500);
}

/* The padding override above applies to every .form-control/.form-select
   regardless of the Bootstrap -sm modifier, making them taller than a
   same-row .btn-sm (which keeps Bootstrap's own, smaller padding) — matched
   here for the one row that mixes both (issue attachment upload). */
#attachment-form .btn {
    padding-top: .55rem;
    padding-bottom: .55rem;
}

/* ---- Quill WYSIWYG fields (problem description, comment body) — the toolbar
   and editable area are two separate Quill-rendered elements; merged here into
   one bordered box so it reads as a single form-control, not two. ---- */
.quill-editor {
    background-color: var(--app-surface-50);
    border: 1.5px solid var(--app-border);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.quill-editor:focus-within {
    background-color: var(--app-surface-0);
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3.5px rgba(var(--app-accent-rgb), .13);
}

.quill-editor .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1.5px solid var(--app-border);
    background-color: var(--app-surface-100);
}

.quill-editor .ql-container.ql-snow {
    border: none;
    font-size: 13.5px;
}

.quill-editor .ql-editor {
    min-height: 140px;
}

.quill-editor-sm .ql-editor {
    min-height: 64px;
    font-size: 13px;
}

.rich-text-content :last-child {
    margin-bottom: 0;
}

.rich-text-content ul,
.rich-text-content ol {
    padding-left: 1.25rem;
}

/* ---- Attachment thumbnails (issue detail) — a small square crop in the list,
   click opens the shared #attachment-preview-modal at full size. The whole
   row is one link (attachment-row-link), so it needs link-reset treatment. ---- */
.attachment-row-link {
    color: inherit;
    text-decoration: none;
}

.attachment-row-link:hover .attachment-filename {
    text-decoration: underline;
}

.attachment-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--app-border);
    flex: none;
}

.attachment-file-icon {
    width: 36px;
    text-align: center;
    color: var(--app-ink-500);
    font-size: 18px;
    flex: none;
}

#attachment-preview-body img {
    max-height: 70vh;
    max-width: 100%;
}

.attachment-preview-frame {
    width: 100%;
    height: 70vh;
    border: none;
}

#attachment-preview-body video {
    max-height: 70vh;
}

/* ---- Comment thread (issue detail) — chat-style: the issue's own reporter
   aligns left, everyone else (resolver/management/admin/team) aligns right,
   each with a role-colored badge + matching bubble tint so who's talking is
   obvious at a glance without reading the name every time. ---- */
#comment-list {
    display: flex;
    flex-direction: column;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.comment-row {
    display: flex;
}

.comment-row-left {
    justify-content: flex-start;
}

.comment-row-right {
    justify-content: flex-end;
}

.comment-bubble {
    max-width: 78%;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.comment-bubble-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 3px;
}

.comment-bubble-head strong {
    font-weight: 650;
}

.comment-bubble-meta {
    margin-top: 5px;
    font-size: 11px;
    opacity: .75;
}

/* A soft tinted tag (colored text on a barely-there background), not a loud
   solid-fill badge — reads as a quiet label next to the name instead of
   competing with it. Same treatment for the "Internal" tag, so every label
   in the comment head belongs to one consistent, understated system. */
.comment-role-pill,
.comment-internal-tag {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    padding: 1px 8px;
    border-radius: 20px;
    line-height: 1.6;
}

.comment-internal-tag {
    background: var(--app-surface-100);
    color: var(--app-ink-500);
}

/* Role-colored bubble tint + matching soft tag — same rgb triplets Bootstrap's
   own text-bg-success/primary/warning/dark/secondary badges use, kept in sync
   here since the bubble/tag aren't Bootstrap badge components. */
.comment-role-reporter { background: rgba(25, 135, 84, .07); border-color: rgba(25, 135, 84, .16); }
.comment-role-reporter.comment-role-pill { background: rgba(25, 135, 84, .13); color: rgb(15, 95, 58); }

.comment-role-resolver { background: rgba(13, 110, 253, .06); border-color: rgba(13, 110, 253, .16); }
.comment-role-resolver.comment-role-pill { background: rgba(13, 110, 253, .13); color: rgb(9, 82, 193); }

.comment-role-management { background: rgba(202, 138, 4, .08); border-color: rgba(202, 138, 4, .2); }
.comment-role-management.comment-role-pill { background: rgba(202, 138, 4, .16); color: rgb(133, 90, 3); }

.comment-role-admin { background: rgba(33, 37, 41, .05); border-color: rgba(33, 37, 41, .14); }
.comment-role-admin.comment-role-pill { background: rgba(33, 37, 41, .1); color: rgb(33, 37, 41); }

.comment-role-team { background: var(--app-surface-100); border-color: var(--app-border); }
.comment-role-team.comment-role-pill { background: var(--app-surface-100); color: var(--app-ink-500); }

/* ---- A file attached to a comment (comment_id on issue_attachments) — a
   small chip inside the bubble, not the full-size row the Attachments card
   uses. Clicking it opens the same shared #attachment-preview-modal. ---- */
.comment-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 6px 4px 0 0;
    padding: 4px 10px 4px 4px;
    border-radius: 20px;
    background: var(--app-surface-0);
    border: 1px solid var(--app-border);
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    max-width: 100%;
}

.comment-attachment-chip:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.comment-attachment-thumb {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 50%;
}

.comment-attachment-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Attach-file control on the comment form — a quiet text-link-style button,
   not a full .btn, so it doesn't compete with Post Comment for attention. */
.comment-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--app-ink-500);
    cursor: pointer;
    margin: 0;
}

.comment-attach-btn:hover {
    color: var(--app-accent);
}

/* ---- Action Log (issue detail) — a vertical timeline of every recorded
   status transition (issue_status_history), newest first, dot-and-line style. ---- */
.action-log {
    position: relative;
    padding-left: 16px;
    max-height: 360px;
    overflow-y: auto;
}

.action-log-entry {
    position: relative;
    padding-bottom: 16px;
}

.action-log-entry:last-child {
    padding-bottom: 0;
}

.action-log-entry::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--app-accent);
}

.action-log-entry::after {
    content: '';
    position: absolute;
    left: -13px;
    top: 12px;
    bottom: 0;
    width: 1px;
    background: var(--app-border);
}

.action-log-entry:last-child::after {
    display: none;
}

.action-log-label {
    font-weight: 620;
    font-size: 13px;
}

.action-log-meta {
    margin-top: 1px;
}

.action-log-comment {
    margin-top: 5px;
    padding: 6px 10px;
    background: var(--app-surface-100);
    border-radius: 6px;
    color: var(--app-ink-700);
}

.input-group-text {
    background-color: var(--app-surface-100);
    border: 1.5px solid var(--app-border);
    font-weight: 600;
    font-size: 13.5px;
    color: var(--app-ink-700);
}

.form-label {
    font-weight: 650;
    font-size: .8rem;
    letter-spacing: .01em;
    color: var(--app-ink-700);
    margin-bottom: .4rem;
}

.form-label .text-muted {
    font-weight: 500;
}

.form-text {
    font-size: .74rem;
}

/* ---- Forms: a shared shape for every create/edit screen (admin/*, problems/
   changes/releases). .form-card bounds the width and hosts an optional
   .form-panel-header (icon + title + description, replacing a floating <h1>
   above the card); .form-section groups related fields into a tinted box
   instead of a bare divider line — used on forms with more than one logical
   group. Forms with only 2-4 flat fields don't need sections. ---- */
.form-card {
    max-width: 660px;
}

.form-panel-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--app-border);
    margin: -1px -1px 0;
}

.form-panel-header .icon {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 10px;
    background: linear-gradient(155deg, var(--app-accent), var(--app-accent-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.form-panel-header .heading {
    min-width: 0;
    flex: 1 1 auto;
}

.form-panel-header .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.form-panel-header .back-link {
    display: block;
    font-size: 12px;
    color: var(--app-ink-500);
    text-decoration: none;
    margin-bottom: 2px;
}

.form-panel-header .back-link:hover {
    color: var(--app-accent);
}

.form-panel-header h1 {
    font-size: 16.5px;
    font-weight: 650;
    margin: 0;
    letter-spacing: -0.01em;
}

.form-panel-header p {
    font-size: 12.5px;
    color: var(--app-ink-500);
    margin: 1px 0 0;
}

/* ---- Login brand — the wide Sumadhura wordmark doesn't fit the small square
   icon slot every other .form-panel-header uses, so the login page stacks it
   centered above the heading instead of the usual icon+heading row. ---- */
.login-brand {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.login-brand .login-logo {
    height: 46px;
    width: auto;
    margin-bottom: 6px;
}

.login-brand .heading {
    flex: none;
}

.form-card > .card-body {
    padding: 24px;
}

/* ---- OTP entry — one box per digit instead of a single free-text field,
   so the code's length is visually obvious and it reads at a glance. ---- */
.otp-box-group {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.otp-box {
    width: 52px;
    height: 56px;
    padding: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0;
}

.form-section {
    background: var(--app-surface-50);
    border: 1px solid var(--app-border);
    border-radius: calc(var(--bs-border-radius) + 2px);
    padding: 18px 20px;
}

.form-section + .form-section {
    margin-top: 16px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--app-accent-600);
    margin-bottom: 3px;
}

.form-section-title::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--app-accent);
    flex: none;
}

.form-section-desc {
    font-size: 12.5px;
    color: var(--app-ink-500);
    margin-bottom: 14px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 24px -24px -24px;
    padding: 16px 24px;
    background: var(--app-surface-50);
    border-top: 1px solid var(--app-border);
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}

/* ---- Unit-suffixed number fields (e.g. SLA/escalation minutes) ---- */
.input-suffix {
    position: relative;
}

.input-suffix .form-control {
    padding-right: 4.6rem;
}

.input-suffix .unit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11.5px;
    font-weight: 650;
    color: var(--app-ink-500);
    background: var(--app-surface-100);
    padding: 2px 7px;
    border-radius: 5px;
    pointer-events: none;
}

/* ---- Switch — replaces a bare .form-check for a single on/off setting
   (e.g. "Required", "Terminal", "Active") on the admin/ITSM forms. ---- */
.form-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

.form-switch-row + .form-switch-row {
    border-top: 1px solid var(--app-border);
    padding-top: 12px;
    margin-top: 8px;
}

.form-switch-row .label-main {
    font-size: .8rem;
    font-weight: 650;
    color: var(--app-ink-900);
}

.form-switch-row .label-sub {
    font-size: 12px;
    color: var(--app-ink-500);
    margin-top: 1px;
}

.switch {
    position: relative;
    width: 38px;
    height: 22px;
    flex: none;
}

.switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.switch .track {
    position: absolute;
    inset: 0;
    background: #cad1d0;
    border-radius: 20px;
    transition: background .15s ease;
}

.switch .thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}

.switch input:checked ~ .track {
    background: var(--app-accent);
}

.switch input:checked ~ .thumb {
    transform: translateX(16px);
}

.switch input:focus-visible ~ .track {
    box-shadow: 0 0 0 3px rgba(var(--app-accent-rgb), .25);
}

/* ---- Cards & tables ---- */
.card {
    --bs-card-border-radius: var(--app-radius);
    --bs-card-box-shadow: var(--app-shadow-card);
    box-shadow: var(--bs-card-box-shadow);
}

.card-header {
    font-weight: 650;
    background-color: var(--app-surface-0);
    border-bottom-color: var(--app-border);
}

/* ---- List panel — every admin/ITSM index screen (masters, mappings, roles,
   users, KB, problems/changes/releases, audit log, issues list, reports) wraps
   its table in this instead of leaving it bare on the page background. Same
   card look as .form-card, just with a header row for the title + primary
   action instead of a form-panel-header. ---- */
.list-panel {
    background: var(--app-surface-0);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-card);
    overflow: hidden;
}

.list-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--app-border);
}

.list-panel-head .heading {
    min-width: 0;
}

.list-panel-head .back-link {
    display: block;
    font-size: 12px;
    color: var(--app-ink-500);
    text-decoration: none;
    margin-bottom: 2px;
}

.list-panel-head .back-link:hover {
    color: var(--app-accent);
}

.list-panel-head h1 {
    font-size: 16px;
    font-weight: 650;
    margin: 0;
    letter-spacing: -0.01em;
}

.list-panel-head p {
    font-size: 12.5px;
    color: var(--app-ink-500);
    margin: 1px 0 0;
}

.list-panel-head .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.issues-view-tabs {
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface-50, var(--app-surface-0));
    margin: 0;
}

.issues-view-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 10px 4px;
    margin: 0 16px 0 0;
    font-size: 13px;
    font-weight: 550;
    color: var(--app-ink-500);
}

.issues-view-tabs .nav-link:hover {
    color: var(--app-ink-900, var(--app-ink-500));
    border-bottom-color: var(--app-border);
}

.issues-view-tabs .nav-link.active {
    color: var(--app-accent);
    background: transparent;
    border-bottom-color: var(--app-accent);
}

.issues-filter-row,
.list-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface-50, var(--app-surface-0));
}

.issues-filter-row .filter-field,
.list-filter-row .filter-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.issues-filter-row .form-select,
.issues-filter-row .btn,
.list-filter-row .form-select,
.list-filter-row .btn {
    padding-top: .375rem;
    padding-bottom: .375rem;
}

.issues-filter-row .form-select,
.list-filter-row .form-select {
    min-width: 160px;
}

.list-panel-body {
    padding: 16px 20px 20px;
}

.list-panel-body table {
    margin-bottom: 0;
}

.list-panel-body > .table-responsive:only-child,
.list-panel-body > table:only-child {
    margin: 0;
}

/* All Issues title column (assets/js/issue-list.js) — clipped to one line so a
   long title can't blow out the row height or push other columns around; the
   full text (plus a description preview) is available via the Bootstrap
   tooltip attached to this same element. */
.issue-title-clip {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    cursor: help;
}

/* Bootstrap's default tooltip is a narrow (200px), centered, plain-dark chip —
   fine for a two-word hint, cramped and hard to read for a title + description
   preview. Restyled as a light card (matching this app's dropdowns/cards)
   instead of overriding .tooltip globally, so any future plain-hint tooltip
   elsewhere keeps Bootstrap's default look. */
.tooltip.issue-title-tooltip {
    --bs-tooltip-max-width: 320px;
    --bs-tooltip-bg: var(--app-surface-0);
    --bs-tooltip-color: var(--app-ink-900);
    --bs-tooltip-border-radius: 10px;
    --bs-tooltip-padding-x: 14px;
    --bs-tooltip-padding-y: 10px;
    --bs-tooltip-opacity: 1;
}

.tooltip.issue-title-tooltip .tooltip-inner {
    text-align: left;
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-card);
    line-height: 1.45;
}

.tooltip.issue-title-tooltip .tooltip-issue-title {
    font-weight: 650;
    color: var(--app-ink-900);
    margin-bottom: 4px;
}

.tooltip.issue-title-tooltip .tooltip-issue-desc {
    color: var(--app-ink-500);
    font-weight: 400;
}

/* A .list-panel with no header row (a few small nested/inline lists) still
   wants the table inset from the card edge. */
.list-panel > .table-responsive,
.list-panel > table {
    margin: 16px 20px 20px;
    width: auto;
}

/* ---- Filter bar — a tinted toolbar for report/list filter forms that need
   more room than fits inline in a .list-panel-head (issue register's 6 fields,
   vs. a header-inline form for 2-3). Selects/date inputs shrink to their
   content instead of stretching full-width like a normal form field. ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--app-surface-50);
    border: 1px solid var(--app-border);
    border-radius: var(--bs-border-radius);
    margin-bottom: 16px;
}

.filter-bar .form-select,
.filter-bar .form-control {
    width: auto;
    background-color: var(--app-surface-0);
}

/* Filter/Clear kept together as one flex item so they wrap onto a new line
   as a pair instead of Clear orphaning below Filter when the bar runs out
   of room; pushed to the bar's right edge on wide viewports. */
.filter-bar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: none;
    white-space: nowrap;
}

.table {
    --bs-table-border-color: var(--app-border);
}

/* ---- DataTables' generated chrome (search/length/info/pagination) — the
   inputs/pagination already inherit the retinted Bootstrap tokens above; this
   just gives the row some breathing room and quiets the caption text down. ---- */
.dataTables_wrapper > .row:first-child {
    margin-bottom: 14px;
}

.dataTables_wrapper > .row:last-child {
    margin-top: 14px;
    align-items: center;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 220px;
    margin-left: .5rem;
}

.dataTables_wrapper .dataTables_length select {
    min-width: 68px;
}

.dataTables_wrapper .dataTables_info {
    font-size: 12.5px;
    color: var(--app-ink-500);
    padding-top: 0;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    font-size: 13px;
}

table.dataTable > thead > tr > th.sorting:before,
table.dataTable > thead > tr > th.sorting:after,
table.dataTable > thead > tr > th.sorting_asc:before,
table.dataTable > thead > tr > th.sorting_asc:after,
table.dataTable > thead > tr > th.sorting_desc:before,
table.dataTable > thead > tr > th.sorting_desc:after {
    opacity: .35;
}

.table > thead {
    font-size: .75rem;
    font-weight: 650;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--app-ink-500);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--app-surface-50);
}

/* ---- Page header — same icon+title+description language as .form-panel-header,
   for pages whose content isn't a single bounded card (dashboards, the issue
   detail titlebar, a sub-page's top section above its own list-panel/cards).
   Unlike .form-panel-header this isn't nested in a card, so no border/margin
   trick; an optional .actions slot on the right holds page-level buttons. ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.page-header .icon {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 10px;
    background: linear-gradient(155deg, var(--app-accent), var(--app-accent-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.page-header .heading {
    min-width: 0;
    flex: 1 1 auto;
}

.page-header .back-link {
    display: block;
    font-size: 12px;
    color: var(--app-ink-500);
    text-decoration: none;
    margin-bottom: 2px;
}

.page-header .back-link:hover {
    color: var(--app-accent);
}

.page-header h1 {
    font-size: 18px;
    font-weight: 650;
    margin: 0;
    letter-spacing: -0.01em;
}

.page-header p {
    font-size: 12.5px;
    color: var(--app-ink-500);
    margin: 1px 0 0;
}

.page-header .actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    padding-top: 4px;
}

/* ---- KPI tiles — dashboard stat cards (open count, breach count, etc.).
   Eyebrow label up top, a large tabular-nums number below, and a circular
   icon badge floated top-right — the Stripe/Linear "stat card" convention —
   instead of a horizontal icon+number row, which reads more like a generic
   admin-template widget than a real product dashboard. A left accent bar +
   hover lift carry over the severity cue (teal vs. danger) at a glance. ---- */
.kpi-card {
    position: relative;
    padding: 18px 20px 20px;
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}

.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--app-accent);
}

.kpi-card:hover {
    box-shadow: 0 2px 6px rgba(16, 22, 28, .06), 0 10px 24px rgba(16, 22, 28, .09);
    transform: translateY(-2px);
}

.kpi-card.danger::before {
    background: var(--bs-danger);
}

.kpi-card .icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: linear-gradient(155deg, var(--app-accent-050), var(--app-surface-0));
    border: 1px solid var(--bs-primary-border-subtle);
    color: var(--app-accent-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14.5px;
}

.kpi-card.danger .icon {
    background: linear-gradient(155deg, var(--bs-danger-bg-subtle), var(--app-surface-0));
    border-color: var(--bs-danger-border-subtle);
    color: var(--bs-danger);
}

.kpi-card .label {
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-ink-500);
    padding-right: 40px;
    margin-bottom: 10px;
}

.kpi-card .value {
    font-size: 32px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.kpi-card.danger .value {
    color: var(--bs-danger);
}

/* ---- Master/mapping menu tiles — an icon+label launcher card, replacing a
   flat outline button, for grids of links to generic CRUD screens (Masters,
   Mappings). Category headers above a tile grid reuse .form-section-title's
   type style directly, without the tinted .form-section box — that box reads
   as a form-field group, not a link launcher. ---- */
.master-tile-group + .master-tile-group {
    margin-top: 22px;
}

.master-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--app-surface-0);
    border: 1px solid var(--app-border);
    border-radius: var(--bs-border-radius);
    color: var(--app-ink-900);
    text-decoration: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.master-tile:hover {
    border-color: var(--app-accent);
    box-shadow: var(--app-shadow-card);
    color: var(--app-ink-900);
}

.master-tile .icon {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 8px;
    background: var(--app-accent-050);
    color: var(--app-accent-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.master-tile .label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

/* ---- Chart cards — every dashboard's chart wrapper, replacing a bare
   .card/.card-header/<canvas> (no internal padding rhythm, Chart.js default
   colors) with the same list-panel-style header + inset body used everywhere
   else, plus a fixed canvas height so a row of charts lines up evenly and an
   empty-state message so a canvas with no data doesn't just render blank. ---- */
.chart-card {
    background: var(--app-surface-0);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chart-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--app-border);
}

.chart-card-head .title {
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.chart-card-head .subtitle {
    font-size: 11.5px;
    color: var(--app-ink-500);
    white-space: nowrap;
}

/* A fixed height (not min-height/flex-grow) is deliberate: Chart.js's
   maintainAspectRatio:false sizes the canvas to its parent's clientHeight via
   a ResizeObserver, and a parent whose own height depends on flex-grow with
   no sibling to anchor the row (e.g. a chart-card with no neighboring column)
   has nothing to stop that from growing unboundedly every observed resize. */
.chart-card-body {
    position: relative;
    height: 260px;
    padding: 16px 18px 18px;
}

.chart-card-body canvas {
    max-height: 100%;
}

.chart-card-empty {
    position: absolute;
    inset: 16px 18px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-ink-500);
    font-size: 12.5px;
    text-align: center;
}

/* ---- Error pages (401/403/404/419/422/429/5xx) — rendered inside the same
   app/guest shell as everything else, via ExceptionHandler + errors/show.php,
   instead of a bare unstyled HTML string. ---- */
.error-page {
    max-width: 420px;
    margin: 8vh auto 0;
    text-align: center;
}

.error-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.error-icon-neutral {
    background: var(--app-surface-100);
    color: var(--app-ink-700);
}

.error-icon-danger {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger);
}

.error-page .error-code {
    font-family: var(--app-font-mono);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .04em;
    color: var(--app-ink-500);
    margin-bottom: 4px;
}

.error-page h1 {
    font-size: 20px;
    margin-bottom: 8px;
}

.error-page p {
    color: var(--app-ink-500);
    font-size: 14px;
    margin-bottom: 24px;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Field-specific validation messages (ValidationException::errors()) — a plain
   POST form has no AJAX layer to put these next to the field itself, so this
   is the fallback: at least name what actually failed, not just a generic
   "the given data was invalid" that fits every possible cause identically. */
.error-field-list {
    background: var(--app-surface-100);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 12px 16px 12px 32px;
    margin: -8px 0 24px;
    font-size: 13px;
    color: var(--app-ink-700);
}

.error-field-list li {
    margin-bottom: 2px;
}

.error-field-list li:last-child {
    margin-bottom: 0;
}

/* ---- Badges: keep Bootstrap's text-bg-* palette (retinted above) but read
   as status pills, matching the semantic-chip pattern used across issue/
   problem/change status displays. ---- */
.badge {
    --bs-badge-border-radius: 20px;
    /* Bootstrap's default .75em resolves against this app's 13.5px body font
       (see --bs-body-font-size above) to ~10px — noticeably smaller than the
       surrounding text it's labeling (status/priority/SLA chips), not just a
       little smaller as a badge convention usually implies. */
    font-size: 13px;
    padding: .4em .75em;
    font-weight: 650;
    letter-spacing: .01em;
}

/* A smaller variant for tight table cells (All Issues' Status column) — the
   default .badge above is sized to read well as a standalone chip, which is
   too roomy once several other columns (Age, Created, Actions) are competing
   for the same row width. */
.badge-compact {
    font-size: 11px;
    padding: .25em .55em;
}

/* Bootstrap's .text-bg-info hardcodes black text (#000 !important), which is fine
   against its own default light-cyan info color but fails WCAG AA (4.11:1, needs
   4.5:1) against this app's retinted, noticeably darker --bs-info (#4a6fa5) — the
   text read as muddy/low-contrast on SLA due-date and Medium-priority badges. */
.text-bg-info {
    color: #fff !important;
}

/* ==========================================================================
   App shell — sidebar + topbar (layouts/app.php only; layouts/guest.php has
   no sidebar, it only inherits the tokens/components above).
   ========================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    --sidebar-w: 256px;
    --sidebar-w-collapsed: 72px;
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--app-ink-900);
    color: #b9c2c8;
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: flex-basis .15s ease, width .15s ease;
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .15);
    border-radius: 3px;
}

/* Keyed off <html>, not .app-shell — a tiny inline script in <head> (before
   the sidebar itself exists in the DOM) restores this class from localStorage
   ahead of first paint, so a collapsed preference never flashes full-width. */
html.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-w-collapsed);
    flex-basis: var(--sidebar-w-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 6px;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand-mark {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 8px;
    background: linear-gradient(155deg, var(--app-accent), var(--app-accent-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.sidebar-brand-text {
    line-height: 1.15;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-text strong {
    display: block;
    font-size: 13.5px;
    font-weight: 650;
}

.sidebar-brand-text span {
    font-size: 11px;
    color: #8892a0;
}

html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .nav-item span.nav-item-text,
html.sidebar-collapsed .nav-item .count,
html.sidebar-collapsed .nav-group-toggle .chevron {
    display: none;
}

html.sidebar-collapsed .nav-item {
    justify-content: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    padding: 8px 10px 4px;
    background: none;
    border: 0;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #6b7784;
    cursor: pointer;
}

.nav-group-toggle .chevron {
    margin-left: auto;
    font-size: 10px;
    transition: transform .15s ease;
}

.nav-group.collapsed .nav-group-toggle .chevron {
    transform: rotate(-90deg);
}

.nav-group.collapsed .nav-group-items {
    display: none;
}

.nav-label {
    display: block;
    padding: 8px 10px 4px;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #6b7784;
}

.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #b9c2c8;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

.nav-item i.bi {
    width: 17px;
    text-align: center;
    font-size: 15px;
    opacity: .85;
    flex: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.nav-item.active {
    background: rgba(var(--app-accent-rgb), .22);
    color: #fff;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 2px;
    background: var(--app-accent);
}

html.sidebar-collapsed .nav-item.active::before {
    left: 0;
}

.nav-item .count {
    margin-left: auto;
    font-family: var(--app-font-mono);
    font-size: 11px;
    background: rgba(255, 255, 255, .08);
    color: #cfd6db;
    padding: 1px 6px;
    border-radius: 20px;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 58px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 24px;
    background: var(--app-surface-0);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--app-ink-700);
    cursor: pointer;
}

.topbar-toggle:hover {
    background: var(--app-surface-100);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ---- Topbar issue search — sits between the sidebar toggle and the
   notification/user-menu icons; results are scope-filtered server-side
   (ScopeProfile), same visibility as "All Issues", so nothing here shows a
   user an issue they couldn't already open directly. ---- */
.topbar-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 380px;
    margin-left: 14px;
}

.topbar-search .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-ink-500);
    font-size: 13px;
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    font-size: 13px;
    background: var(--app-surface-50);
    border: 1.5px solid var(--app-border);
    border-radius: 999px;
    color: var(--app-ink-900);
    transition: border-color .12s ease, background-color .12s ease;
}

.topbar-search input:focus {
    outline: none;
    background: var(--app-surface-0);
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3.5px rgba(var(--app-accent-rgb), .13);
}

.topbar-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--app-surface-0);
    border: 1px solid var(--app-border);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--app-shadow-card);
    max-height: 360px;
    overflow-y: auto;
    z-index: 20;
}

.topbar-search-result {
    display: block;
    padding: 9px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--app-border);
}

.topbar-search-result:last-child {
    border-bottom: 0;
}

.topbar-search-result:hover {
    background: var(--app-surface-50);
}

.topbar-search-result .number {
    font-family: var(--app-font-mono);
    font-size: 11.5px;
    font-weight: 650;
    color: var(--app-accent-600);
}

.topbar-search-result .title {
    font-size: 13px;
    color: var(--app-ink-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search-result .meta {
    font-size: 11px;
    color: var(--app-ink-500);
}

.topbar-search-empty {
    padding: 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--app-ink-500);
}

@media (max-width: 900px) {
    .topbar-search {
        display: none;
    }
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-ink-700);
    background: transparent;
    border: 0;
    position: relative;
    text-decoration: none;
    font-size: 16px;
}

.icon-btn:hover {
    background: var(--app-surface-100);
}

.icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bs-danger);
    border: 2px solid var(--app-surface-0);
}

/* ---- Topbar user menu — avatar+name+chevron trigger, dropdown holds the
   account summary (name, mobile, active role badges, loaded async by
   profile-menu.js since roles aren't part of the User model passed to every
   view) plus links to the profile page and logout. ---- */
.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.user-menu-toggle:hover {
    background: var(--app-surface-100);
}

.user-menu-toggle .avatar {
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    background: linear-gradient(155deg, var(--app-accent), var(--app-accent-600));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.user-menu-toggle .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-ink-900);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-toggle .bi-chevron-down {
    font-size: 10px;
    color: var(--app-ink-500);
}

.user-menu-summary {
    padding: 12px 14px;
    border-bottom: 1px solid var(--app-border);
}

.user-menu-summary .name {
    font-size: 13.5px;
    font-weight: 650;
}

.user-menu-summary .mobile {
    font-size: 12px;
    color: var(--app-ink-500);
    margin-top: 1px;
}

.user-menu-summary .roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-content {
    padding: 24px 28px 40px;
}

@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        z-index: 20;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .15s ease;
    }

    html.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .app-content {
        padding: 18px 16px 32px;
    }
}
