/* CaseHub — teal healthcare theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background-color: #f8fafc;
    color: #1e293b;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

/* ── Bootstrap primary override ── */
:root {
    --bs-primary: #32373C;
    --bs-primary-rgb: 26, 42, 74;
    --bs-link-color: #32373C;
    --bs-link-hover-color: #23272b;
}

a { color: #32373C; }
a:hover { color: #23272b; }

/* ── Buttons ── */
.btn-primary {
    background-color: #32373C;
    border-color: #32373C;
    border-radius: 6px;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: #23272b;
    border-color: #23272b;
}
.btn-outline-primary {
    color: #32373C;
    border-color: #32373C;
    border-radius: 6px;
}
.btn-outline-primary:hover {
    background-color: #32373C;
    border-color: #32373C;
    color: #fff;
}
.btn { border-radius: 6px; font-weight: 500; }

/* ── Cards ── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.card-header {
    background: linear-gradient(135deg, #32373C 0%, #23272b 100%);
    color: #fff;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
    padding: .75rem 1.25rem;
    border-bottom: none;
}
.card-header h5, .card-header h4, .card-header h3 { color: #fff; margin: 0; }
.card-header a { color: rgba(255,255,255,.85); }
.card-header a:hover { color: #fff; }

/* ── Tables ── */
.table-dark thead { background-color: #1e293b !important; }
.table thead th { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Nav section labels ── */
.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 1rem 1rem .25rem 1rem;
    user-select: none;
}

/* ── KPI cards ── */
.kpi-card {
    border-left: 4px solid #32373C;
    border-radius: 10px;
    background: #fff;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.kpi-card .kpi-value { font-size: 2rem; font-weight: 700; color: #32373C; line-height: 1; }
.kpi-card .kpi-label { font-size: .75rem; color: #64748b; margin-top: .25rem; }

/* ── Quick action buttons ── */
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: .75rem 1rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #32373C;
    text-decoration: none;
    font-size: .8rem;
    font-weight: 500;
    transition: all .15s;
    min-width: 90px;
}
.quick-action-btn:hover {
    background: #32373C;
    color: #fff;
    border-color: #32373C;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(50,55,60,.3);
}
.quick-action-btn svg, .quick-action-btn .icon { font-size: 1.4rem; }

/* ── Welcome banner ── */
.welcome-banner {
    background: linear-gradient(135deg, #32373C 0%, #23272b 100%);
    color: #fff;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.welcome-banner h2 { color: #fff; font-weight: 700; margin: 0 0 .25rem 0; }
.welcome-banner p { color: rgba(255,255,255,.85); margin: 0; }

/* ── Status badges ── */
.badge { border-radius: 20px; font-weight: 500; font-size: .72em; }

/* ── Form controls ── */
.form-control:focus, .form-select:focus {
    border-color: #32373C;
    box-shadow: 0 0 0 .2rem rgba(50,55,60,.25);
}

/* ── Validation ── */
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #32373C; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* ── Blazor error boundary ── */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

.darker-border-checkbox.form-check-input { border-color: #929292; }

/* ── Calendar grid ── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.calendar-day-header {
    background: #1e293b;
    color: #fff;
    text-align: center;
    padding: .4rem .25rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
}
.calendar-day {
    background: #fff;
    min-height: 80px;
    padding: .35rem .4rem;
    cursor: default;
}
.calendar-day.other-month { background: #f8fafc; color: #94a3b8; }
.calendar-day.today { background: #f0f4fa; }
.calendar-day-num {
    font-size: .8rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.6;
}
.calendar-day.today .calendar-day-num {
    background: #32373C;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
}
.cal-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #32373C;
    margin: 1px;
}
.cal-appt-label {
    font-size: .65rem;
    color: #23272b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    background: #f0f4fa;
    border-left: 2px solid #32373C;
    padding: 1px 3px;
    margin-top: 2px;
    border-radius: 2px;
}

/* ── Note type section ── */
.note-type-section {
    background: #f0f4fa;
    border: 1px solid #b8c7e0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.tracking-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}
.status-badge-top {
    display: inline-block;
    padding: .3em .8em;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}

/* ── Week Calendar View ── */
.week-calendar {
    overflow-x: auto;
}
.week-grid {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    min-width: 700px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.week-header-cell {
    background: #1e293b;
    color: #fff;
    text-align: center;
    padding: 8px 4px;
    font-size: .8rem;
    font-weight: 600;
    border-right: 1px solid #334155;
}
.week-header-cell.today-col {
    background: #32373C;
}
.week-time-label {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .7rem;
    color: #64748b;
    padding: 2px 4px;
    text-align: right;
    vertical-align: top;
    height: 48px;
    line-height: 48px;
}
.week-cell {
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    height: 48px;
    position: relative;
    padding: 2px;
}
.week-cell.today-col {
    background: #f0f4fa;
}
.week-appt-block {
    display: block;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: .65rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
    width: 100%;
    margin-bottom: 1px;
}
.week-appt-scheduled { background: #dbeafe; color: #1e40af; border-left: 3px solid #2563eb; }
.week-appt-completed { background: #dcfce7; color: #166534; border-left: 3px solid #16a34a; }
.week-appt-cancelled { background: #fee2e2; color: #991b1b; border-left: 3px solid #dc2626; }
.week-appt-noshow    { background: #f3f4f6; color: #374151; border-left: 3px solid #9ca3af; }
.week-appt-default   { background: #e0f2fe; color: #0c4a6e; border-left: 3px solid #0284c7; }

/* ── Client Avatar Circle ── */
.client-avatar-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #32373C 0%, #23272b 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Notification bell ── */
.notification-bell-wrapper {
    position: relative;
    display: inline-block;
}
.notification-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Improved table row hover ── */
.table-hover tbody tr:hover {
    background-color: #f0f4fa !important;
}

/* ── Status badge colors ── */
.status-active { background-color: #10b981 !important; color: white !important; }
.status-inactive { background-color: #6b7280 !important; color: white !important; }
.status-discharged { background-color: #ef4444 !important; color: white !important; }
.status-draft { background-color: #6b7280 !important; color: white !important; }
.status-signed { background-color: #10b981 !important; color: white !important; }
.status-amended { background-color: #f59e0b !important; color: white !important; }
.status-open { background-color: #3b82f6 !important; color: white !important; }
.status-closed { background-color: #6b7280 !important; color: white !important; }
.status-scheduled { background-color: #32373C !important; color: white !important; }
.status-completed { background-color: #10b981 !important; color: white !important; }
.status-cancelled { background-color: #ef4444 !important; color: white !important; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.empty-state h5 { color: #374151; margin-bottom: .5rem; }
.empty-state p { color: #9ca3af; margin-bottom: 1.5rem; }

/* ── Loading skeleton ── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Required field indicator ── */
.required-label::after {
    content: " *";
    color: #ef4444;
}

/* ── Breadcrumb improvements ── */
.breadcrumb-nav {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}
.breadcrumb-nav a {
    color: #32373C;
    text-decoration: none;
}
.breadcrumb-nav a:hover { text-decoration: underline; }
.breadcrumb-nav .separator { margin: 0 0.4rem; color: #9ca3af; }

/* ── Card stat improvements ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.stat-card .stat-value { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .75rem; color: #6b7280; margin-top: .25rem; font-weight: 500; }
.stat-card .stat-trend { font-size: .75rem; margin-top: .5rem; }
.stat-trend-up { color: #10b981; }
.stat-trend-down { color: #ef4444; }

/* ── Print improvements ── */
@media print {
    .sidebar, .top-bar, .no-print { display: none !important; }
    .main-content, .container-fluid { padding: 0 !important; margin: 0 !important; }
    body { font-size: 11px; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    .badge { border: 1px solid #999; }
}

/* ── Table improvements ── */
.table th { white-space: nowrap; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background-color: #f0f4fa; }

/* ── Form section headers ── */
.form-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: .5rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid #e2e8f0;
}

/* ── Clickable rows ── */
.table tr.clickable-row { cursor: pointer; }
.table tr.clickable-row:hover td { background-color: #e6fffa; }

/* ── Status badges ── */
.badge.bg-teal { background-color: #32373C !important; }
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}
.status-dot-active { background: #10b981; }
.status-dot-inactive { background: #f59e0b; }
.status-dot-discharged { background: #ef4444; }

/* ── Page header improvements ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.page-header h3 { margin: 0; font-weight: 700; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-state h5 { font-weight: 600; color: #374151; }

/* ── April 2026 polish ── */

/* Better accordion headers */
.accordion-button {
    font-weight: 600;
    font-size: 0.9rem;
}
.accordion-button:not(.collapsed) {
    color: #32373C;
    background-color: #f0f4fa;
}

/* Better badge styling for status indicators */
.badge.bg-info.text-dark {
    background-color: #e0f2fe !important;
    color: #075985 !important;
    font-weight: 500;
}

/* Compliance rate color hints */
.compliance-good { color: #10b981; }
.compliance-warn { color: #f59e0b; }
.compliance-bad { color: #ef4444; }

/* Better table row hover */
.table-hover > tbody > tr:hover > * {
    background-color: rgba(26, 42, 74, 0.04);
}

/* Print improvements */
@media print {
    .quick-action-btn, .btn-group { display: none !important; }
    .card { border: 1px solid #ccc !important; box-shadow: none !important; }
    h3 { font-size: 1.25rem !important; }
}

/* Responsive improvements for mobile */
@media (max-width: 576px) {
    .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }
    .d-flex.gap-2.flex-wrap { gap: 6px !important; }
    .kpi-card .kpi-value { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Loading state improvements */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.navbar-toggler {
    appearance: none;
    cursor: pointer;
    width: 3.5rem;
    height: 2.5rem;
    color: white;
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    border: 1px solid rgba(255,255,255,.15);
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255,255,255,.08);
}
.navbar-toggler:checked { background-color: rgba(255,255,255,.2); }

/* Brand bar */
.top-row {
    background-color: #1e293b;
    border-bottom: 1px solid rgba(255,255,255,.08);
    height: auto;
    min-height: 4rem;
    padding: .75rem 1rem;
}
.brand-block { display: flex; flex-direction: column; gap: 0; }
.brand-title { font-size: 1.1rem; font-weight: 700; color: #fff; line-height: 1.2; }
.brand-org { font-size: .7rem; color: #94a3b8; line-height: 1; }

.nav-item { font-size: .875rem; padding-bottom: .25rem; }
.nav-item:first-of-type { padding-top: .5rem; }
.nav-item:last-of-type { padding-bottom: 1rem; }

.nav-item .nav-link {
    color: #cbd5e1;
    background: none;
    border: none;
    border-radius: 6px;
    height: 2.6rem;
    display: flex;
    align-items: center;
    line-height: 1;
    width: 100%;
    padding: 0 .75rem;
    transition: background .15s, color .15s;
}
.nav-item a.active {
    background-color: #32373C;
    color: #fff;
}
.nav-item .nav-link:hover {
    background-color: rgba(255,255,255,.1);
    color: #fff;
}

/* nav-scrollable display is controlled by scoped NavMenu.razor.css */


.page {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
}

.sidebar {
    background-color: #1e293b;
}

.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

    .top-row a, .top-row .btn-link {
        white-space: nowrap;
        margin-left: 1.5rem;
        text-decoration: none;
    }

    .top-row a:hover, .top-row .btn-link:hover {
        text-decoration: underline;
    }

    .top-row a:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
    }

@media (max-width: 640.98px) {
    .top-row {
        justify-content: space-between;
    }

    .top-row a, .top-row .btn-link {
        margin-left: 0;
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
        height: 100vh;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sidebar > ::deep NavMenu,
    .sidebar > * {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }

    .top-row {
        position: relative;
        z-index: 200;
    }

    .top-row.auth a:first-child {
        flex: 1;
        text-align: right;
        width: 0;
    }

    .top-row, article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* Collapsible nav sections */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 14px;
    margin-top: 4px;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    user-select: none;
    border-radius: 4px;
    transition: background 0.15s;
}
.nav-section-header:hover { background: rgba(255,255,255,0.07); color: #94a3b8; }
.nav-section-header.expanded { color: #93c5fd; }
.nav-chevron { font-size: 0.7rem; opacity: 0.7; }
.nav-section-items { margin-bottom: 2px; }

/* Tight checkbox cells in role assignment tables */
.table td:first-child input[type="checkbox"] {
    margin: 0;
    display: block;
}
.table-sm td { padding: 2px 4px !important; }
.table-sm td:first-child { padding: 2px 3px !important; width: 22px !important; }

/* Module selector buttons — global (not scoped) */
.nav-module-btn {
    width: 100%;
    padding: .6rem .75rem;
    text-align: left;
    font-size: .8rem;
    font-weight: 500;
    color: #e2e8f0 !important;
    background-color: #0a1628 !important;
    border: none !important;
    border-top: 1px solid rgba(255,255,255,.08) !important;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.nav-module-btn:first-child { border-top: none !important; }
.nav-module-btn:hover {
    background-color: #1a2e50 !important;
    color: #fff !important;
}
.nav-module-btn.active {
    background-color: #1e3a6e !important;
    color: #fff !important;
    font-weight: 700;
    border-left: 3px solid #4a9eff !important;
    padding-left: calc(.75rem - 3px);
}

/* ── Tab Bar ── */
article.content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

article.content > div {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.tab-bar {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background-color: #e8edf5;
    border-bottom: 2px solid #c5cfe0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    height: 36px;
    min-height: 36px;
    padding: 0;
    gap: 0;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 0 16px;
    border-right: 1px solid #c5cfe0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    background-color: #e8edf5;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.1s;
    min-height: 36px;
    position: relative;
}

.tab-item:hover {
    background-color: #d5dded;
    color: #32373C;
}

.tab-item.active {
    background-color: #f8fafc;
    color: #32373C;
    font-weight: 600;
    border-bottom: 2px solid #f8fafc;
    margin-bottom: -2px;
}

.tab-title {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    background: none;
    border: none;
    padding: 0 2px;
    font-size: 11px;
    color: #9aadcf;
    cursor: pointer;
    line-height: 1;
    border-radius: 3px;
    transition: background-color 0.1s, color 0.1s;
}

.tab-close:hover {
    background-color: #c5cfe0;
    color: #32373C;
}

/* Nav link indicators for open/active add-ins */
.nav-link.nav-link-open::after {
    content: '●';
    font-size: 8px;
    margin-left: 6px;
    color: #4a9eff;
    vertical-align: middle;
}

/* Empty state */
.tab-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #94a3b8;
    gap: 12px;
}

.tab-empty-icon {
    font-size: 48px;
    opacity: 0.4;
}

.tab-empty-text {
    font-size: 15px;
}

/* ── Add-In Search ── */
.addin-search-wrapper {
    position: relative;
    width: 220px;
}

.addin-search-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #c5cfe0;
    border-radius: 6px;
    padding: 0 6px;
    height: 30px;
    gap: 4px;
}

.addin-search-input-wrap:focus-within {
    border-color: #4a9eff;
    box-shadow: 0 0 0 2px rgba(74,158,255,0.15);
}

.addin-search-icon {
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

.addin-search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #1e293b;
    flex: 1;
    min-width: 0;
}

.addin-search-input::placeholder {
    color: #94a3b8;
}

.addin-search-clear {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.addin-search-clear:hover { color: #32373C; }

.addin-search-dropdown {
    position: fixed;
    top: 3.5rem;
    width: 280px;
    background: #fff;
    border: 1px solid #c5cfe0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 10500;
    max-height: 320px;
    overflow-y: auto;
}

.addin-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    cursor: pointer;
    gap: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.addin-search-item:last-child { border-bottom: none; }

.addin-search-item:hover,
.addin-search-item.highlighted {
    background: #eef4ff;
}

.addin-search-name {
    font-size: 13px;
    font-weight: 500;
    color: #32373C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.addin-search-module {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.addin-search-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
}

/* ── Popout Layout ── */
.popout-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f8fafc;
}

.popout-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #32373C;
    color: #fff;
    padding: 0 16px;
    height: 40px;
    font-size: 13px;
    flex-shrink: 0;
}

.popout-brand { font-weight: 700; letter-spacing: 0.5px; }
.popout-divider { opacity: 0.3; }
.popout-company { opacity: 0.75; }
.popout-user { font-weight: 600; opacity: 0.9; }

.popout-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ── Tab pop-out button ── */
.tab-popout {
    background: none;
    border: none;
    padding: 0 2px;
    font-size: 12px;
    color: #9aadcf;
    cursor: pointer;
    line-height: 1;
    border-radius: 3px;
    transition: background-color 0.1s, color 0.1s;
    opacity: 0.4;
}

.tab-item:hover .tab-popout {
    opacity: 1;
}

.tab-popout:hover {
    background-color: #c5cfe0;
    color: #32373C;
}

/* ── Settings Menu ── */
.settings-menu-wrapper {
    position: relative;
}

.settings-btn {
    background: none;
    border: 1px solid #c5cfe0;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 15px;
    color: #4a5568;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.1s, color 0.1s;
}

.settings-btn:hover {
    background: #e8edf5;
    color: #32373C;
}

.settings-dropdown {
    position: fixed;
    top: 3.5rem;
    right: 12px;
    background: #fff;
    border: 1px solid #c5cfe0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.13);
    z-index: 10500;
    min-width: 210px;
    padding: 4px 0;
}

.settings-header {
    padding: 10px 14px 8px;
}

.settings-username {
    font-weight: 700;
    font-size: 13px;
    color: #32373C;
}

.settings-company {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}

.settings-divider {
    height: 1px;
    background: #e8edf5;
    margin: 4px 0;
}

.settings-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 7px 14px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s;
}

.settings-item:hover {
    background: #eef4ff;
    color: #32373C;
    text-decoration: none;
}

.settings-item-danger { color: #dc3545 !important; }
.settings-item-danger:hover { background: #fff0f0 !important; }

/* ── Settings Modals ── */
.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 10000;
}

.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 10001;
    width: 420px;
    max-width: 95vw;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.settings-modal-wide { width: 780px; }

.settings-modal-header {
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #32373C;
    border-bottom: 1px solid #e8edf5;
}

.settings-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}

.settings-modal-footer {
    padding: 10px 18px;
    border-top: 1px solid #e8edf5;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Server Info Table ── */
.si-table thead th {
    background: #32373C;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    padding: 7px 10px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.si-table tbody td {
    padding: 6px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.si-footer {
    font-size: 11px;
    padding: 6px 12px;
    border-top: 1px solid #e8edf5;
}

/* Status badges */
.si-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.si-badge-on {
    background: #d1fae5;
    color: #065f46;
}

.si-badge-off {
    background: #f1f5f9;
    color: #64748b;
}

.si-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Status Bar ── */
.ssmc-statusbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    height: 26px;
    background: #32373C;
    color: #a8bcd4;
    font-size: 11px;
    height: 26px;
    padding: 0 12px;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sb-sep {
    color: #2e4470;
    margin: 0 8px;
    user-select: none;
}

.sb-panel {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-ok     { color: #4ade80; }
.sb-warn   { color: #fbbf24; }
.sb-danger { color: #f87171; }
.sb-muted  { color: #64748b; }

/* ── Add-in flex root ── */
.addin-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
