
/* Import base HTML element styles */
@import url('html.css');
@import url('utility.css');
@import url('icons.css');


/* Badges */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    line-height: 1.2;
}

.badge.red {
    background-color: var(--error-color);
    color: white;
}

.badge.blue {
    background-color: var(--primary-color);
    color: white;
}

/* Show only on mobile (see mobile.css for display within @media) */
.mobile-only {
    display: none !important;
}

/* Filter button badge – active filter count; used with .mobile-only for mobile-only display */
.dropdown-button,
button[id$="-filter-btn"] {
    position: relative;
}
/* Admin portal – account list columns (Account, Administrator, Users) */
.account-row-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 80px;
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.account-row-grid > div {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-row-grid > div:last-child {
    text-align: right;
    flex-shrink: 0;
}

.account-row-grid > div:first-child {
    display: flex;
    align-items: center;
}

.account-list-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--background-color);
}

.account-row .icon-account {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Admin portal – no page scroll, only tabulator scrolls */
body.admin-portal.overlay-page {
    overflow: hidden;
    height: 100vh;
}
body.admin-portal .admin-portal-container {
    width: auto;
    max-width: 1000px;
    height: calc(100vh - 64px);
    max-height: calc(100vh - 64px);
    overflow: hidden;
    margin: 32px auto;
}
.admin-portal-table-area {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}
.admin-portal-table-area .ot-tabulator-wrap {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
}
.admin-portal-footer {
    flex-shrink: 0;
    padding-top: 0.5rem;
    text-align: center;
}
.admin-portal-footer .icon-signout {
    margin-right: 0.35rem;
}


/* New JavaScript-Driven Combobox Component */


.ot-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 0;
    width: 100vw;
    max-width: 1800px;
    height: 100vh;
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}


/* Left Sidebar Navigation */
.ot-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.ot-sidebar {
    width: 200px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.ot-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 1rem 0;
}

.ot-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.ot-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.ot-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.ot-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.ot-sidebar-header {
    display: none;
}


/* Client page: Home link in sidebar header (above client name) - tab style without left border */
.ot-sidebar-home-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    background: var(--background-color);
    border-left: none;
    transition: background 0.2s ease;
}

.ot-sidebar-home-link:hover {
    background: #ebebeb;
}

.ot-sidebar-home-icon {
    width: 16px;
    height: 16px;
    margin-right: 0.75rem;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.ot-sidebar-home-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Client name below Home link: white background, top border */
.ot-sidebar-client-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    padding: 0.5rem 1.5rem;
    background: #fff;
    border-top: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ot-sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ot-sidebar-item:hover {
    background: rgba(25, 103, 210, 0.05);
    color: var(--primary-hover);
    border-left-color: rgba(25, 103, 210, 0.3);
}

.ot-sidebar-item:focus-visible {
    outline: 2px solid var(--primary-hover);
    outline-offset: -2px;
}

.ot-sidebar-item.active {
    background: rgba(25, 103, 210, 0.1);
    color: var(--primary-hover);
    border-left-color: var(--primary-hover);
}

.ot-sidebar-item-icon {
    width: 16px;
    height: 16px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.ot-sidebar-item-text {
    flex: 1;
}

.ot-sidebar-section {
    margin-bottom: 1rem;
}

.ot-sidebar-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ot-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ot-content-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem 0.5rem 1rem;
}

.ot-content-body.ot-no-scroll {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ot-content-body.ot-no-scroll > .flex-row {
    flex-shrink: 0;
}

.ot-scroll-container {
    max-height: calc(100vh - 115px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 20px 0;
}

.ot-header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 0.5rem;
    text-align: right;
}

.ot-account-name {
    text-align: right;
    margin-right: 0;
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.ot-user-name {
    font-size: 0.9rem;
    color: #666;
    text-align: right;
    display: block;
}


.ot-divider {
    border: none;
    border-bottom: 1px solid #eee;
    margin: 0 0 1.5rem 0;
    width: 100%;
}
.ot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.ot-header-title {
    display: none;
}

/* OTA level test bar – buttons 1–5 to simulate user levels (admin testing only) */
.ot-level-test-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 1rem;
}
.ot-level-test-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    background: #fff;
    color: #333;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ot-level-test-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}
.ot-level-test-btn-active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.ot-sub-header {
    text-align: center;
    font-size: 1.3em;
    font-weight: 500;
}

.ot-footer {
    background: none;
    border: none;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    position: relative;
}


.ot-link {
    cursor: pointer;
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: flex-start; 
    gap: 0.5rem;
}

.ot-mobile-menu-toggle {
    display: none;
}

/* .ot-icon-button styles moved to html.css with other button classes */


/* Loading State */
.ot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    height: 100%;
}

.ot-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ot-loading-sm {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--border-color);
    border-top-color: var(--primary-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* Modern Table Styles */
.ot-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid var(--border-color);    
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}
.ot-table.fixed {
    table-layout: fixed;
}

.ot-table thead {
    background: var(--background-color);
    border-bottom: 2px solid var(--border-color);
    border-top: 2px solid var(--border-color);
    font-weight: 600;
}

.ot-table tbody {
    border: 1px solid var(--border-color);
}
.ot-table tbody.top-border {
    border-top: 2px solid var(--border-color);
}
.ot-table tr.section-header {
    background: var(--background-color);
}

.ot-table th,
.ot-table td {
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}


.ot-table tbody tr:hover:not(.no-hover) {
    background-color: #f8f9fa;
}
.ot-table tbody.align-top td {
    vertical-align: top;
}



.ot-table.fixed th,
.ot-table.fixed td {
    vertical-align: middle;
}

/* Filter Controls */
.ot-filters {
    display: flex;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: visible;
}


/* ECharts styling */
#chart {
    max-width: 100%;
    height: auto;
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 400px;
}

.echarts-chart {
    width: 100%;
    height: 400px;
}

/* Button Group Styles */
.ot-icon-button,
.ot-button,
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.ot-button-group {
    display: inline-flex;
    flex-wrap: nowrap; /* buttons stay side by side, don't wrap to new rows */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: none;
    padding: 0 !important;
    width: max-content; /* group width matches content when space is available */
    max-width: 100%; /* respect parent container constraints - triggers wrapping when constrained */
    align-items: stretch; /* all buttons have equal height (match tallest button) */
}

.ot-button-group .ot-button {
    flex: 0 1 auto; /* buttons can shrink to allow wrapping when container is constrained */
    min-width: 0; /* allow button to shrink below content width when constrained */
    /* No max-width - buttons use available space, but wrap when container is constrained */
    /* height determined by content and align-items: stretch on parent makes all buttons equal height */
    display: flex;
    align-items: center; /* center content vertically within button */
    justify-content: center; /* center content horizontally within button */
    border: none;
    background: none;
    color: #222;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    box-shadow: none;
    border-radius: 0;
    outline: none;
    overflow: visible; /* ensure all text is visible */
}

/* Text wrapper inside button - allows proper wrapping */
.ot-button-group .ot-button > span {
    display: block; /* make span block-level for proper wrapping */
    word-wrap: normal; /* don't break words, even if long */
    overflow-wrap: normal; /* don't break words, even if long */
    word-break: normal; /* don't break words in the middle */
    white-space: normal; /* allow text wrapping at spaces only */
    text-align: center; /* center text */
    line-height: 1.4; /* better line height for wrapped text */
    min-width: 0; /* allow span to shrink when button is constrained */
    max-width: 100%; /* respect button width constraints - triggers wrapping when button is constrained */
}


/* Border between buttons - only on right side, not on last item */
.ot-button-group .ot-button:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.ot-button-group .ot-button.active,
.ot-button-group .ot-button:focus-visible {
    background: rgba(66, 133, 244, 0.25);
    color: var(--primary-hover);
    z-index: 1;
}

.ot-button-group .ot-button:hover:not(.active) {
    background: var(--primary-bg-light);
    color: var(--primary-hover);
}

/* Border radius on corners - first and last buttons */
.ot-button-group .ot-button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.ot-button-group .ot-button:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.ot-button-group .ot-button span[class^="icon-"] {
    display: inline-block;
    width: 24px;
    height: 24px;
    max-width: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Multi-select: multiple buttons can be .active */
.ot-button-group--multi .ot-button.active {
    background: rgba(66, 133, 244, 0.25);
    color: var(--primary-hover);
}

/* Dark variant: active buttons use solid primary/dark style (like button.dark) */
.ot-button-group--dark .ot-button.active,
.ot-button-group--dark.ot-button-group--multi .ot-button.active {
    background-color: var(--primary-color);
    color: #fff;
}

.ot-button-group--dark .ot-button.active:hover,
.ot-button-group--dark .ot-button.active:focus,
.ot-button-group--dark.ot-button-group--multi .ot-button.active:hover,
.ot-button-group--dark.ot-button-group--multi .ot-button.active:focus {
    background-color: var(--primary-hover);
    color: #fff;
}

.ot-button-group-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Chart control bar - single button group (type selector + Subscales toggle) */
.chart-control-bar.ot-button-group {
    display: inline-flex;
    align-items: stretch;
}

.chart-control-bar.ot-button-group .ot-button {
    padding: 0.35rem 0.5rem;
    min-height: 26px;
}

.chart-control-bar.ot-button-group .ot-button span[class^="icon-"] {
    width: 18px;
    height: 18px;
}

.chart-control-bar.ot-button-group .chart-control-bar-score-btn,
.chart-control-bar.ot-button-group .chart-control-bar-subscale-btn {
    font-size: 0.875rem;
}

/* Table styling for form field grids */
table.table-label-first-td td:first-child {
    text-align: right;
    padding-right: 0.5rem;
    white-space: nowrap;
}
table.table-label-first-td td:first-child span.icon-lock {
    margin-left: 0.5rem;
}

/* Search Box Component */
.search-box {
    position: relative;
    display: inline-block;
}

.search-box-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    z-index: 1;
    width: 16px;
    height: 16px;
    display: inline-block;
}

.search-box-input {
    padding-left: 34px !important;
    padding-right: 34px;
    max-width: 200px;
    width: auto;
    box-sizing: border-box;
    text-indent: 0;
}

.search-box-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    cursor: pointer;
    z-index: 2;
    width: 16px;
    height: 16px;
    display: inline-block;
    transition: color 0.2s ease;
}

.search-box-clear:hover {
    color: #333;
}

/* Chart respondent select — search-box variant with contact icon */
.search-box-with-icon select.chart-respondent-select {
    cursor: pointer;
    max-width: 240px;
    padding-right: 24px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    height: 28px;
    min-height: 28px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.8rem;
}

/* Date Field with Calendar Icon */
.date-field-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: top;
    line-height: 0;
    width: 130px;
}

.date-field-wrapper:has(.dateField[data-locked]),
.date-field-wrapper:has(input[data-locked]) {
    width: 150px;
}

.date-field-wrapper .dateField {
    padding-right: 24px;
    box-sizing: border-box;
    margin: 0;
    width: 100%;
}

.date-field-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.date-field-wrapper:has(.dateField[data-locked]) .date-field-icon,
.date-field-wrapper:has(input[data-locked]) .date-field-icon,
.date-field-wrapper:has(input:disabled) .date-field-icon {
    display: none;
}

/* Dashboard View Toggle */
/* Dashboard view containers - visibility controlled by PHP based on saved state */
#pending-container {
    /* display controlled by inline style from PHP */
}

#completed-container {
    /* display controlled by inline style from PHP */
}

/* Generic Scrollable Table Container - fills available space when tab has noScroll */
.scrollable-table-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
    overflow: hidden;
}

.ot-content-body.ot-no-scroll .scrollable-table-container {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
}

.scrollable-table-container .flex-row {
    flex-shrink: 0;
}

.scrollable-table-container .grid-table {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin: 0.5rem 0;
}

.scrollable-table-container .grid-table-header-alternate {
    flex-shrink: 0;
}

.scrollable-table-container .grid-table-header {
    flex-shrink: 0;
    display: table;
    width: 100%;
    table-layout: fixed;
    border-top: none !important;
    border-bottom: none !important;
}

.scrollable-table-container .grid-table-body-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: block;
}

.scrollable-table-container .grid-table-body-wrapper .grid-table-body {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    border: none !important;
    margin: 0;
    border-top: none !important;
}

/* When account-surveys injects a real <table>, let the body be block so it displays */
.scrollable-table-container .grid-table-body .account-surveys-data-table {
    display: table;
}
.scrollable-table-container .grid-table-body:has(.account-surveys-data-table),
.scrollable-table-container .grid-table-body.has-account-surveys-data {
    display: block !important;
    min-height: 2rem;
}

/* Show account-surveys table title (utility.css hides .grid-table-header-alternate globally) */
.scrollable-table-container .grid-table-header-alternate {
    display: block !important;
}

.client-surveys-pending-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.client-surveys-pending-options label {
    margin: 0;
    cursor: pointer;
}

.account-surveys-loading,
.account-surveys-placeholder {
    padding: 2rem;
    color: #666;
}

.account-surveys-filter-show-expired label {
    margin: 0 !important;
    cursor: pointer;
}
.account-surveys-filter-show-expired {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.account-surveys-filter-show-expired input[type="checkbox"] {
    margin: 0;
}
/* Dashboard pending filter: Expired + Dismissed checkboxes aligned */
.account-surveys-filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}
.account-surveys-filter-checkboxes .account-surveys-filter-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    cursor: pointer;
}
.account-surveys-filter-checkboxes .account-surveys-filter-label-inline input[type="checkbox"] {
    margin: 0;
}
/* Expired label + count badge grouped together */
.account-surveys-filter-option-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
}

/* Clients filter: Show Inactive checkbox (styled like account-surveys Show Expired minus badge) */
.clients-filter-checkboxes {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}
.clients-filter-checkboxes .clients-filter-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
}
.clients-filter-checkboxes .clients-filter-label-inline input[type="checkbox"] {
    margin: 0;
}

/* Users filter: Hide Active, Hide Pending, Show staff, Show revoked checkboxes */
.users-filter-checkboxes {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}
.users-filter-checkboxes .users-filter-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
}
.users-filter-checkboxes .users-filter-label-inline input[type="checkbox"] {
    margin: 0;
}
#users-level-wrap {
    padding: 0 !important;
}

/* Client Surveys page: filter bar (Survey, Instance, Show Dismissed, Apply, Reset) */
.client-surveys-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-left: auto;
}
.client-surveys-filter-label {
    font-size: 0.875rem;
    color: var(--text-muted-dark);
    margin: 0;
}
.client-surveys-filter-label-inline {
    font-size: 0.875rem;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.client-surveys-filter-label-inline input {
    margin: 0;
    vertical-align: middle;
}
/* Pending filter: checkbox options in a single column */
.client-surveys-filter-checkboxes {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}
.client-surveys-filter-checkboxes .client-surveys-filter-label-inline {
    display: inline-flex;
    align-items: center;
}
.client-surveys-filter-select {
    min-width: 120px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
}
.client-surveys-survey-link {
    cursor: pointer;
    text-decoration: underline;
}
.client-surveys-survey-link:hover {
    color: var(--primary-hover);
}
.client-surveys-filter-chips-visible {
    display: inline-flex;
}

/* ========== Global Tabulator (wrap, container, table) – body wrapper is in templates.css ========== */
.ot-tabulator-wrap,
.account-surveys-tabulator-wrap {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.ot-tabulator-container {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color) !important;
    overflow: hidden;
    background: #fff !important;
    display: flex;
    flex-direction: column;
}

.ot-tabulator-container .tabulator {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1;
    border: none;
    border-radius: 8px;
    background: #fff;
}

/* Tabulator overrides - prevents flicker when reloading data */
.tabulator {
    background-color: #fff !important;
}
.tabulator .tabulator-alert {
    display: none !important;
    background: transparent !important; 
}
.tabulator-row-even {
    background-color: #fff !important;
}
/* Survey lists: strikethrough for dismissed rows (client surveys + account-surveys pending) */
.tabulator-row.survey-row-dismissed .tabulator-cell,
.tabulator-row.survey-row-dismissed .tabulator-responsive-collapse-value {
    text-decoration: line-through;
    color: #888;
}

.tabulator-row.survey-row-upcoming {
    opacity: 0.6;
    cursor: default;
}
.tabulator-row.survey-row-upcoming:hover {
    background-color: inherit;
}


.ot-tabulator-container .tabulator-header {
    background-color: var(--background-light) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: #333;
    font-weight: 600;
}

.ot-tabulator-container .tabulator-header .tabulator-col:nth-last-child(2) {
    border-right: none !important;
}


.ot-tabulator-container .tabulator-header .tabulator-col {
    background-color: var(--background-light) !important;
    border: none !important;
    border-right: 1px solid var(--border-color) !important;
    padding: 0.5rem 1rem;
    padding-right: 1.75rem;
}

.ot-tabulator-container .tabulator-header .tabulator-col-content {
    padding: 0;
}

.ot-tabulator-container .tabulator-header .tabulator-col-title {
    padding: 0;
    padding-right: 0.25rem;
}

.ot-tabulator-container .tabulator-row,
.ot-tabulator-container .tabulator-row .tabulator-cell {
    cursor: default !important;
}

.ot-tabulator-container .tabulator-row:hover {
    background: var(--hover-bg) !important;
}

.ot-tabulator-container .tabulator-row .tabulator-cell {
    padding-top: 1rem;
    padding-bottom: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-bottom: 1px solid #eee;
    border-right: none;
    vertical-align: middle;
}

/* Compact tabulator variant — reduced padding for dense data (e.g. report tables) */
.ot-tabulator-compact .tabulator-header .tabulator-col {
    padding: 0.3rem 0.5rem !important;
    padding-right: 1rem !important;
}
.ot-tabulator-compact .tabulator-row .tabulator-cell {
    padding: 0.3rem 0.5rem !important;
}

/* Global: when collapse content is present, use collapse section border as full-width divider */
.ot-tabulator-container .tabulator-row.ot-tabulator-row-has-collapse-content > .tabulator-cell {
    border-bottom: none;
}

.ot-tabulator-container .tabulator-row:last-child .tabulator-cell {
    border-bottom: none;
}

/* Tabulator cell link-style: text looks like a link (underlined), only that cell is clickable and gets pointer */
.ot-tabulator-container .tabulator-cell .tabulator-cell-link-style {
    color: inherit;
    text-decoration: underline;
}

.ot-tabulator-container .tabulator-cell:has(.tabulator-cell-link-style) {
    cursor: pointer !important;
}

.ot-tabulator-container .tabulator-cell:has(.tabulator-cell-button) {
    padding: 12px 6px;
}

/* Whole row clickable (e.g. Clients tab): pointer on the row, not on individual cells */
.ot-tabulator-container.tabulator-whole-row-clickable .tabulator-row,
.ot-tabulator-container.tabulator-whole-row-clickable .tabulator-row .tabulator-cell {
    cursor: pointer !important;
}

/* List tabulators with clickable rows: Library, Reports, Export */
#library-tabulator-container .tabulator-row,
#library-tabulator-container .tabulator-row .tabulator-cell,
#report-tabulator-container .tabulator-row,
#report-tabulator-container .tabulator-row .tabulator-cell,
#export-tabulator-container .tabulator-row,
#export-tabulator-container .tabulator-row .tabulator-cell {
    cursor: pointer !important;
}

/* Library table: allow all cell content to wrap and let row height follow tallest cell */
#library-tabulator-container .tabulator-row .tabulator-cell {
    white-space: normal;
    text-overflow: clip;
    overflow: hidden;
    vertical-align: top;
}

#library-tabulator-container .tabulator-cell.library-resources-cell {
    vertical-align: top;
}

.library-id-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.library-id-cell .icon-survey {
    flex: 0 0 auto;
}

.ot-tabulator-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ot-tabulator-name-cell [class^="icon-"] {
    flex: 0 0 auto;
}

.library-resource-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    align-items: flex-start;
}

.library-resource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-align: left;
    padding: 0.25rem 0.5rem;
    font-size: inherit;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-color);
}

.library-resource-link:hover {
    background: #e8e8e8;
}

.library-resource-link .library-resource-link-text {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-resource-link span[class^="icon-"] {
    flex: 0 0 auto;
    margin-right: 0.1rem;
}

.library-resource-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background-color);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
}

.library-resource-add-btn:hover,
#library-tabulator-container .tabulator-row:hover .library-resource-add-btn {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.library-resource-add-btn:hover .icon-plus,
#library-tabulator-container .tabulator-row:hover .library-resource-add-btn .icon-plus {
    filter: brightness(0) invert(1);
}

/* Export table: cell wrap and alignment */
#export-tabulator-container .tabulator-row .tabulator-cell {
    white-space: normal;
    text-overflow: clip;
    overflow: hidden;
    vertical-align: top;
}

/* Export/Report modal: params containers must be transparent to the grid layout */
#expdef-params,
.report-section-grid-passthrough {
    display: contents;
}

/* Export modal: divider between saved params and runtime params */
.export-exec-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.5rem 0;
}

/* Export modal: date range inputs inline */
.export-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-date-input {
    width: 120px;
}


.ot-tabulator-container .tabulator-tableholder {
    background: #fff;
}
.ot-tabulator-container .tabulator-tableholder .tabulator-table {
    width: 100% !important;
    min-width: 100% !important;
    border: none;
}

.tabulator-responsive-collapse {
    border-top: 1px solid #f3f3f3 !important;
    border-bottom: 2px solid var(--border-color) !important;
}

/* Tabulator responsive-collapse: make collapsed column titles bold by default */
.tabulator-responsive-collapse .tabulator-responsive-collapse-title,
.tabulator-responsive-collapse table tr td:first-child {
    font-weight: 500;
    padding-left: 0.5rem;
}

/* Normalize Tabulator default collapse markup (<strong>) to global weight */
.tabulator-responsive-collapse .tabulator-responsive-collapse-title strong,
.tabulator-responsive-collapse table tr td:first-child strong {
    font-weight: inherit;
}

/* Collapsed header labels: add trailing colon */
.tabulator-responsive-collapse .tabulator-responsive-collapse-title::after,
.tabulator-responsive-collapse table tr td:first-child::after {
    content: ":";
    margin-left: 0.05rem;
}

/* Survey lists: row background by alert severity (generic; applies to any Tabulator survey list) */
.tabulator-row.survey-severity-low {
    background: color-mix(in srgb, var(--ot-yellow) 13%, transparent) !important;
}
.tabulator-row.survey-severity-low:hover {
    background: color-mix(in srgb, var(--ot-yellow) 22%, transparent) !important;
}
.tabulator-row.survey-severity-mid {
    background: color-mix(in srgb, var(--ot-orange) 13%, transparent) !important;
}
.tabulator-row.survey-severity-mid:hover {
    background: color-mix(in srgb, var(--ot-orange) 22%, transparent) !important;
}
.tabulator-row.survey-severity-high {
    background: color-mix(in srgb, var(--ot-red) 13%, transparent) !important;
}
.tabulator-row.survey-severity-high:hover {
    background: color-mix(in srgb, var(--ot-red) 22%, transparent) !important;
}


/* Client Summary: chart container (content inside template-component-card) */
.client-summary-chart-container {
    min-height: 280px;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
}

/* Back bar when viewing full chart in Summary tab — back left, chart toolbar right */
.client-summary-back-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    max-width: 1200px;
}
.client-summary-back-bar button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.client-summary-back-bar #client-full-chart-respondent-wrap {
    margin-left: auto;
}

/* Survey title above chart tabular view */
.chart-tabular-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem 0 0;
    text-align: center;
}

/* Client Summary: stats card content (layout in templates.css) */
.client-summary-stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1rem;
    align-items: center;
    text-align: center;
}

.client-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    text-align: center;
}

.client-summary-stat-separator {
    width: 80%;
    height: 0;
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.15rem auto;
    flex-shrink: 0;
}

.client-summary-stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.client-summary-stat-label {
    font-size: 0.8125rem;
    color: #666;
}

.client-summary-alert-breakdown {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    align-items: center;
}

.client-summary-alert-line {
    display: block;
}

.client-summary-stat-label.client-summary-alert-active,
.client-summary-stat-value.client-summary-alert-active {
    font-weight: bold;
    color: var(--error-color);
}

/* Client Summary: suicide risk gauge (card layout in templates.css) */
.client-summary-gauge-container {
    width: 300px;
    height: 200px;
    flex-shrink: 0;
    box-sizing: border-box;
    margin: 0 auto;
}

.client-summary-suicide-details {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
    overflow-y: auto;
}

.client-summary-suicide-no-data {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    font-size: 0.8125rem;
    color: #666;
    text-align: center;
}

.client-summary-suicide-source {
    padding: 0.5rem 0.75rem 0.75rem;
    font-size: 0.75rem;
    color: #666;
    background: var(--background-light);
}

.client-summary-suicide-source-row {
    margin-top: 0.25rem;
    line-height: 1.35;
}

.client-summary-suicide-source-row:first-child {
    margin-top: 0;
}

.client-summary-suicide-survey-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0;
}

.client-summary-suicide-source-label {
    font-weight: 600;
    color: #333;
    margin-right: 0.25rem;
}

.client-summary-suicide-message {
    font-weight: 500;
    color: #333;
}

/* Client Summary: alerts list (card layout in templates.css) */
.client-summary-alerts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.client-summary-alert-row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem;
    padding-right: 2.5rem;
    border-bottom: 1px solid #eee;
    border-left-width: 4px;
    border-left-style: solid;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #333;
}

.client-summary-alert-row:hover {
    filter: brightness(0.95);
}

.client-summary-alert-row:focus {
    outline: 2px solid var(--primary-hover);
    outline-offset: -2px;
}

/* Severity: Low / Moderate / High (match Alert Detail popup subheader colors) */
.client-summary-alert-row.client-summary-alert-severity-low {
    border-left-color: var(--ot-yellow-dark);
    background: color-mix(in srgb, var(--ot-yellow) 13%, transparent);
}

.client-summary-alert-row.client-summary-alert-severity-mid {
    border-left-color: var(--ot-orange);
    background: color-mix(in srgb, var(--ot-orange) 13%, transparent);
}

.client-summary-alert-row.client-summary-alert-severity-high {
    border-left-color: var(--ot-red);
    background: color-mix(in srgb, var(--ot-red) 13%, transparent);
}

/* Client Surveys tab: row background by alert severity (same as Summary Alerts) */
.grid-table-row.client-surveys-row-alert-severity-low {
    background: color-mix(in srgb, var(--ot-yellow) 13%, transparent);
}
.grid-table-row.client-surveys-row-alert-severity-low:hover {
    background: color-mix(in srgb, var(--ot-yellow) 22%, transparent);
}
.grid-table-row.client-surveys-row-alert-severity-mid {
    background: color-mix(in srgb, var(--ot-orange) 13%, transparent);
}
.grid-table-row.client-surveys-row-alert-severity-mid:hover {
    background: color-mix(in srgb, var(--ot-orange) 22%, transparent);
}
.grid-table-row.client-surveys-row-alert-severity-high {
    background: color-mix(in srgb, var(--ot-red) 13%, transparent);
}
.grid-table-row.client-surveys-row-alert-severity-high:hover {
    background: color-mix(in srgb, var(--ot-red) 22%, transparent);
}

/* Alert icon next to Instance on Client Surveys tab (single icon, no tiling) */
.client-surveys-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.25rem;
    padding: 0;
    border: none;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
}
.client-surveys-alert-icon:hover {
    opacity: 0.8;
}

#client-surveys-tabulator-container .tabulator-row {
    cursor: pointer;
}



.client-summary-alert-row > .template-chip {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.client-summary-alert-row .template-chip--success .template-chip__icon {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1) drop-shadow(0 0 1px rgba(0,0,0,0.3));
}

.client-summary-alert-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.client-summary-alert-date {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: #666;
}

.client-summary-alert-message {
    flex: 1 1 100%;
    min-width: 0;
}

.client-summary-alert-survey {
    flex: 0 0 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 0.75rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* View survey icon button (Suicide Risk card and Alerts list) */
.client-summary-view-survey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 0.25rem;
    padding: 0;
    border: none;
    background-color: transparent;
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    vertical-align: middle;
    cursor: pointer;
    flex-shrink: 0;
}
.client-summary-view-survey:hover {
    opacity: 0.8;
}

/* Survey instance popup mount (content rendered by survey.js) */
.survey-instance-mount {
    overflow: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 2rem;
}

.client-summary-alerts-no-data {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    font-size: 0.8125rem;
    color: #666;
    text-align: center;
}

/* Client summary — Programs card */
.client-summary-program-row {
    display: block;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.client-summary-program-row:last-child {
    border-bottom: none;
}
.client-summary-program-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.client-summary-program-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.client-summary-program-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
}
.client-summary-program-episode {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.client-summary-program-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.client-summary-program-dates {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Settings — Programs card rows */
#settings-access-programs-card > .template-component-card-body {
    padding: 0;
}
.settings-program-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.settings-program-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.settings-program-row-label {
    flex: 1 1 0;
    min-width: 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
}
.settings-program-row-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.settings-program-row-counts {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.settings-program-row--inactive {
    opacity: 0.55;
    font-style: italic;
}

/* Settings — Tags card */
#settings-tags-card > .template-component-card-body {
    padding: 0;
}
.settings-tag-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.settings-tag-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.settings-tag-row-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.settings-tag-row-counts {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.settings-tag-row--inactive {
    opacity: 0.55;
    font-style: italic;
}
.settings-tag-color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.settings-tag-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: border-color 0.15s;
}
.settings-tag-color-swatch:hover {
    border-color: var(--text-muted);
}
.settings-tag-color-swatch--selected {
    border-color: var(--text-color);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text-color);
}

/* Settings — Survey Series card */
#settings-series-card > .template-component-card-body {
    padding: 0;
}
.settings-series-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.settings-series-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.settings-series-row-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
}
.settings-series-row-surveys {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.settings-series-row-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.settings-series-row-chips {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding-top: 0.1rem;
}
.settings-series-row--inactive {
    opacity: 0.55;
    font-style: italic;
}

/* Popup header with close icon (used by alert modal) */
.popupBox-header-with-close {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.popupBox-header-title-text {
    flex: 1;
    min-width: 0;
}
.popupBox-header-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.popupBox-header-close .icon-close {
    display: block;
}
.popupBox-header-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
.popupBox-header-close:focus {
    outline: 2px solid var(--primary-hover);
    outline-offset: 2px;
}
.popupBox-header-close.popupBox-header-close-hidden {
    display: none;
}

/* Required field indicator: asterisk left of label when value needed (popupBox required: true) */
.popupBox-required-asterisk {
    margin-right: 0.2em;
    color: var(--error-color);
}
.popupBox-required-asterisk-hidden {
    visibility: hidden;
}

/* Client alert detail modal (globally accessible via App.openClientAlertModal) */
.alert-modal-detail {
    font-size: 0.875rem;
    color: #333;
}

.alert-modal-message {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.alert-modal-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.alert-modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.alert-modal-section strong {
    display: block;
    margin-bottom: 0.35rem;
    color: #333;
}
.alert-modal-source .alert-modal-source-row {
    margin-top: 0.25rem;
    line-height: 1.35;
}
.alert-modal-source .alert-modal-source-row:first-child {
    margin-top: 0;
}
.alert-modal-source-label {
    font-weight: 600;
    color: #333;
    margin-right: 0.25rem;
}
.alert-modal-view-survey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 0.35rem;
    padding: 0;
    border: none;
    background-color: transparent;
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    vertical-align: middle;
    cursor: pointer;
}
.alert-modal-view-survey:hover {
    opacity: 0.8;
}
.alert-modal-log-wrap {
    max-height: 200px;
    overflow-y: auto;
}
.alert-modal-log-list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}
.alert-modal-log-list li {
    margin-bottom: 0.25rem;
}
.alert-modal-log-event {
    list-style: disc;
}
.alert-modal-log-meta {
    font-size: 0.75rem;
    color: #666;
    display: block;
    margin-bottom: 0.15rem;
}
.alert-modal-log-empty {
    color: #666;
    font-style: italic;
}
.alert-modal-comment-input {
    width: 100%;
    margin: 0;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.875rem;
}
.alert-modal-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.alert-modal-log-header strong {
    margin-bottom: 0;
}
.alert-modal-survey-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.alert-modal-survey-link:hover {
    text-decoration: underline;
}
.alert-modal-survey-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-size: 14px 14px;
    vertical-align: middle;
    opacity: 0.7;
    flex-shrink: 0;
}
.alert-modal-survey-link:hover .alert-modal-survey-icon {
    opacity: 1;
}
.alert-modal-recipients-wrap {
    margin-top: 0.35rem;
}
.alert-modal-recipient-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: 0.8125rem;
    line-height: 1.35;
}
.alert-modal-recipient-name {
    flex: 1;
    min-width: 0;
}
.alert-modal-recipient-ack {
    color: var(--success-bg-text);
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}
.alert-modal-recipient-pending {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}
.alert-modal-recipient-email {
    font-size: 0.8125rem;
    color: var(--primary-color);
    cursor: default;
}

/* Surveys Completed color by percentage: >=80% green, 50-79% yellow, <50% red */
.client-summary-stat-value.client-summary-completion-high {
    color: #0d7a0d;
}

.client-summary-stat-value.client-summary-completion-mid {
    color: #b38600;
}

.client-summary-stat-value.client-summary-completion-low {
    color: var(--error-color);
}

/* Dashboard data table: column-def + data driven, no reliance on grid-table HTML */
.account-surveys-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    background: #fff;
}

.account-surveys-data-table th,
.account-surveys-data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.account-surveys-data-table th {
    font-weight: 600;
    background: var(--background-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.account-surveys-data-table tbody tr:hover {
    background: #f8f9fa;
}

.account-surveys-data-table td.hand {
    cursor: pointer;
}

.account-surveys-data-table .link {
    cursor: pointer;
    color: var(--primary-color);
}

.account-surveys-data-table .link:hover {
    text-decoration: underline;
}

.account-surveys-data-table tr.text-red {
    color: var(--error-color);
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-low {
    background: #fff8e6;
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-low:hover {
    background: #ffecb3;
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-mid {
    background: #ffe0b2;
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-mid:hover {
    background: #ffcc80;
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-high {
    background: #ffcdd2;
}

.account-surveys-data-table tr.client-surveys-row-alert-severity-high:hover {
    background: #ef9a9a;
}

.account-surveys-empty,
.account-surveys-error {
    padding: 1rem;
    margin: 0;
}

/* ========== Export tab ========== */
.export-form-wrap {
    padding: 1rem;
    max-width: 32rem;
}
.export-loading {
    margin: 0;
    color: var(--text-muted);
}
.export-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.export-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}
.export-form-row label {
    flex: 0 0 8rem;
    min-width: 6rem;
    padding-top: 0.35rem;
    font-weight: 500;
}
.export-form-field {
    flex: 1;
    min-width: 12rem;
}
.export-form-field select,
.export-form-field .export-filter-input,
.export-form-field .export-date-input {
    width: 100%;
    max-width: 20rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.export-date-range {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.export-date-range .export-date-input {
    max-width: 8rem;
}
.export-form-actions {
    margin-top: 0.5rem;
}
.export-form-actions .ot-button {
    min-width: 10rem;
}

/* Client Access and shared utilities */
.ot-muted {
    color: var(--text-muted);
    padding: 2rem;
}
.ot-client-access section {
    margin-bottom: 1.5rem;
}
.ot-client-access .ot-access-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ot-client-access .ot-access-list li {
    padding: 0.35rem 0;
}
.ot-client-access .ot-access-checkbox {
    margin-right: 0.5rem;
}

/* ── Narrative rich-text editor ──────────────────────────────────── */

.repsec-narrative-wrap {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: visible;
    position: relative;
    width: 100%;
}
.repsec-narrative-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: var(--background-color);
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
}
.repsec-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #444;
    padding: 0;
}
.repsec-tb-btn:hover {
    background: var(--border-color);
}
.repsec-tb-btn.repsec-tb-active {
    background: #d0d0d0;
}
.repsec-tb-divider {
    width: 1px;
    height: 18px;
    background: #ccc;
    margin: 0 4px;
}
.repsec-tb-spacer {
    flex: 1;
}
.repsec-narrative-editor {
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    outline: none;
}
.repsec-narrative-editor:empty::before {
    content: 'Enter narrative content\2026 use the placeholder icon to insert dynamic data.';
    color: #999;
    pointer-events: none;
}

/* Placeholder dropdown (top-right icon button) */
.repsec-ph-anchor {
    position: relative;
}
.repsec-ph-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 1000;
    width: max-content;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 0;
    margin-bottom: 4px;
}
.repsec-ph-dropdown--open {
    display: block;
}
.repsec-ph-group-label {
    padding: 6px 10px 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.03em;
}
.repsec-ph-item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 3px 10px;
    text-align: left;
    cursor: pointer;
    font-size: 0.8rem;
    color: #333;
}
.repsec-ph-item:hover {
    background: var(--primary-color);
    color: #fff;
}
.repsec-ph-item:hover .repsec-ph-label,
.repsec-ph-item:hover .repsec-ph-token,
.repsec-ph-item:hover .repsec-ph-bullet {
    color: #fff;
}
.repsec-ph-bullet {
    color: #999;
    font-size: 0.7rem;
    flex-shrink: 0;
}
.repsec-ph-label {
    font-size: 0.8rem;
    color: #333;
}
.repsec-ph-token {
    font-family: monospace;
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    margin-left: auto;
}

/* Narrative output (rendered report) */
.repsec-narrative-output {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Table truncation notice */
.repsec-table-notice {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #6d4c00;
}

/* ========== SysAdmin page ========== */

.sysadmin-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.sysadmin-nav {
    width: 220px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sysadmin-nav-header {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sysadmin-nav-list {
    display: flex;
    flex-direction: column;
}

.sysadmin-nav-item {
    display: block;
    padding: 0.6rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.sysadmin-nav-item:hover {
    background: var(--primary-bg-light);
    color: var(--primary-hover);
    border-left-color: rgba(25, 103, 210, 0.3);
}

.sysadmin-nav-item.active {
    background: var(--primary-light);
    color: var(--primary-hover);
    border-left-color: var(--primary-hover);
    font-weight: 500;
}

.sysadmin-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--background-light);
}

.sysadmin-panel-placeholder,
.sysadmin-panel-empty {
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.sysadmin-panel-error {
    padding: 2rem;
    color: var(--error-color);
}

.sysadmin-panel-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
}

.sysadmin-panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.sysadmin-panel-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sysadmin-panel-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.sysadmin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    background: #fff;
}

.sysadmin-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--primary-bg-light);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.sysadmin-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.sysadmin-table tbody tr:hover {
    background: var(--primary-bg-light);
}

.sysadmin-row-skipped td {
    text-decoration: line-through;
    color: var(--text-muted);
}

.sysadmin-panel-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

/* ========== Client Log page ========== */

.client-log-changes {
    margin-top: 4px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.client-log-change-row {
    padding: 1px 0;
}

.client-log-field {
    font-weight: 600;
    color: var(--text-color);
}

.client-log-old {
    text-decoration: line-through;
    color: var(--danger-text);
}

.client-log-new {
    color: var(--success-text);
}

/* ========== Assistant side panel ========== */

/* Header toggle button */
.ot-header-assistant-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    margin-left: 0.75rem;
    transition: background 0.15s, border-color 0.15s;
}
.ot-header-assistant-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}
.ot-header-assistant-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}
.ot-header-assistant-btn.active .icon-ai {
    filter: brightness(0) invert(1);
}

/* Overlay */
.assistant-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 999;
}
.assistant-overlay.open {
    display: block;
}

/* Panel */
.assistant-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.assistant-panel.open {
    transform: translateX(0);
}

/* Panel header */
.assistant-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.assistant-panel-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 1rem;
}
.assistant-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.assistant-model-select {
    font-size: 0.75rem;
    padding: 2px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    max-width: 140px;
    cursor: pointer;
}
.assistant-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
}
.assistant-panel-close:hover {
    background: #f0f0f0;
    color: var(--text-color);
}

/* Messages area */
.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assistant-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    flex: 1;
}

.assistant-welcome-icon {
    width: 48px;
    height: 48px;
    background-size: 48px 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.assistant-welcome h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-weight: 600;
}

.assistant-welcome p {
    margin: 0;
    font-size: 0.9rem;
}

/* Message bubbles */
.assistant-message {
    display: flex;
    flex-direction: column;
}

.assistant-message-user {
    align-items: flex-end;
}

.assistant-message-assistant {
    align-items: flex-start;
}

.assistant-bubble {
    max-width: 90%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.88rem;
    word-wrap: break-word;
}

.assistant-bubble-user {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.assistant-bubble-assistant {
    background: #f1f3f4;
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.assistant-bubble-assistant ul,
.assistant-bubble-assistant ol {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}

.assistant-bubble-assistant li {
    margin: 0.15rem 0;
}

.assistant-bubble-assistant strong {
    font-weight: 600;
}

.assistant-code-block {
    background: #263238;
    color: #eee;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.82rem;
    margin: 0.4rem 0;
}

.assistant-inline-code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.assistant-tools-used {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    padding-left: 0.2rem;
}

.assistant-thinking {
    color: var(--text-muted);
    font-style: italic;
}

.assistant-thinking-dots span {
    animation: assistantDot 1.4s infinite;
    opacity: 0;
}

.assistant-thinking-dots span:nth-child(1) { animation-delay: 0s; }
.assistant-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.assistant-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes assistantDot {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

/* Input area */
.assistant-input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.assistant-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.assistant-input-wrapper textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s;
    max-height: 120px;
}

.assistant-input-wrapper textarea:focus {
    border-color: var(--primary-color);
}

.assistant-input-wrapper textarea:disabled {
    background: #f5f5f5;
}

.assistant-input-wrapper .button {
    flex-shrink: 0;
    height: 36px;
}
