:root {
    --sidebar-width: 250px;
    --header-height: 56px;
    --main-content-padding: 1.5rem;
    --primary-color: #0d1b2a;
    --secondary-color: #1b263b;
    --accent-color: #415a77;
    --accent-hover: #354a64;
    --accent-active: #2d4057;

    --surface-0: #e8ecf2;
    --surface-1: #ffffff;
    --surface-2: #f7f9fc;
    --bg-color: var(--surface-0);
    --card-bg: var(--surface-1);

    --border-subtle: #e1e5eb;
    --border-default: #d0d6de;
    --border-strong: #b9c1cc;
    --card-border: var(--border-default);

    --card-shadow: 0 0 0 1px rgba(13, 27, 42, 0.06),
                   0 1px 2px rgba(13, 27, 42, 0.04),
                   0 2px 6px rgba(13, 27, 42, 0.05);
    --card-shadow-hover: 0 0 0 1px rgba(13, 27, 42, 0.08),
                         0 2px 4px rgba(13, 27, 42, 0.06),
                         0 8px 18px rgba(13, 27, 42, 0.08);

    --text-muted: #6c757d;

    --radius: 6px;
    --radius-card: 6px;
    --bs-border-radius: 6px;
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: 6px;
    --bs-border-radius-xl: 6px;
    --bs-border-radius-xxl: 6px;
    --bs-border-radius-pill: 999px;

    --surface-tonal: #f9fafb;
}

html {
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: none;
}
body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'cv11';
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior: none;
}

.tooltip {
    --bs-tooltip-bg: var(--accent-color);
    --bs-tooltip-opacity: 1;
}
.tooltip-inner {
    max-width: none;
    white-space: nowrap;
}

a { color: var(--accent-color); }
a:hover { color: var(--accent-hover); }
.text-muted a { color: var(--text-muted); }
.text-muted a:hover { color: var(--accent-color); }

.navbar-dark {
    background-color: var(--primary-color) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.navbar-logo { height: 32px; width: auto; display: block; }

.btn {
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    white-space: nowrap;
}
.btn:focus:not(:focus-visible),
.btn:active:focus:not(:focus-visible),
.btn-check:focus:not(:focus-visible) + .btn { box-shadow: none; }
.btn-link:focus:not(:focus-visible) { box-shadow: none; text-decoration: none; }
.dropdown-toggle:focus:not(:focus-visible) { box-shadow: none; }
.nav-link:focus:not(:focus-visible) { box-shadow: none; }
.btn-close:focus:not(:focus-visible) { box-shadow: none; outline: none; }
.form-check-input:focus:not(:focus-visible) {
    box-shadow: none;
    outline: none;
    border-color: rgba(0, 0, 0, 0.25);
}
.accordion-button:focus:not(:focus-visible) { box-shadow: none; outline: none; }
.form-control:focus:not(:focus-visible),
.form-select:focus:not(:focus-visible),
input:not([type="checkbox"]):not([type="radio"]):focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    box-shadow: none;
    outline: none;
    border-color: #d1d5db;
}
.btn:focus:not(:focus-visible),
.btn-outline-primary:focus:not(:focus-visible),
.btn-outline-secondary:focus:not(:focus-visible),
.btn-outline-success:focus:not(:focus-visible),
.btn-outline-danger:focus:not(:focus-visible),
.btn-outline-warning:focus:not(:focus-visible),
.btn-outline-info:focus:not(:focus-visible) {
    box-shadow: none;
}

:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 2px;
}
.btn:focus-visible,
.btn-link:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--secondary-color);
    --bs-btn-hover-border-color: var(--secondary-color);
    --bs-btn-active-bg: var(--secondary-color);
    --bs-btn-active-border-color: var(--secondary-color);
    --bs-btn-disabled-bg: var(--primary-color);
    --bs-btn-disabled-border-color: var(--primary-color);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover { background-color: var(--secondary-color); border-color: var(--secondary-color); }
.btn-primary:active, .btn-primary:focus { background-color: var(--secondary-color) !important; border-color: var(--secondary-color) !important; box-shadow: none !important; }
.btn-primary:disabled { opacity: 0.5; }

.btn-outline-primary {
    --bs-btn-color: var(--accent-color);
    --bs-btn-border-color: var(--accent-color);
    --bs-btn-hover-bg: var(--accent-color);
    --bs-btn-hover-border-color: var(--accent-color);
    --bs-btn-active-bg: var(--accent-active);
    --bs-btn-active-border-color: var(--accent-active);
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.btn-outline-primary:hover { background-color: var(--accent-color); border-color: var(--accent-color); color: #fff; }
.bg-primary:not(.badge) { background-color: var(--accent-color) !important; }

.btn-reset {
    background: #fff;
    border: 1px solid #ccd5e0;
    color: #5b6675;
    font-weight: 500;
}
.btn-reset:hover { background: #f2f5f9; border-color: #b6c1d0; color: #384252; }
.btn-reset:active, .btn-reset:focus { background: #eef2f7; border-color: #b6c1d0; color: #384252; box-shadow: none; }
.text-primary { color: var(--accent-color) !important; }
.border-primary { border-color: var(--accent-color) !important; }

.btn-secondary:active, .btn-secondary:focus { background-color: #5a6268 !important; border-color: #545b62 !important; }
.btn-outline-secondary:active, .btn-outline-secondary:focus { background-color: #6c757d !important; border-color: #6c757d !important; color: #fff !important; }
.btn-outline-light:active, .btn-outline-light:focus { background-color: rgba(255,255,255,0.2) !important; border-color: #fff !important; color: #fff !important; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.625rem 1.25rem; font-size: 1rem; }

.btn-dashboard-shortcut {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
    font-weight: 500;
}
.btn-dashboard-shortcut:hover {
    background-color: #ffca2c !important;
    border-color: #ffc720 !important;
    color: #000 !important;
}
.btn-dashboard-shortcut:active,
.btn-dashboard-shortcut:focus,
.btn-dashboard-shortcut:focus-visible {
    background-color: #ffcd39 !important;
    border-color: #ffc720 !important;
    color: #000 !important;
    box-shadow: 0 0 0 0.15rem rgba(255, 193, 7, 0.5) !important;
    outline: none !important;
}

.card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(13, 27, 42, 0.04), 0 2px 6px rgba(13, 27, 42, 0.05);
    background-color: var(--card-bg);
    overflow: hidden;
}
.card .card {
    box-shadow: 0 1px 3px rgba(13, 27, 42, 0.07), 0 1px 6px rgba(13, 27, 42, 0.05);
}
.card:has(.ts-wrapper),
.card:has(.qms-popinfo),
.modal-content:has(.ts-wrapper),
.modal-content:has(.qms-popinfo),
.modal-body:has(.ts-wrapper),
.modal-body:has(.qms-popinfo) {
    overflow: visible;
}
.card:has(.qms-popinfo) > .card-body,
.table-responsive:has(.qms-popinfo) {
    overflow: visible;
}
.card-header {
    background-color: var(--surface-2);
    border-bottom: 1px solid var(--border-default);
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary-color);
    padding: 0.625rem 1rem;
}

.card-body > .card-title:first-child,
.card-body > h5.card-title,
.card-body > h6.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: -0.25rem -0.25rem 1rem -0.25rem;
    padding: 0 0.25rem 0.6rem 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: -0.005em;
}

.form-control, .form-select,
.card-body input[type="text"], .card-body input[type="email"],
.card-body input[type="password"], .card-body input[type="number"],
.card-body input[type="date"], .card-body input[type="url"],
.card-body input[type="tel"], .card-body input[type="file"],
.card-body select, .card-body textarea {
    border-radius: var(--radius);
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out;
}
.card-body input[type="text"], .card-body input[type="email"],
.card-body input[type="password"], .card-body input[type="number"],
.card-body input[type="date"], .card-body input[type="url"],
.card-body input[type="tel"], .card-body input[type="file"],
.card-body select, .card-body textarea {
    display: block;
    width: 100%;
}
.form-control:focus, .form-select:focus,
.card-body input:not([type="checkbox"]):not([type="radio"]):focus,
.card-body select:focus, .card-body textarea:focus {
    border-color: #9ca3af;
    box-shadow: none;
    outline: none;
    background-color: #fff;
}
.form-control:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) {
    border-color: #b0b5bc;
}
.form-control:disabled, .form-select:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
}

.action-badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.25em 0.55em;
}
.action-badge-auth    { background: #dbeafe; color: #1e40af; }
.action-badge-denied  { background: #fee2e2; color: #991b1b; }
.action-badge-create  { background: #dcfce7; color: #166534; }
.action-badge-update  { background: #fef3c7; color: #92400e; }
.action-badge-delete  { background: #fecaca; color: #7f1d1d; }
.action-badge-neutral { background: #e5e7eb; color: #374151; }

.zoom-control > .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.zoom-control .zoom-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    min-width: 56px;
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    padding-left: 0;
    padding-right: 0;
}

.table-dense tbody td {
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f1f2f4;
}
.table-dense thead th {
    padding: 0.5rem 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background: #475569;
}
.table-dense[data-zoom], .table-dense {
    zoom: var(--table-zoom, 1);
}

.activity-scroll {
    max-height: calc(100vh - 320px);
    min-height: 240px;
}
.main-content.page-flex .activity-scroll {
    max-height: none;
    min-height: 0;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.empty-state-sm {
    padding: 1rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.empty-state-icon {
    font-size: 2.25rem;
    color: #c4c9d0;
    margin-bottom: 0.5rem;
    display: block;
}
.empty-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
}
.empty-state-hint { font-size: 0.8125rem; }
.empty-state-cell {
    text-align: center;
    padding: 2rem 1rem !important;
    color: var(--text-muted);
    font-size: 0.85rem;
    background-color: #fff !important;
    border-bottom: 0 !important;
}
.empty-state-row,
.empty-state-row:hover,
.table-hover tbody tr.empty-state-row,
.table-hover tbody tr.empty-state-row:hover {
    background-color: #fff !important;
    cursor: default !important;
}
.empty-state-row > td,
.empty-state-row:hover > td,
.table-hover tbody tr.empty-state-row > td,
.table-hover tbody tr.empty-state-row:hover > td,
.table > tbody > tr.empty-state-row:nth-child(even) > td,
.table > tbody > tr.empty-state-row:nth-child(odd) > td,
.table > tbody > tr.empty-state-row > td,
.table-hover > tbody > tr.empty-state-row:hover > * {
    --bs-table-bg-state: #fff !important;
    --bs-table-hover-bg: #fff !important;
    --bs-table-striped-bg: #fff !important;
    --bs-table-color-state: inherit !important;
    background-color: #fff !important;
    border-bottom: 0 !important;
}
.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.35rem;
}
.form-text {
    font-size: 0.75rem;
    color: #6b7280;
}
.form-check-input {
    border: 1px solid #d1d5db;
    width: 1rem;
    height: 1rem;
    position: relative;
    z-index: 1;
    cursor: pointer;
}
.form-check:not(.form-switch) {
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    min-height: auto;
}
.form-check:not(.form-switch) .form-check-input {
    float: none;
    margin-left: 0;
    margin-top: 0.2em;
    flex-shrink: 0;
}
.form-check:not(.form-switch) .form-check-label {
    margin-bottom: 0;
}
.form-check-input[type="checkbox"] { border-radius: 2px; }
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}
.form-check-input[type="checkbox"]:indeterminate {
    background-color: #ffc107;
    border-color: #ffc107;
}
.form-check-input[type="checkbox"]:indeterminate:focus,
.form-check-input[type="checkbox"]:indeterminate:focus-visible {
    border-color: #ffc107;
}
.form-check-input:focus {
    box-shadow: none;
    border-color: #d1d5db;
    outline: none;
}
.form-check-input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}
.form-check-input:checked:focus { border-color: var(--accent-color); }
.form-check-label { font-size: 0.875rem; color: #374151; cursor: pointer; }
.input-group-text {
    border-radius: var(--radius);
    border: 1px solid #d1d5db;
    background-color: var(--surface-tonal);
    font-size: 0.875rem;
    color: #6b7280;
}
textarea.form-control { resize: vertical; }
.form-control::placeholder { color: #9ca3af; font-size: 0.875rem; }

.main-content input[type="text"],
.main-content input[type="email"],
.main-content input[type="password"],
.main-content input[type="number"],
.main-content input[type="date"],
.main-content input[type="url"],
.main-content input[type="tel"],
.main-content input[type="search"],
.main-content select,
.main-content textarea {
    border-radius: var(--radius);
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out;
    display: block;
    width: 100%;
    line-height: 1.5;
    color: #212529;
    appearance: none;
    -webkit-appearance: none;
}
.main-content input:not([type="checkbox"]):not([type="radio"]):focus,
.main-content select:focus,
.main-content textarea:focus {
    border-color: #9ca3af;
    box-shadow: none;
    outline: none;
    background-color: #fff;
}
.main-content textarea { resize: vertical; }
.main-content input[type="date"].form-control,
.main-content input[type="time"].form-control,
.main-content input[type="number"].form-control,
.main-content input.qms-datepicker.form-control,
.main-content input.flatpickr-input.form-control {
    max-width: 240px;
}
.main-content select.form-select {
    max-width: 480px;
}
.qms-inline-create { max-width: 536px; }
.row > .js-reset-filters {
    width: auto;
    flex: 0 0 auto;
}
.form-select optgroup {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-color);
    padding-top: 0.35rem;
}
.form-select optgroup option {
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-strong, #1f2937);
    padding-left: 0.5rem;
}
.ts-wrapper.single .ts-control > .item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}
.main-content select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px 12px; padding-right: 2.25rem; }

.main-content input.qms-search,
.qms-search {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3ccircle cx='7' cy='7' r='4.5' stroke='%236b7280' stroke-width='1.5'/%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-width='1.5' d='m11 11 3 3'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.6rem center;
    background-size: 14px 14px;
    padding-left: 2rem;
}

.qms-popinfo { position: relative; display: inline-block; vertical-align: middle; }
.qms-popinfo-trigger {
    border: 0; background: none; padding: 0; margin-left: 0.3rem;
    color: var(--text-muted); cursor: pointer; line-height: 1; font-size: 0.85rem;
}
.qms-popinfo-trigger:hover,
.qms-popinfo.open .qms-popinfo-trigger { color: var(--accent-color); }
.qms-popinfo-content {
    display: none; position: absolute; z-index: 1080; top: 100%; left: 0;
    margin-top: 0.4rem; min-width: 200px; max-width: 320px;
    background: #fff; border: 1px solid var(--border-default);
    border-radius: var(--radius); box-shadow: 0 4px 16px rgba(13, 27, 42, 0.14);
    padding: 0.55rem 0.7rem; font-size: 0.78rem; line-height: 1.45;
    color: var(--text-strong, #1f2937); white-space: normal; text-align: left; font-weight: 400;
}
.qms-popinfo.open .qms-popinfo-content { display: block; }
.qms-popinfo.open .qms-popinfo-content::before {
    content: ''; position: absolute; top: -5px; left: 8px; width: 9px; height: 9px;
    background: #fff; border-left: 1px solid var(--border-default); border-top: 1px solid var(--border-default);
    transform: rotate(45deg);
}

.ts-wrapper.form-select,
.ts-wrapper.form-control,
.ts-wrapper.form-select-sm,
.ts-wrapper.form-control-sm {
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    box-shadow: none !important;
    transition: none !important;
    outline: none !important;
}
.ts-wrapper.form-select:focus,
.ts-wrapper.form-control:focus,
.ts-wrapper.form-select.focus,
.ts-wrapper.form-control.focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.single.focus .ts-control,
.ts-wrapper.single.dropdown-active .ts-control {
    background-color: #fff !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: var(--radius) !important;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem !important;
    font-size: 0.875rem;
    color: #212529;
    box-shadow: none !important;
    min-height: 0;
    line-height: 1.5;
    cursor: pointer !important;
    transition: none !important;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.single.focus .ts-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}
.ts-wrapper:focus-visible,
.ts-wrapper *:focus-visible,
.ts-wrapper .ts-control:focus-visible,
.ts-wrapper .ts-control > input:focus-visible {
    outline: none !important;
}
.ts-wrapper.form-select-sm .ts-control,
.ts-wrapper.single.form-select-sm .ts-control {
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    font-size: 0.8125rem;
}
.ts-wrapper.single .ts-control:hover { border-color: #b0b5bc; }
.ts-wrapper.single.focus .ts-control {
    border-color: #9ca3af;
    box-shadow: none;
    outline: none;
}
.ts-wrapper.single.dropdown-active .ts-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 11 6-6 6 6'/%3e%3c/svg%3e") !important;
}
.ts-wrapper.single .ts-control > input {
    cursor: pointer !important;
}
.ts-wrapper.single .ts-control > input { color: #212529; }
.ts-wrapper.single .ts-control::after { display: none; }
.ts-dropdown {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    box-shadow:
        0 12px 24px -6px rgba(0, 0, 0, 0.18),
        0 6px 10px -4px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    font-size: 0.875rem;
    color: #212529;
    z-index: 1056;
    width: max-content !important;
    min-width: var(--ts-trigger-width, 0) !important;
    max-width: min(100vw, 640px) !important;
}
.ts-dropdown .optgroup-header {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-color);
    background: var(--surface-2, #f7f9fc);
    padding: 0.45rem 0.75rem 0.3rem;
    letter-spacing: 0.02em;
    cursor: default;
    border-top: 1px solid var(--border-subtle, #e1e5eb);
}
.ts-dropdown .optgroup:first-child .optgroup-header {
    border-top: none;
}
.ts-dropdown .optgroup .option {
    padding-left: 1.25rem;
}
.ts-dropdown .option {
    padding: 0.5rem 0.75rem;
    background: #fff;
    color: #212529;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
}
.ts-dropdown-content {
    overflow-x: auto !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.ts-dropdown-content {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #adb5bd #f1f3f5;
}
.ts-dropdown-content::-webkit-scrollbar {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background-color: #f1f3f5;
}
.ts-dropdown-content::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: var(--radius);
}
.ts-dropdown-content::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: var(--radius);
    border: 2px solid #f1f3f5;
}
.ts-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}
.ts-dropdown .option.active,
.ts-dropdown .option:hover {
    background: #f3f4f6;
    color: #212529;
}
.ts-dropdown .option.selected {
    background: var(--accent-color);
    color: #fff;
}
.ts-dropdown .option.selected.active {
    background: var(--accent-color);
    color: #fff;
}
.ts-wrapper.disabled .ts-control,
.ts-wrapper.disabled.single .ts-control {
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}
.main-content .ts-wrapper { max-width: 480px; }
@media print {
    .ts-wrapper { display: none !important; }
    select.tomselected { display: inline-block !important; }
}

.main-content label[for]:has(+ input[required]),
.main-content label[for]:has(+ select[required]),
.main-content label[for]:has(+ textarea[required]) {
    position: relative;
}
.main-content label[for]:has(+ input[required])::after,
.main-content label[for]:has(+ select[required])::after,
.main-content label[for]:has(+ textarea[required])::after {
    content: ' *';
    color: #dc3545;
    font-weight: 600;
}

.table { font-size: 0.8125rem; table-layout: auto; width: 100%; border-collapse: separate; border-spacing: 0; }
.table-fixed { table-layout: fixed; }
.table th {
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.table thead th {
    background-color: #475569;
    color: #fff;
    border-bottom: 1px solid #475569;
    padding: 0.5rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1;
    vertical-align: middle;
}
.table thead th i,
.table thead th a,
.table thead th .text-muted {
    color: #fff !important;
}
.table tbody td {
    padding: 0.35rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    white-space: normal;
    overflow-wrap: break-word;
}
.table tbody td.wrap { white-space: normal; }
.table tbody td.nowrap { white-space: nowrap; }
.table tbody td:has(.btn-action),
.table tbody td:has(.btn-group) { white-space: nowrap; }

.table-scroll, .table-scroll-tall, .table-scroll-sm, .activity-scroll, .conversation-scroll {
    overflow-y: auto;
    padding-bottom: 0.25rem;
}
.country-list, .notif-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1rem;
}
.table-scroll {
    max-height: calc(100vh - 340px);
    min-height: 260px;
}
.table-scroll-tall {
    max-height: calc(100vh - 250px);
    min-height: 320px;
}
.table-scroll-sm {
    max-height: 300px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table > tbody > tr:nth-child(even) > td,
.table > tbody > tr:nth-child(even) > th {
    background-color: #f7f8fa;
}
.table-hover tbody tr:hover > td,
.table-hover tbody tr:hover > th {
    background-color: #eef2f6 !important;
}
.table tbody tr { transition: background-color 0.1s; }
.table.table-no-stripe > tbody > tr:nth-child(even) > td,
.table.table-no-stripe > tbody > tr:nth-child(even) > th {
    background-color: transparent;
}

.table.training-matrix {
    width: max-content;
}
.table.training-matrix .matrix-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    white-space: nowrap;
    width: 1%;
}
.table.training-matrix tbody .matrix-sticky-col {
    z-index: 1;
    background: var(--surface-1);
}
.table.training-matrix thead th:not(.matrix-sticky-col) {
    max-width: 12rem;
    white-space: normal;
    word-break: break-word;
}

.qms-stacked-tables .table {
    table-layout: fixed;
    width: 100%;
}
.qms-stacked-tables col.col-order   { width: 80px; }
.qms-stacked-tables col.col-label   { width: 30%; }
.qms-stacked-tables col.col-value   { width: 35%; }
.qms-stacked-tables col.col-status  { width: 110px; }
.qms-stacked-tables col.col-actions { width: 110px; }
.qms-stacked-tables .table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.btn-action {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
    line-height: 1.2;
    border-radius: var(--radius);
    min-width: 30px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}
.btn-action i { font-size: 0.85rem; }
.btn-action + .btn-action,
.btn-action + form { margin-left: 2px; }
.btn.btn-action:not(.btn-action-text):has(> i) {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: transparent;
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: transparent;
    background: transparent !important;
    border: none;
    box-shadow: none !important;
    padding: 0.15rem 0.3rem;
    min-width: 0;
    min-height: 0;
    transition: transform 0.12s ease;
}
.btn.btn-action:not(.btn-action-text):has(> i) i { font-size: 0.95rem; }
.btn.btn-action.btn-secondary:not(.btn-action-text):has(> i) { color: #475569 !important; }
.btn.btn-action.btn-danger:not(.btn-action-text):has(> i) { color: #dc3545 !important; }
.btn.btn-action.btn-success:not(.btn-action-text):has(> i) { color: #198754 !important; }
.btn.btn-action.btn-primary:not(.btn-action-text):has(> i) { color: var(--accent-color) !important; }
.btn.btn-action.btn-warning:not(.btn-action-text):has(> i) { color: #ffc107 !important; }
.btn.btn-action:not(.btn-action-text):has(> i):hover,
.btn.btn-action:not(.btn-action-text):has(> i):active,
.btn.btn-action:not(.btn-action-text):has(> i):focus,
.btn.btn-action:not(.btn-action-text):has(> i):focus-visible {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
@media (hover: hover) {
    .btn.btn-action:not(.btn-action-text):has(> i):hover { transform: scale(1.15); }
}
.btn.btn-action:not(.btn-action-text):has(> i):active { transform: scale(1.2); }
.clickable-row { cursor: pointer; }
.form-inline { display: inline; }

.badge.badge-soft-success   { background: #dcfce7; color: #166534; box-shadow: inset 0 0 0 1px rgba(22,101,52,0.18); }
.badge.badge-soft-danger    { background: #fee2e2; color: #991b1b; box-shadow: inset 0 0 0 1px rgba(153,27,27,0.18); }
.badge.badge-soft-warning   { background: #fef3c7; color: #92400e; box-shadow: inset 0 0 0 1px rgba(146,64,14,0.18); }
.badge.badge-soft-info      { background: #dbeafe; color: #1e40af; box-shadow: inset 0 0 0 1px rgba(30,64,175,0.18); }
.badge.badge-soft-secondary { background: #eef1f5; color: #475569; box-shadow: inset 0 0 0 1px rgba(71,85,105,0.16); }
.badge.badge-soft-dark      { background: #dfe3e8; color: #1f2937; box-shadow: inset 0 0 0 1px rgba(31,41,55,0.22); }
.badge.badge-soft-primary   { background: #e5eaf1; color: #2f4360; box-shadow: inset 0 0 0 1px rgba(65,90,119,0.22); }

.badge.badge-count { background: #d3dbe6; color: #43526b; box-shadow: inset 0 0 0 1px rgba(67,82,107,0.14); }

.btn-loading {
    position: relative;
}
.btn-loading > *:not(.btn-loading-spinner) {
    visibility: hidden;
}
.btn-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: calc(-1 * var(--bs-spinner-width, 1rem) / 2) 0 0 calc(-1 * var(--bs-spinner-width, 1rem) / 2);
}

.tabular-nums,
.badge,
.item-count,
.page-nav-count,
.metric-lg,
.metric-md {
    font-variant-numeric: tabular-nums;
}

.count-stable {
    display: inline-block;
    min-width: 3ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.badge.badge-count {
    min-width: 2.4ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.code-sm { font-size: 0.8rem; }
.pre-wrap { white-space: pre-wrap; }
.conversation-scroll { max-height: 500px; background-color: var(--surface-tonal); }
.support-chat {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.support-chat-row {
    display: flex;
    gap: 0.55rem;
    align-items: flex-end;
    max-width: 78%;
}
.support-chat-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.support-chat-theirs { align-self: flex-start; }
.support-chat-avatar { flex-shrink: 0; }
.support-chat-avatar-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}
.support-chat-stack {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.support-chat-mine .support-chat-stack { align-items: flex-end; }
.support-chat-meta {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.72rem;
    color: #6b7280;
}
.support-chat-name { font-weight: 600; color: #374151; }
.support-chat-bubble {
    padding: 0.55rem 0.9rem;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.45;
    background-color: #fff;
    border: 1px solid rgba(13, 27, 42, 0.1);
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(13, 27, 42, 0.05);
    overflow-wrap: anywhere;
}
.support-chat-theirs .support-chat-bubble { border-bottom-left-radius: 4px; }
.support-chat-mine .support-chat-bubble {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.support-chat-mine .support-chat-meta { flex-direction: row-reverse; }
.support-chat-footer {
    border-top: 1px solid rgba(13, 27, 42, 0.07);
    padding: 0.75rem 1rem;
    background-color: #fff;
}
.support-chat-composer {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.support-chat-composer textarea {
    border-radius: 16px;
    resize: none;
    max-height: 9rem;
}
.support-chat-send {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}
.drill-link { color: var(--primary-color); transition: color 0.15s; }
.drill-link:hover { color: var(--accent-color); }
.country-search { position: relative; }
.country-search input { margin-bottom: 8px; }
.country-list { max-height: 250px; border: 1px solid #d1d5db; border-radius: var(--radius); }
.country-list label.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 6px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 0;
}
.country-list label.form-check:hover { background: #f0f3f7; }
.country-list .form-check .form-check-input {
    margin: 0;
    float: none;
    flex-shrink: 0;
}

.bell-icon { font-size: 1.3rem; }
.nav-contact-admin i { font-size: 1.3rem; }
.nav-logout i { font-size: 1.3rem; }
.nav-contact-admin:hover,
.nav-logout:hover {
    background-color: transparent;
    text-decoration: none;
}
.notif-badge {
    display: none;
    font-size: 10px;
    font-weight: 600;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    line-height: 18px;
}
.notif-dropdown { width: 320px; z-index: 1080; }
.notif-list {
    max-height: 300px;
    padding-bottom: 0;
}
.nav-username { font-size: 0.8125rem; }
.nav-section-arrow { font-size: 0.55rem; float: right; margin-top: 2px; }

.notif-time { font-size: 0.7rem; }

#notificationBell:focus,
#notificationBell:active,
#notificationBell:focus-visible,
#notificationBell.show {
    outline: 0 none transparent;
    box-shadow: none;
    text-decoration: none;
}
#notificationBell:hover {
    background-color: transparent;
    text-decoration: none;
}

.notif-item {
    display: flex;
    align-items: stretch;
    padding: 0;
    border-bottom: 1px solid var(--border-subtle, #e9ecef);
    color: inherit;
    text-decoration: none;
    transition: background-color 120ms ease;
    background-color: rgba(37, 99, 235, 0.04);
    border-left: 3px solid var(--accent-color, #2563eb);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background-color: rgba(37, 99, 235, 0.08); text-decoration: none; }
.notif-item-body {
    flex: 1 1 auto;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    min-width: 0;
    font-weight: 500;
}
.notif-item-arrow {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    color: var(--accent-color, #2563eb);
    border-left: 1px solid var(--border-subtle, #e9ecef);
    text-decoration: none;
}
.notif-item-arrow:hover {
    background-color: var(--accent-color, #2563eb);
    color: white;
    text-decoration: none;
}
.notif-item.notif-item-read {
    background-color: transparent;
    border-left-color: transparent;
}
.notif-item.notif-item-read .notif-item-body {
    font-weight: 400;
    color: var(--text-muted, #6c757d);
}
.notif-item.notif-item-read:hover {
    background-color: rgba(0, 0, 0, 0.025);
}
.notif-item-title-row {
    display: block;
    line-height: 1.35;
}
.notif-item-title {
    font-weight: 600;
    color: var(--text-strong, #1f2937);
}
.notif-unread-pill {
    display: inline-block;
    background-color: #15803d;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 0.4rem;
    vertical-align: 0.15em;
}

.auth-body { background-color: var(--primary-color); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { height: 56px; width: auto; display: block; margin: 0 auto; }
.auth-logo-card { height: 36px; width: auto; display: block; margin: 0 auto 0.25rem; }

.alert { border-radius: var(--radius); }

.phase-chevron { font-size: 0.6rem; }

.detail-table { table-layout: auto; width: 100%; }
.detail-table > tbody > tr { display: block; padding: 0.45rem 0; }
.detail-table > tbody > tr > td {
    display: block;
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto;
}
.detail-table > tbody > tr > td:first-child,
.detail-table > tbody > tr > td.text-muted {
    color: #6b7280 !important;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    margin-bottom: 0.15rem;
}
.detail-table > tbody > tr > td:nth-child(2) {
    color: #111827;
    font-weight: 500;
    font-size: 0.875rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.card-body > .row:has(.detail-table) {
    --bs-gutter-x: 0;
    margin-left: 0;
    margin-right: 0;
}
.card-body > .row:has(.detail-table) > .col-md-6 {
    padding-left: 1rem;
    padding-right: 1.5rem;
}

.card-body:has(> .table-responsive:only-child),
.card-body:has(> table:only-child:not(.detail-table)) {
    padding: 0;
}
.card-body > .table-responsive:only-child > table,
.card-body > table:only-child {
    margin-bottom: 0 !important;
}
.card-body:has(> .table-responsive:only-child) th:first-child,
.card-body:has(> .table-responsive:only-child) td:first-child,
.card-body:has(> table:only-child) th:first-child,
.card-body:has(> table:only-child) td:first-child {
    padding-left: 1rem;
}
.card-body:has(> .table-responsive:only-child) th:last-child,
.card-body:has(> .table-responsive:only-child) td:last-child,
.card-body:has(> table:only-child) th:last-child,
.card-body:has(> table:only-child) td:last-child {
    padding-right: 1rem;
}
.card-body > .table-responsive:not(:only-child) {
    margin-left: -1rem;
    margin-right: -1rem;
}
.card-body > .table-responsive:not(:only-child):first-child {
    margin-top: -1rem;
}
.card-body > .table-responsive:not(:only-child):last-child {
    margin-bottom: -1rem;
}
.card-body > .table-responsive:not(:only-child) th:first-child,
.card-body > .table-responsive:not(:only-child) td:first-child,
.card-body .collapse .table-responsive th:first-child,
.card-body .collapse .table-responsive td:first-child {
    padding-left: 1rem;
}
.card-body > .table-responsive:not(:only-child) th:last-child,
.card-body > .table-responsive:not(:only-child) td:last-child,
.card-body .collapse .table-responsive th:last-child,
.card-body .collapse .table-responsive td:last-child {
    padding-right: 1rem;
}
.card-body .collapse .table-responsive {
    margin-left: -1rem;
    margin-right: -1rem;
}
.card-body .modal .table-responsive {
    margin: 0;
}

form.js-auto-filter button[type="submit"] {
    display: none !important;
}
.detail-table > tbody > tr:nth-child(even) > td,
.detail-table > tbody > tr:nth-child(odd) > td {
    background-color: transparent !important;
}
.detail-table > tbody > tr > td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.detail-table > tbody > tr:last-child > td {
    border-bottom: 0;
}
.pre-wrap-sm { font-size: 0.875rem; }

.compliance-tight { font-size: 0.72rem; }
.compliance-tight-pre { font-size: 0.72rem; white-space: pre-wrap; }
.compliance-evidence {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.15rem 0.75rem;
    font-size: 0.78rem;
    margin: 0;
}
.compliance-evidence dt {
    color: var(--text-muted);
    font-weight: 500;
}
.compliance-evidence dd {
    margin: 0;
    color: #1f2937;
}

.compliance-controls-scroll {
    max-height: 60vh;
    min-height: 320px;
    overflow: auto;
}
.compliance-controls-scroll table {
    table-layout: fixed;
    width: 100%;
}
.compliance-controls-scroll table tbody td,
.compliance-controls-scroll table thead th {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.compliance-controls-scroll thead.sticky-top th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #475569;
    color: #fff;
}

.messages-region {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    z-index: 6;
    padding: 0.75rem var(--main-content-padding) 0;
    background: var(--bg-color);
}
.messages-region > .alert { margin-bottom: 0.5rem; }
.messages-region > .alert:last-child { margin-bottom: 0; }
.messages-region:not(:has(.alert)) { display: none; }
body:has(.messages-region) .main-content {
    margin-top: calc(var(--header-height) + var(--messages-region-height, 0px));
    height: calc(100vh - var(--header-height) - var(--messages-region-height, 0px));
}

.toast-region {
    position: fixed;
    top: calc(var(--header-height) + 0.75rem);
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 360px;
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(13, 27, 42, 0.18);
    border: 1px solid var(--border-default, #e5e7eb);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.75rem 0.85rem;
    animation: toast-in 200ms ease-out;
}
.toast-item.toast-leaving { animation: toast-out 200ms ease-in forwards; }
@keyframes toast-in {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toast-out {
    to   { transform: translateX(110%); opacity: 0; }
}
.toast-icon {
    font-size: 1.1rem;
    line-height: 1.225rem;
    flex-shrink: 0;
}
.toast-icon i { display: block; line-height: inherit; }
.toast-success .toast-icon { color: #065f46; }
.toast-danger  .toast-icon { color: #991b1b; }
.toast-warning .toast-icon { color: #92400e; }
.toast-info    .toast-icon { color: #1e40af; }
.toast-body {
    flex: 1 1 auto;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--text-strong, #1f2937);
    min-width: 0;
    word-wrap: break-word;
}
.toast-close {
    background: transparent;
    border: 0;
    color: var(--text-muted, #6c757d);
    cursor: pointer;
    flex-shrink: 0;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.toast-close i { font-size: 0.95rem; line-height: 1; display: block; }
.toast-close:hover { color: var(--text-strong, #1f2937); background-color: rgba(0,0,0,0.06); }
.toast-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
}
.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toast-countdown var(--toast-duration, 30s) linear forwards;
}
.toast-success .toast-progress-bar { background: #10b981; }
.toast-danger  .toast-progress-bar { background: #ef4444; }
.toast-warning .toast-progress-bar { background: #f59e0b; }
.toast-info    .toast-progress-bar { background: #3b82f6; }
@keyframes toast-countdown {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
.toast-item:hover .toast-progress-bar { animation-play-state: paused; }

.client-ip-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--primary-color);
    line-height: 1.5;
}
.client-ip-banner > i {
    color: var(--accent-color);
    font-size: 1rem;
    flex-shrink: 0;
}
.client-ip-banner code {
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: var(--radius);
    color: #c0367a;
    font-size: 0.8125rem;
}
.client-ip-banner .badge {
    vertical-align: 1px;
}
.client-ip-banner-secondary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.client-ip-banner-secondary > i {
    color: var(--accent-color);
    flex-shrink: 0;
}
.client-ip-banner-hint {
    color: var(--text-muted);
    margin-left: 0.35rem;
}
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(13, 27, 42, 0.28);
    overflow: hidden;
}
.modal-header {
    background-color: var(--surface-tonal);
    border-bottom: 1px solid rgba(13, 27, 42, 0.07);
    padding: 1rem 1.35rem;
}
.modal-header .modal-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
    letter-spacing: -0.01em;
}
.modal-header .btn-close {
    padding: 0.55rem;
    margin: -0.4rem -0.5rem -0.4rem auto;
    border-radius: 8px;
    opacity: 0.5;
    transition: opacity 0.12s ease, background-color 0.12s ease;
}
.modal-header .btn-close:hover { opacity: 0.9; background-color: rgba(13, 27, 42, 0.07); }
.modal-body {
    font-size: 0.875rem;
    color: #374151;
    padding: 1.35rem;
    background-color: #fff;
}
.modal-backdrop.show { opacity: 0.42; }
.modal.show { backdrop-filter: none; }
@supports (backdrop-filter: blur(2px)) {
    .modal-backdrop.show { backdrop-filter: blur(2px); }
}
.modal-footer {
    background-color: var(--surface-tonal);
    border-top: none;
    padding: 0.7rem 1.15rem;
    gap: 0.4rem;
}
.modal-footer > * { margin: 0; }
.modal-header .btn-close {
    transition: opacity 120ms ease, background-color 120ms ease;
    border-radius: 4px;
    padding: 0.4rem;
}
.dropdown-menu { border-radius: var(--radius); }
.badge {
    border-radius: var(--radius);
    font-weight: 500;
    letter-spacing: 0.02em;
    font-size: 0.72rem;
    padding: 0.28rem 0.55rem;
    line-height: 1.2;
    vertical-align: middle;
    min-width: 2.4ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #cbd5e1;
    color: #415a77;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
}
.avatar-sm { width: 22px; height: 22px; font-size: 0.6rem; }
.avatar-lg { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 100%;
    vertical-align: middle;
}
.avatar-user-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-strong, #1f2937);
}
.avatar.avatar-inactive {
    opacity: 0.55;
    border: 1px dashed #9ca3af;
}
.avatar-user-text-inactive {
    color: var(--text-muted, #6c757d);
    text-decoration: line-through;
    text-decoration-color: rgba(0, 0, 0, 0.25);
}

.skeleton-row td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.skeleton-bar {
    display: block;
    height: 0.7rem;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite linear;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


.badge.bg-success      { background-color: #d1fae5 !important; color: #065f46; }
.badge.bg-danger       { background-color: #fee2e2 !important; color: #991b1b; }
.badge.bg-warning      { background-color: #fef3c7 !important; color: #78350f; }
.badge.bg-info         { background-color: #dbeafe !important; color: #1e40af; }
.badge.bg-primary      { background-color: rgba(65, 90, 119, 0.15) !important; color: #1b263b; }
.badge.bg-secondary    { background-color: #e5e7eb !important; color: #374151; }
.badge-role { font-size: 0.75rem; padding: 0.35rem 0.65rem; }
.badge-xs { font-size: 0.72rem; padding: 0.28rem 0.55rem; }
.qms-flags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qms-plus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #5b6675;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}
.qms-plus-btn:hover, .qms-plus-btn:focus-visible {
    background: #e5eaf1;
    color: var(--accent-color, #415a77);
}
.qms-plus-btn:active { background: #d3dbe6; }
.qms-plus-inline {
    width: auto;
    height: auto;
    margin-left: 0.6rem;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    vertical-align: baseline;
    border-radius: 6px;
    padding: 0.05rem 0.25rem;
}
.nav-user-menu .bi-person-circle { font-size: 1.15rem; }
.user-menu-dropdown { min-width: 280px; }
.user-menu-dropdown .dropdown-item.small { padding-top: 0.4rem; padding-bottom: 0.4rem; }
.rel-graph-container { min-height: 180px; overflow: auto; }
.rel-graph-mermaid { background: transparent; border: 0; padding: 0; margin: 0; text-align: center; }
.rel-graph-container g.node.rel-graph-clickable { cursor: pointer; }
.rel-graph-container g.node.rel-graph-clickable:hover rect { filter: brightness(0.96); }
.qms-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: #a9c4e2;
    box-shadow: 0 0 6px rgba(169, 196, 226, 0.55);
    z-index: 3000;
    transition: width 18s cubic-bezier(0.03, 0.75, 0.1, 1);
    pointer-events: none;
}
.qms-nav-progress-go { width: 92%; }
.qms-nav-progress-done {
    width: 100% !important;
    opacity: 0;
    transition: width 0.15s ease-out, opacity 0.3s ease 0.15s;
}
.badge + a,
a + .badge {
    vertical-align: middle;
}

.card-body > .border-bottom.py-2,
#esigList > .border-bottom {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
    padding-block: 0.65rem !important;
}
.card-body > .border-bottom.py-2:last-child,
#esigList > .border-bottom:last-child {
    border-bottom: 0 !important;
}

.badge.bg-info,
.badge.bg-primary,
.badge.bg-light,
.badge.bg-dark { background-color: #6c757d !important; color: #fff !important; }
.badge.bg-light { color: #fff !important; }

.phase-stepper .badge {
    border: 1px solid transparent;
    font-weight: 600;
}
.phase-stepper .badge.bg-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border-color: #a7f3d0 !important;
}
.phase-stepper .badge.bg-primary {
    background-color: var(--accent-color) !important;
    color: #fff !important;
    border-color: var(--accent-color) !important;
}
.phase-stepper .badge.bg-light {
    background-color: #f1f3f5 !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
}

.billing-audit-scroll { max-height: 200px; overflow-y: auto; }

.toast { border-radius: var(--radius); }

.qms-inline-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    border-left: 3px solid transparent;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}
.qms-inline-alert i { font-size: 1rem; flex-shrink: 0; }
.qms-inline-alert-success {
    background-color: #ecfdf5;
    border-left-color: #10b981;
    color: #065f46;
}
.qms-inline-alert-success i { color: #10b981; }
.qms-inline-alert-danger {
    background-color: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}
.qms-inline-alert-danger i { color: #ef4444; }
.qms-inline-alert-info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}
.qms-inline-alert-info i { color: #3b82f6; }
.qms-inline-alert-warning {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}
.qms-inline-alert-warning i { color: #f59e0b; }

.stat-card {
    background-color: var(--card-bg);
    position: relative;
    height: 100%;
}
.stat-card .card-body { padding: 0.875rem 1rem; }

.stat-card .stat-card-icon {
    position: absolute;
    top: 0.625rem;
    left: 0.75rem;
    font-size: 1rem;
    color: var(--text-muted, #6c757d);
    opacity: 0.7;
    line-height: 1;
}

.stat-card .badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    margin: 0;
}
.stat-card.status-good,
.stat-card.status-warn,
.stat-card.status-bad { }

.metric-lg {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.metric-md {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}
.icon-lg {
    font-size: 1.5rem;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid #e5e7eb;
}
.table-controls .item-count {
    font-weight: 500;
}

.card:has(> .card-body > form[method="get"]) {
    background-color: transparent;
    border: none;
    box-shadow: none;
}
.card:has(> .card-body > form[method="get"]) > .card-body {
    padding: 0;
}
.table-controls .table-controls-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
}
.table-controls .table-controls-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}
.table-controls .table-controls-links {
    margin-left: auto;
    display: flex;
    gap: 0.85rem;
    align-items: center;
}
.table-controls .table-controls-links .table-controls-link {
    margin-left: 0;
}
.table-controls select {
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    color: #374151;
    background: #fff;
}
.table-controls .page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.table-controls .page-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.table-controls .page-nav a:hover {
    color: var(--accent-color);
}
.table-controls .page-nav .disabled {
    opacity: 0.4;
    pointer-events: none;
}

.page-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #fcfcfd;
}
.page-nav-bar .page-nav-count {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.pagination { margin-bottom: 0; }
.pagination .page-link {
    color: var(--accent-color);
    border-color: #e5e7eb;
    background-color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 31px;
    padding: 0.2rem 0.8rem;
    font-size: 0.8125rem;
    line-height: 1;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pagination .page-item:first-child .page-link { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.pagination .page-item:last-child .page-link { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.pagination .page-link:focus {
    box-shadow: none;
    z-index: 2;
}
.pagination .page-link:hover {
    color: #fff;
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}
.pagination .page-item.active .page-link {
    background-color: var(--surface-tonal, #f3f4f6);
    border-color: #e5e7eb;
    color: var(--primary-color);
    font-weight: 600;
    cursor: default;
    font-variant-numeric: tabular-nums;
}
.pagination .page-item.disabled .page-link {
    color: #b6bcc4;
    background-color: #fbfbfc;
    border-color: #eceef1;
    cursor: not-allowed;
}
.pagination .page-link i { font-size: 0.85rem; vertical-align: -1px; }

.main-content .filter-select,
.filter-select {
    width: 220px;
    min-width: 220px;
    display: inline-block;
}

.aligned-cols {
    table-layout: fixed;
}

.search-clear-wrap {
    position: relative;
    display: inline-block;
}
.search-clear-wrap > input {
    padding-right: 1.8rem;
}
.search-clear-wrap > input::-webkit-search-cancel-button,
.search-clear-wrap > input::-webkit-search-decoration,
.search-clear-wrap > input::-webkit-search-results-button,
.search-clear-wrap > input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.file-dropzone {
    display: block;
    border: 2px dashed var(--border-subtle, #ced4da);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    background-color: #fafbfc;
    transition: border-color 0.15s, background-color 0.15s;
    margin-bottom: 0.25rem;
}
.file-dropzone:hover { border-color: var(--accent-color); background-color: #f5f7fa; }
.file-dropzone.drag-over { border-color: var(--accent-color); background-color: rgba(65, 90, 119, 0.06); border-style: solid; }
.file-dropzone-icon { font-size: 1.6rem; color: var(--text-muted, #6c757d); line-height: 1; }
.file-dropzone-text { margin-top: 0.4rem; color: var(--text-muted, #6c757d); font-size: 0.85rem; }
.file-dropzone-text strong { color: var(--accent-color); font-weight: 600; }
.file-dropzone-selected {
    display: inline-block;
    margin-top: 0.6rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    background-color: #198754;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-all;
    max-width: 100%;
}
.file-dropzone-selected::before {
    content: '\F26B';
    font-family: 'bootstrap-icons';
    margin-right: 0.35rem;
    font-size: 0.85rem;
    vertical-align: -1px;
}
.file-dropzone-selected:empty { display: none; }
.file-dropzone-selected .file-dropzone-row {
    display: inline-flex;
    align-items: center;
    margin: 0.15rem 0.25rem 0.15rem 0;
    padding: 0.18rem 0.5rem;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    max-width: 100%;
    word-break: break-all;
}
.file-dropzone-selected.file-dropzone-error {
    background-color: #c53030;
    color: #fff;
}
.file-dropzone-selected.file-dropzone-error::before {
    content: '\F33B';
}

.file-dropzone-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.12s;
}
.file-dropzone-clear:hover {
    background: rgba(255, 255, 255, 0.4);
}
.file-dropzone-clear:focus {
    outline: 2px solid #fff;
    outline-offset: 1px;
}
.file-dropzone input[type="file"] { display: none; }

.search-clear-btn {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}
.search-clear-btn:hover {
    color: var(--accent-color);
    background: rgba(0, 0, 0, 0.04);
}
.search-clear-btn:focus {
    outline: 2px solid rgba(65, 90, 119, 0.35);
    outline-offset: 1px;
}

[data-auto-submit] .filter-busy {
    opacity: 0.7;
    pointer-events: none;
}

.page-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    margin: 0;
    padding: 0;
    border: 0;
    display: block;
    line-height: 1.3;
}
.page-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
    line-height: 1.2;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0 0 0.35rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1.2;
}
.back-link:hover { color: var(--accent-color); }
.back-link i { font-size: 0.75rem; }

.page-chrome:empty { display: none; }
.page-chrome {
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 1025;
    margin: calc(var(--main-content-padding, 1.5rem) * -1);
    margin-bottom: 0;
    padding: var(--main-content-padding, 1.5rem);
    padding-bottom: 0;
    max-width: none;
}

.page-header {
    margin: 0 0 1rem 0;
    padding: 0.5rem 0 0.6rem 0;
    border-bottom: 1px solid #d1d5db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-height: 42px;
}
.page-header .page-header-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 0;
}
.page-header > .btn,
.page-header > .page-header-actions {
    flex-shrink: 0;
    align-self: flex-start;
}
.page-header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.main-content-inner > h1.page-title:first-child,
.main-content-inner > .d-flex:first-child,
.main-content-inner > .back-link + .d-flex,
.main-content-inner > .back-link + h1.page-title {
    margin: 0 0 1rem 0;
    padding: 0.5rem 0 0.6rem 0;
    border-bottom: 1px solid #d1d5db;
    min-height: 42px;
}


.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--secondary-color);
    padding-top: 1rem;
    padding-bottom: 3rem;
    overflow-y: auto;
    overscroll-behavior: none;
}
.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.25rem;
    border-left: 3px solid transparent;
    font-size: 0.835rem;
}
.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
}
.sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
}
.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
    display: inline-block;
}
.sidebar .nav-section {
    padding: 16px 1.25rem 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
}
.sidebar .nav-section[data-bs-toggle="collapse"] { cursor: pointer; }
.sidebar .nav-section[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.2s;
}
.sidebar .nav-section[data-bs-toggle="collapse"].collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

.main-content.page-flex {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
.main-content.page-flex > .main-content-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.main-content.page-flex .tab-content,
.main-content.page-flex .scroll-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.main-content.page-flex .tab-pane.active,
.main-content.page-flex .tab-pane.show {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}
.main-content.page-flex .tab-pane > .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.main-content.page-flex .tab-pane > .row:has(> [class*="col"] > .scroll-card) {
    flex: 1 1 auto;
    min-height: 0;
    flex-wrap: nowrap;
}
.main-content.page-flex .tab-pane > .row > [class*="col"]:has(> .scroll-card) {
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.main-content.page-flex .scroll-card > .card-body,
.main-content.page-flex .scroll-card > .scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.main-content.page-flex .scroll-card .scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.main-content.page-flex .doc-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 1rem;
}
.doc-layout .doc-nav-col {
    flex: 0 0 240px;
    min-width: 0;
}
.doc-layout .doc-content-col {
    flex: 1 1 auto;
    min-width: 0;
}
.doc-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    background: #fff;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: .5rem;
    padding: .5rem;
    position: sticky;
    top: 0;
}
.doc-nav .doc-nav-link {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--text-color, #1b263b);
    padding: .5rem .75rem;
    border-radius: .375rem;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}
.doc-nav .doc-nav-link:hover {
    background: rgba(65, 90, 119, 0.08);
    color: var(--accent-color);
}
.doc-nav .doc-nav-link.active {
    background: var(--accent-color);
    color: #fff;
}

.main-content.page-flex > .main-content-inner > .card:has(.table-responsive):not(:has(~ .card)) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.main-content.page-flex > .main-content-inner > .card:has(.table-responsive):not(:has(~ .card)) > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.main-content.page-flex > .main-content-inner > .card:has(.table-responsive):not(:has(~ .card)) > .card-body > .table-responsive,
.main-content.page-flex > .main-content-inner > .card:has(> .table-responsive):not(:has(~ .card)) > .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding-bottom: 0.25rem;
}
.table-responsive .table {
    margin-bottom: 0;
}
.main-content.page-flex > .main-content-inner > .card:has(> .table-responsive):not(:has(~ .card)) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.main-content.page-flex .table-scroll-tall,
.main-content.page-flex .table-scroll {
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding-bottom: 0;
}

.scroll-body thead th,
.scroll-card thead th,
.table-scroll thead th,
.table-scroll-tall thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #475569;
    color: #fff;
}

.main-content.page-flex .tab-pane.active,
.main-content.page-flex .tab-pane.show.active {
    display: flex;
    flex-direction: column;
}

.main-content.page-flex .tab-pane.active > .card.scroll-card:only-child,
.main-content.page-flex .tab-pane.active > .card:only-child:has(.table-responsive),
.main-content.page-flex .tab-pane.active > .card:only-child:has(.scroll-body) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.main-content.page-flex .tab-pane.active > .card:only-child:has(.table-responsive) > .card-body,
.main-content.page-flex .tab-pane.active > .card.scroll-card:only-child > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.main-content.page-flex .tab-pane.active > .card:only-child > .card-body > .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
}
.main-content.page-flex .tab-pane.active > .card:only-child > .card-body.scroll-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    overscroll-behavior: contain;
    display: block;
    padding: 0;
}

.main-content.page-flex .tab-pane.active:not(:has(> .card:only-child .table-responsive)):not(:has(> .card:only-child .scroll-body)):not(:has(> .card.scroll-card:only-child)) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.main-content.page-flex > .main-content-inner > .page-header,
.main-content.page-flex > .main-content-inner > .nav-tabs,
.main-content.page-flex > .main-content-inner > .row,
.main-content.page-flex > .main-content-inner > .back-link,
.main-content.page-flex > .main-content-inner > .d-flex,
.main-content.page-flex > .main-content-inner > .card:not(.scroll-card) {
    flex: 0 0 auto;
}

.nav-tabs-sub {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.6rem;
    flex: 0 0 auto;
}
.nav-tabs-sub .nav-link {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    margin-bottom: -1px;
}
.nav-tabs-sub .nav-link:hover {
    color: var(--accent-color);
    background: transparent;
}
.nav-tabs-sub .nav-link.active {
    color: var(--primary-color);
    background-color: #fff;
    border-color: #e5e7eb #e5e7eb #fff;
}

.main-content.page-flex .tab-pane.active > .nav-tabs-sub {
    flex: 0 0 auto;
}
.main-content.page-flex .tab-pane.active > .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nav-tabs {
    border-bottom: 1px solid #d1d5db;
}
.nav-tabs .nav-link {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    margin-bottom: -1px;
    white-space: nowrap;
}
.nav-tabs .nav-link:hover {
    color: var(--accent-color);
    border-color: transparent;
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: #fff;
    border-color: #d1d5db #d1d5db #fff;
}
.nav-tabs .nav-link .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.45em;
    vertical-align: 1px;
    font-weight: 500;
}

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: none;
    min-width: 0;
}
.main-content-inner {
    padding: var(--main-content-padding);
    min-width: 0;
}
.main-content > *,
.main-content-inner > *:not(.page-chrome),
.main-content .tab-content,
.main-content .tab-pane,
.main-content .card-body {
    max-width: 100%;
    min-width: 0;
}
.main-content .row > [class*="col-"] {
    min-width: 0;
}

.login-header { padding: 1.5rem 1.5rem 0; text-align: center; }

.mp-scroll-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}
.table-responsive,
.scroll-body,
.table-scroll,
.table-scroll-tall,
.table-scroll-sm,
.notif-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.table-responsive::-webkit-scrollbar,
.scroll-body::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.table-scroll-tall::-webkit-scrollbar,
.table-scroll-sm::-webkit-scrollbar,
.notif-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.mp-scroll-wrap > .mp-scroller {
    overflow: auto !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
}
.mp-scroll-wrap.mp-has-v > .mp-scroller {
    padding-right: 14px !important;
}
.mp-scroll-wrap.mp-has-h > .mp-scroller {
    padding-bottom: 14px !important;
}
.mp-scroll-wrap > .mp-scroller::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
.mp-scroll-wrap > .mp-scroller .table {
    margin-bottom: 0;
}
.mp-sb {
    position: absolute;
    background: #eef0f2;
    z-index: 10;
    box-shadow: inset 0 0 0 1px #dadde0;
}
.mp-scroll-wrap > .mp-sb-v {
    top: 0;
    right: 0;
    width: 14px;
    height: calc(100% - 14px);
}
.mp-scroll-wrap > .mp-sb-h {
    left: 0;
    bottom: 0;
    height: 14px;
    width: calc(100% - 14px);
}
.mp-scroll-wrap > .mp-sb-corner {
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    background: #eef0f2;
    box-shadow: inset 0 0 0 1px #dadde0;
}
.mp-sb-thumb {
    position: absolute;
    background: #9aa0a6;
    border-radius: 5px;
    transition: background 0.12s ease;
    cursor: pointer;
}
.mp-sb-thumb:hover,
.mp-sb-thumb.mp-sb-dragging {
    background: #6c757d;
}
.mp-sb-v .mp-sb-thumb {
    left: 2px;
    width: 10px;
    min-height: 40px;
}
.mp-sb-h .mp-sb-thumb {
    top: 2px;
    height: 10px;
    min-width: 40px;
}

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track {
    background: #eef0f2;
    box-shadow: inset 0 0 0 1px #dadde0;
}
::-webkit-scrollbar-thumb {
    background: #9aa0a6;
    border-radius: 5px;
    border: 2px solid #eef0f2;
}
::-webkit-scrollbar-thumb:hover { background: #6c757d; }
::-webkit-scrollbar-corner {
    background: #eef0f2;
    box-shadow: inset 0 0 0 1px #dadde0;
}
* { scrollbar-width: thin; scrollbar-color: #9aa0a6 #eef0f2; }

.char-counter {
    font-size: 0.6rem;
    text-align: right;
    margin-top: 1px;
    line-height: 1;
    opacity: 0.45;
}

@media (max-width: 767.98px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .navbar-brand { font-size: 1rem; }
    .page-header,
    .main-content-inner > h1.page-title:first-child,
    .main-content-inner > .d-flex:first-child,
    .main-content-inner > .back-link + .d-flex,
    .main-content-inner > .back-link + h1.page-title {
        margin: 0 0 0.75rem 0;
        padding: 0.5rem 0 0.6rem 0;
    }
    .table-scroll, .table-scroll-tall {
        max-height: calc(100vh - 220px);
        min-height: 240px;
    }
}

.main-content .col-w-px-60, .col-w-px-60 { width: 60px; }
.main-content .col-w-px-80, .col-w-px-80 { width: 80px; }
.main-content .col-w-px-130, .col-w-px-130 { width: 130px; }
.main-content .col-w-px-160, .col-w-px-160 { width: 160px; min-width: 160px; }
.main-content .col-w-px-170, .col-w-px-170 { width: 170px; min-width: 170px; }
.main-content .col-w-px-175, .col-w-px-175 { width: 175px; min-width: 175px; }
.main-content .col-w-px-240, .col-w-px-240 { width: 240px; min-width: 240px; }
.main-content .col-w-px-220, .col-w-px-220 { width: 220px; min-width: 220px; }
.main-content .col-w-px-260, .col-w-px-260 { width: 260px; min-width: 260px; }
.main-content input.col-w-px-160,
.main-content select.col-w-px-160 { width: 160px; min-width: 160px; display: inline-block; }
.main-content input.col-w-px-240,
.main-content select.col-w-px-240 { width: 240px; min-width: 240px; display: inline-block; }
.main-content input.col-w-px-220,
.main-content select.col-w-px-220 { width: 220px; min-width: 220px; display: inline-block; }
.main-content input.col-w-px-260,
.main-content select.col-w-px-260 { width: 260px; min-width: 260px; display: inline-block; }
.col-w-pct-5 { width: 5%; }
.col-w-pct-10 { width: 10%; }
.col-w-pct-12 { width: 12%; }
.col-w-pct-14 { width: 14%; }
.col-w-pct-18 { width: 18%; }
.col-w-pct-26 { width: 26%; }
.col-w-pct-40 { width: 40%; }

.progress-thin { height: 4px; }

.no-pointer-events { pointer-events: none; }

.tab-pane.fade { transition: none !important; }

.tab-pane > .card + .card,
.tab-pane > .card + form > .card,
.tab-pane > form > .card + .card,
.tab-pane > div > .card + .card { margin-top: 1rem; }

.has-char-counter { position: relative; padding-bottom: 1rem; }
.char-counter {
    position: absolute;
    right: 0.15rem;
    top: 100%;
    margin-top: -0.95rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
    pointer-events: none;
    line-height: 1.2;
    z-index: 2;
}
.char-counter.char-counter-warning { color: #b08800; }
.char-counter.char-counter-danger { color: #c53030; font-weight: 600; }

.attachment-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.attachment-row > .attachment-grow { flex: 1 1 240px; min-width: 240px; }

.share-list {
    max-height: 320px;
    min-height: 120px;
    overflow-y: auto;
    background: #fff;
}
.share-list:not([data-picker]) input[type="checkbox"] {
    width: 1em;
    height: 1em;
    margin: 0 0.5rem 0 0;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    position: relative;
    vertical-align: middle;
}
.share-list:not([data-picker]) .form-check {
    padding-left: 0;
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0.15em;
}
.share-list:not([data-picker]) input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.share-list:not([data-picker]) input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}
.share-list:not([data-picker]) label,
.share-list:not([data-picker]) .form-check label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    line-height: 1.4;
}

.share-list[data-picker] {
    padding: 0.4rem !important;
    border-color: var(--border-default) !important;
}
.share-list[data-picker] .picker-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem;
    margin: 0 0 0.25rem 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
}
.share-list[data-picker] .picker-row:last-child {
    margin-bottom: 0;
}
.share-list[data-picker] .picker-row:hover {
    background-color: var(--surface-2);
    border-color: var(--border-subtle);
    box-shadow: 0 1px 3px rgba(13, 27, 42, 0.07);
}
.share-list[data-picker] .picker-row.is-selected {
    background-color: #e8eef5;
    border-color: rgba(65, 90, 119, 0.4);
    box-shadow: inset 3px 0 0 var(--accent-color, #415a77);
}
.share-list[data-picker] .picker-row.is-selected:hover {
    background-color: #dfe8f1;
    box-shadow: inset 3px 0 0 var(--accent-color, #415a77),
                0 1px 3px rgba(13, 27, 42, 0.07);
}
.share-list[data-picker] .picker-row::after {
    content: "";
    order: 2;
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    border: 1px solid var(--border-strong, #b9c1cc);
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.75rem;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.12s ease, transform 0.12s ease,
                background-color 0.12s ease, border-color 0.12s ease;
}
.share-list[data-picker] .picker-row:hover::after {
    opacity: 0.55;
    transform: scale(1);
}
.share-list[data-picker] .picker-row.is-selected::after {
    opacity: 1;
    transform: scale(1);
    background-color: var(--accent-color, #415a77);
    border-color: var(--accent-color, #415a77);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3E%3C/svg%3E");
}
.share-list[data-picker].is-sequential .picker-row.is-selected::after {
    opacity: 0;
    transform: scale(0.7);
    background-color: transparent;
    background-image: none;
    border-color: transparent;
}
.share-list[data-picker] .picker-row[draggable="true"] {
    cursor: grab;
}
.share-list[data-picker] .picker-row.picker-dragging {
    opacity: 0.92;
    cursor: grabbing;
    border-style: dashed;
    border-color: var(--accent-color, #415a77);
    background-color: #dfe8f1;
    box-shadow: 0 6px 16px rgba(13, 27, 42, 0.16);
}
.share-list[data-picker] .picker-input-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    margin: -1px;
    padding: 0;
    border: 0;
}
.share-list[data-picker] .picker-drag-handle {
    color: var(--text-muted, #6c757d);
    user-select: none;
    padding: 0 0.1rem;
    cursor: grab;
    display: inline-flex;
    align-items: center;
    visibility: hidden;
    flex: 0 0 auto;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.35;
    transition: opacity 0.12s ease, color 0.12s ease;
    order: 3;
}
.share-list[data-picker].is-sequential .picker-row.is-selected .picker-drag-handle {
    visibility: visible;
}
.share-list[data-picker].is-sequential .picker-row.is-selected:hover .picker-drag-handle {
    opacity: 1;
    color: var(--accent-color, #415a77);
}
.share-list[data-picker] .picker-order-badge {
    display: none;
}
.share-list[data-picker] .picker-label {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    margin: 0;
    cursor: pointer;
    order: 1;
    min-width: 0;
}
.share-list[data-picker] .picker-row .avatar-user-text {
    color: #4b5563;
    transition: color 0.12s ease;
}
.share-list[data-picker] .picker-row.is-selected .avatar-user-text {
    color: #1f2937;
}
.share-list[data-picker] .picker-row.is-selected .picker-label {
    font-weight: 500;
}
.share-list[data-picker] .picker-email {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted, #6c757d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 4 auto;
    min-width: 0;
}
.share-list[data-picker] .picker-label .avatar-user {
    flex: 0 1 auto;
}
.share-list[data-picker] .picker-order-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background-color: var(--accent-color, #415a77);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    margin-right: 0.45rem;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.share-list[data-picker] .picker-remove {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    background: transparent;
    color: var(--text-muted, #6c757d);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    visibility: hidden;
    align-items: center;
    justify-content: center;
    transition: background-color 0.12s ease, color 0.12s ease;
    order: 4;
}
.share-list[data-picker] .picker-row.is-selected .picker-remove {
    visibility: visible;
}
.share-list[data-picker] .picker-remove:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}
.share-list[data-picker] .picker-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 100px;
    color: var(--text-muted, #6c757d);
    font-size: 0.8rem;
    text-align: center;
}
.share-list[data-picker] .picker-empty .bi {
    font-size: 1.3rem;
    opacity: 0.55;
}

.picker-card > .card-header {
    letter-spacing: 0.01em;
}
.picker-card > .card-header .bi {
    font-size: 0.9rem;
}

.qms-segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background-color: #eef1f5;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(67, 82, 107, 0.14);
}
.qms-segment {
    display: inline-flex;
    position: relative;
}
.qms-segment input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    margin: -1px;
    padding: 0;
    border: 0;
}
.qms-segment label {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    color: #475569;
    cursor: pointer;
    margin: 0;
    user-select: none;
    transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.qms-segment label:hover {
    color: var(--accent-color, #415a77);
}
.qms-segment input[type="radio"]:checked + label {
    background-color: var(--accent-color, #415a77);
    color: #fff;
    box-shadow: 0 1px 2px rgba(13, 27, 42, 0.18);
}
.qms-segment input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--accent-color, #415a77);
    outline-offset: 1px;
}

input.qms-datepicker {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236c757d'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 14px 14px;
    padding-right: 2.1rem;
    cursor: pointer;
}
input.qms-datepicker:hover {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23415a77'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1H2zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5z'/%3E%3C/svg%3E");
}

.flatpickr-calendar.quiance-theme {
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px rgba(13, 27, 42, 0.06),
                0 4px 12px rgba(13, 27, 42, 0.10),
                0 8px 24px rgba(13, 27, 42, 0.06);
    border: none;
}
.flatpickr-calendar.quiance-theme .flatpickr-day.selected,
.flatpickr-calendar.quiance-theme .flatpickr-day.startRange,
.flatpickr-calendar.quiance-theme .flatpickr-day.endRange,
.flatpickr-calendar.quiance-theme .flatpickr-day.selected:hover,
.flatpickr-calendar.quiance-theme .flatpickr-day.startRange:hover,
.flatpickr-calendar.quiance-theme .flatpickr-day.endRange:hover {
    background: var(--accent-color, #415a77);
    border-color: var(--accent-color, #415a77);
    color: #fff;
}
.flatpickr-calendar.quiance-theme .flatpickr-day.today {
    border-color: var(--accent-color, #415a77);
}
.flatpickr-calendar.quiance-theme .flatpickr-day.today:hover {
    background: var(--accent-color, #415a77);
    color: #fff;
}
.flatpickr-calendar.quiance-theme .flatpickr-day:hover,
.flatpickr-calendar.quiance-theme .flatpickr-day:focus {
    background: #f1f5f9;
    border-color: #f1f5f9;
}
.flatpickr-calendar.quiance-theme .flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-calendar.quiance-theme .flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--accent-color, #415a77);
}
.flatpickr-calendar.quiance-theme .flatpickr-current-month .numInputWrapper:hover,
.flatpickr-calendar.quiance-theme .flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: #f1f5f9;
}
.flatpickr-calendar.quiance-theme .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background-color: #fff;
}

.qms-checkbox-list > div {
    margin: 0;
    padding: 0.5rem 0.75rem;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
}
.qms-checkbox-list > div > div {
    padding: 0.15rem 0;
}
.qms-checkbox-list > div > div > label {
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    line-height: 1.4;
}
.qms-checkbox-list input[type="checkbox"] {
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    position: relative;
    vertical-align: middle;
}
.qms-checkbox-list input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.qms-checkbox-list input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}


.qms-impersonation-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .4rem 1rem;
    background: #1b263b;
    color: #fff;
    font-size: .85rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,.25);
}
.qms-impersonation-bar .qms-imp-label { display: inline-flex; align-items: center; }
.qms-impersonation-bar .qms-imp-exit { white-space: nowrap; }
body:has(.qms-impersonation-bar) .main-content { padding-bottom: 3rem; }

.risk-matrix { border-collapse: collapse; }
.risk-matrix th, .risk-matrix td { border: 1px solid var(--card-border); text-align: center; padding: 8px; min-width: 56px; height: 56px; }
.risk-matrix .axis { font-weight: 600; color: var(--text-secondary); background: var(--surface-1); }
.risk-matrix .cell { font-weight: 600; }
.risk-matrix .cell.low,
.risk-badge-low { background: #d1fae5; color: #065f46; }
.risk-matrix .cell.medium,
.risk-badge-medium { background: #fef3c7; color: #78350f; }
.risk-matrix .cell.high,
.risk-badge-high { background: #fed7aa; color: #7c2d12; }
.risk-matrix .cell.critical,
.risk-badge-critical { background: #fecaca; color: #7f1d1d; }
.risk-matrix .cell.empty { color: var(--text-muted); font-weight: 400; }

.qms-btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.qms-btn-loading > * { visibility: hidden; }
.qms-btn-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid rgba(120, 130, 145, 0.45);
    border-top-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    animation: qms-btn-spin 0.7s linear infinite;
}
@keyframes qms-btn-spin { to { transform: rotate(360deg); } }

.qms-inline-create .flex-grow-1 { min-width: 0; }
.ts-wrapper { max-width: 100%; }
.ts-wrapper.single .ts-control { overflow: hidden; }

.ts-dropdown-content { scroll-behavior: auto !important; }

.modal.fade { transition: opacity 0.12s linear; }
.modal.fade .modal-dialog {
    transition: transform 0.14s ease-out, opacity 0.14s ease-out;
    transform: scale(0.97);
    opacity: 0;
}
.modal.show .modal-dialog { transform: none; opacity: 1; }
.modal-backdrop.fade { transition: opacity 0.12s linear; }

.modal-xl { --bs-modal-width: min(1240px, 94vw); }
.modal-dialog.qms-modal-tall .modal-content { height: min(88vh, 900px); }

#recordPeekModal .record-peek-content form { pointer-events: none; }
#recordPeekModal .record-peek-content input,
#recordPeekModal .record-peek-content select,
#recordPeekModal .record-peek-content textarea,
#recordPeekModal .record-peek-content button,
#recordPeekModal .record-peek-content a[data-bs-toggle="modal"] {
    pointer-events: none;
    opacity: 0.6;
}
#recordPeekModal .record-peek-content form a:not([data-bs-toggle="modal"]) { pointer-events: auto; }
#recordPeekModal .record-peek-content [data-bs-toggle="tab"],
#recordPeekModal .record-peek-content [data-bs-toggle="collapse"],
#recordPeekModal .record-peek-content .qms-popinfo-trigger {
    pointer-events: auto;
    opacity: 1;
}
#recordPeekModal .record-peek-content .page-chrome {
    position: static;
    margin: 0;
    padding: 0;
    z-index: auto;
}
#recordPeekModal .modal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#recordPeekModal .modal-dialog-scrollable .modal-content { overflow: hidden; }
#recordPeekModal .modal-dialog-scrollable .modal-body { overflow-y: auto; }

.rel-graph-dialog { max-width: 520px; }

.modal .modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - var(--bs-modal-margin, 1.75rem) * 2);
}

.rel-graph-empty-icon { font-size: 2.4rem; color: #c3ccd8; }
.rel-graph-empty-text { max-width: 340px; }

.qms-link-results {
    height: 240px;
    overflow-y: auto;
}

.modal-footer .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.qms-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 8px;
    color: #5b6675;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}
.qms-icon-btn:hover, .qms-icon-btn:focus-visible {
    background: #eef1f5;
    color: var(--accent-color, #415a77);
}

.doc-folder-tile {
    color: var(--text-color);
    transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.doc-folder-tile:hover {
    color: var(--text-color);
    box-shadow: 0 3px 10px rgba(27, 38, 59, 0.12);
    transform: translateY(-1px);
}
.doc-folder-hit {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color), 0 3px 10px rgba(27, 38, 59, 0.1);
}
.doc-folder-hit .doc-folder-icon { color: var(--accent-color); }
.doc-folder-hit .badge-count {
    background-color: var(--accent-color);
    color: #fff;
}
.doc-folder-miss { opacity: 0.45; }
.doc-folder-miss:hover { opacity: 0.8; }
.doc-folder-icon {
    font-size: 1.6rem;
    color: var(--accent-color);
    flex-shrink: 0;
}
.doc-folder-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.doc-folder-abbr {
    font-weight: 600;
    font-size: 0.9rem;
}
.doc-folder-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-folder-col[draggable="true"] { cursor: grab; }
.doc-folder-dragging { opacity: 0.5; }

.toast-item .toast-action {
    border: 0;
    background: transparent;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0 0.25rem;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.toast-item .toast-action:hover { color: #2e4058; }

.folder-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}
.folder-breadcrumb-back {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}
.folder-breadcrumb-back:hover { text-decoration: underline; }
.folder-breadcrumb-sep { color: var(--text-muted); }
.folder-breadcrumb-current { color: var(--text-color); font-weight: 600; }

.rel-graph-mermaid .node { cursor: pointer; }
.rel-graph-mermaid .node rect,
.rel-graph-mermaid .node path {
    transition: filter 0.12s ease;
}
.rel-graph-mermaid .node:hover rect,
.rel-graph-mermaid .node:hover path {
    filter: drop-shadow(0 2px 5px rgba(27, 38, 59, 0.25));
}

.qms-preview-dialog { height: calc(100vh - 3.5rem); }
.qms-preview-dialog .modal-content { height: 100%; }
.qms-preview-body {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}
.qms-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.qms-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.qms-preview-hint {
    opacity: 0;
    animation: qmsPreviewHint 0.3s ease 4s forwards;
}
@keyframes qmsPreviewHint {
    to { opacity: 1; }
}
