/* ═══════════════════════════════════════════════
   Zeidler Group — Operations Platform Design System
   Brand Guidelines: Blue #0abaee · Dark Blue #303245 · Red #e50046
   ═══════════════════════════════════════════════ */

/* ─── CSS Variables (Light Theme — Default) ─── */
:root {
    /* Brand palette */
    --brand-blue: #0abaee;
    --brand-dark: #303245;
    --brand-dark-60: #787b8e;
    --brand-dark-30: #b6b8c7;
    --brand-dark-15: #d9dae3;
    --brand-red: #e50046;

    /* Light theme backgrounds */
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fc;
    --bg-input: #ffffff;

    /* Borders */
    --border-color: #d9dae3;
    --border-hover: #b6b8c7;
    --border-focus: rgba(10, 186, 238, 0.45);

    /* Text */
    --text-primary: #303245;
    --text-secondary: #787b8e;
    --text-muted: #b6b8c7;

    /* Accents */
    --accent-blue: #0abaee;
    --accent-blue-hover: #089dd0;
    --accent-green: #10b981;
    --accent-red: #e50046;
    --accent-amber: #f59e0b;
    --accent-purple: #303245;

    /* Aliases for timetracking module */
    --text: var(--text-primary);
    --accent: #0abaee;
    --card-bg: var(--bg-card);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: var(--border-color);
    --bg: var(--bg-primary);

    /* Sidebar (always dark blue) */
    --sidebar-bg: #303245;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #0abaee;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: #0abaee;
    --sidebar-section-label: rgba(255, 255, 255, 0.4);
    --sidebar-border: rgba(255, 255, 255, 0.08);

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

/* ─── Auth Overlay ─── */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.auth-card {
    text-align: center;
    padding: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    backdrop-filter: blur(20px);
    max-width: 400px;
    width: 90%;
}

.auth-logo {
    margin-bottom: 2rem;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: var(--brand-blue);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.logo-sm {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: 10px;
}

.auth-logo h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-logo p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.auth-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius-sm);
    color: var(--accent-red);
    font-size: 0.85rem;
}

/* ─── App Layout ─── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
}

a.sidebar-title {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

a.sidebar-title:hover {
    opacity: 0.85;
}

.sidebar-title h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sidebar-text-active);
    line-height: 1;
}

/* Brand name styling matching Finance Platform */
.brand-zeidler {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-blue);
    display: block;
    line-height: 1.1;
}

.brand-group {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--sidebar-text-active);
    display: block;
    line-height: 1.1;
}

.sidebar-subtitle {
    font-size: 0.6rem;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    margin-top: 4px;
}

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

.nav-section {
    padding: 0.5rem 0;
}

.nav-section-label {
    display: block;
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-label);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border-left: 3px solid transparent;
    border-radius: 0;
    margin: 1px 0;
}

.nav-item:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover-bg);
}

.nav-item.active {
    color: #ffffff;
    background: var(--sidebar-active-bg);
    border-left-color: transparent;
    border-radius: 6px;
    margin: 1px 8px;
    padding-left: calc(1.25rem - 8px);
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ─── Sidebar Footer ─── */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-footer .btn-ghost {
    color: var(--sidebar-text);
    border-color: var(--sidebar-border);
}

.sidebar-footer .btn-ghost:hover {
    color: var(--sidebar-text-active);
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--sidebar-hover-bg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sidebar-text-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--sidebar-section-label);
}

.nav-dashboard-link {
    background: rgba(10, 186, 238, 0.08);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(10, 186, 238, 0.2);
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Top Bar ─── */
.top-bar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ─── World Clock ─── */
.world-clock-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0 0.5rem;
}

.clock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.clock-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clock-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1024px) {
    .clock-item:nth-child(n+4) {
        display: none;
    }

    /* Hide Mumbai, NY, Phoenix on smaller screens */
}

@media (max-width: 768px) {
    .world-clock-bar {
        display: none;
    }

    /* Hide entirely on mobile */
}

/* ─── Page Container ─── */
.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.glass-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Override overflow for cards containing typeahead dropdowns */
.card:has(.tt-dropdown),
.card:has(.tr-multi-wrap) {
    overflow: visible;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ─── Placeholder Content ─── */
.placeholder-content {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-content p {
    max-width: 400px;
    margin: 0.5rem auto;
    line-height: 1.6;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-info {
    background: rgba(10, 186, 238, 0.12);
    color: var(--accent-blue);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* ─── Tables ─── */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    position: relative;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Clip long content gracefully when columns have been resized */
.data-table[data-resizable="1"] td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
    /* max-width:0 forces td to respect fixed column widths for ellipsis */
}

/* Resizable column handles */
.col-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}

.col-resize-handle:hover,
.col-resize-handle.active {
    background: var(--accent-blue);
}

.data-table.resizing {
    user-select: none;
    cursor: col-resize;
}

.data-table.resizing * {
    cursor: col-resize !important;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(10, 186, 238, 0.12);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 4.5L6 8l3-3.5H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ─── Dark mode: ensure all select option elements are readable ─── */
select.form-input option,
select.form-select option,
.inline-select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* ─── Engine info tooltip ─── */
.engine-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    font-size: 0.6rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}

.engine-info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    min-width: 280px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: pre-line;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
}

/* ─── .form-control (used by all JS modules) ─── */
.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(10, 186, 238, 0.12);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 4.5L6 8l3-3.5H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ─── Settings ─── */
.settings-group {
    margin-bottom: 1.5rem;
}

.settings-group h4 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.setting-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    font-size: 0.85rem;
    animation: slideInRight 300ms ease;
    max-width: 400px;
}

.toast-success {
    border-left: 3px solid var(--accent-green);
}

.toast-error {
    border-left: 3px solid var(--accent-red);
}

.toast-info {
    border-left: 3px solid var(--accent-blue);
}

/* ─── Undo Delete Toast ─── */
.toast-undo {
    border-left: 3px solid #f59e0b;
    padding: 0;
    min-width: 300px;
    max-width: 420px;
}

.undo-toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
}

.undo-toast-msg {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.undo-toast-btn {
    background: none;
    border: none;
    color: #f59e0b;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.undo-toast-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    transform: scale(1.05);
}

.undo-toast-bar {
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
    overflow: hidden;
}

.undo-toast-bar-fill {
    height: 100%;
    background: #f59e0b;
    width: 100%;
    animation: undoBarShrink linear forwards;
    transform-origin: left;
}

@keyframes undoBarShrink {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ─── Bulk Edit Bar ─── */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    animation: slideInRight 200ms ease;
}

.bulk-bar-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.bulk-bar-count strong {
    color: var(--accent-blue);
}

.bulk-bar-actions {
    display: flex;
    gap: 6px;
    flex: 1;
}

.bulk-selected td {
    background: rgba(10, 186, 238, 0.06) !important;
}

.bulk-row-cb,
.bulk-select-all {
    accent-color: var(--accent-blue);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ─── Utilities ─── */
.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--accent-green);
}

.text-danger {
    color: var(--accent-red);
}

.text-warning {
    color: var(--accent-amber);
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════
   Case / Project Management Styles
   ═══════════════════════════════════════════════ */

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* ─── Stat Cards ─── */
.stat-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    min-width: 0;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1px;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ─── Pipeline Filter Chips ─── */
.projects-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pipeline-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pipeline-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pipeline-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pipeline-chip.active {
    background: var(--chip-color, var(--accent-blue));
    color: white;
    border-color: transparent;
}

/* ─── Filter Panel ─── */
.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.15s;
}

.filter-toggle-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-toggle-btn.has-filters {
    border-color: var(--accent-primary, #0abaee);
    color: var(--accent-primary, #0abaee);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--accent-primary, #0abaee);
    color: white;
}

.filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease, margin 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-panel.open {
    max-height: 600px;
    opacity: 1;
    padding: 16px 20px;
    margin-bottom: 12px;
}

.filter-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section-label {
    min-width: 72px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding-top: 5px;
    flex-shrink: 0;
}

.filter-section-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.filter-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--chip-color, var(--accent-primary, #0abaee));
    color: white;
    border-color: transparent;
}

.filter-search-input {
    padding: 4px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.75rem;
    width: 160px;
    font-family: var(--font-body);
}

.filter-search-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.filter-panel-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    margin-top: 4px;
}

/* ─── View User Picker (autocomplete multiselect) ─── */
.view-user-picker {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.view-user-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}

.view-user-picker-trigger:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.view-user-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 100;
    width: 280px;
    background: var(--bg-card, var(--bg-primary));
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.view-user-picker-dropdown.open {
    display: block;
}

.view-user-picker-search {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-body);
    outline: none;
    box-sizing: border-box;
}

.view-user-picker-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.view-user-picker-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
}

.view-user-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-primary);
    transition: background 0.1s;
}

.view-user-picker-item:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

.view-user-picker-item input[type="checkbox"] {
    accent-color: var(--accent-primary, #0abaee);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.view-user-picker-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Selected user tags (chips with ✕) */
.view-user-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    margin-top: 2px;
}

.view-user-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--accent-primary, #0abaee);
    color: #fff;
    white-space: nowrap;
}

.view-user-tag-remove {
    cursor: pointer;
    font-size: 0.6rem;
    opacity: 0.7;
    padding: 0 2px;
    border-radius: 50%;
    transition: opacity 0.1s;
}

.view-user-tag-remove:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* ─── Wizard Styles ─── */
.wizard-container {
    max-width: 800px;
    margin: 0 auto;
}

.wizard-steps {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    position: relative;
    padding: 0 20px;
}

.wizard-step-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.wizard-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    margin-bottom: 6px;
    transition: all 0.2s;
}

.wizard-step-item.active .wizard-step-num {
    background: var(--accent-primary, #0abaee);
    border-color: var(--accent-primary, #0abaee);
    color: white;
}

.wizard-step-item.completed .wizard-step-num {
    background: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
    color: white;
}

.wizard-step-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 80px;
}

.wizard-step-item.active .wizard-step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.wizard-steps-line {
    position: absolute;
    top: 16px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-body {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    min-height: 300px;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
}

.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.impact-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.impact-card .impact-count {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.impact-card .impact-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ─── Dropzone (file upload) ─── */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    background: transparent;
}

.dropzone:hover {
    border-color: var(--accent-primary, #0abaee);
    background: rgba(10, 186, 238, 0.04);
}

.dropzone.dropzone-active {
    border-color: var(--accent-primary, #0abaee);
    background: rgba(10, 186, 238, 0.08);
    color: var(--text-primary);
}

.search-input {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    width: 200px;
    font-family: var(--font-body);
}

.search-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.form-select-sm {
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-body);
}

/* ─── Bulk Action Bar ─── */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(10, 186, 238, 0.08);
    border: 1px solid rgba(10, 186, 238, 0.2);
    border-radius: var(--border-radius-sm);
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--accent-blue);
}

/* ─── Clickable rows ─── */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* ─── Status & Type Badges ─── */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.status-badge.status-draft {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.status-badge.status-sent {
    background: rgba(10, 186, 238, 0.12);
}

.toast-info .toast-icon {
    color: #0abaee;
}

.status-badge.status-paid {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.status-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #e50046;
}

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.type-adh {
    background: rgba(10, 186, 238, 0.12);
    color: #0abaee;
}

.type-ret {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.type-zsw {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.type-none {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
}

.priority-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ─── Case Detail Layout ─── */
.case-detail-layout {
    width: 100%;
}

.case-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

/* ─── Status Pipeline Bar ─── */
.status-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    overflow-x: auto;
}

.pipeline-step {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.pipeline-step:hover {
    background: rgba(255, 255, 255, 0.06);
}

.pipeline-step.active {
    background: color-mix(in srgb, var(--step-color) 20%, transparent);
    box-shadow: 0 0 0 2px var(--step-color);
}

.pipeline-step.completed {
    opacity: 0.6;
}

.pipeline-step.completed .pipeline-step-label::before {
    content: '✓ ';
    color: var(--accent-green);
    font-weight: bold;
}

.pipeline-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-secondary);
}

.pipeline-step.active .pipeline-step-label {
    color: var(--step-color);
}

.pipeline-connector {
    width: 16px;
    min-width: 16px;
    height: 2px;
    background: var(--border-color);
    flex-shrink: 0;
}

.pipeline-step.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Overdue / Due-date badges ─── */
.overdue-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

.overdue-badge.overdue {
    background: rgba(239, 68, 68, 0.12);
    color: #e50046;
}

.overdue-badge.due-soon {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.overdue-badge.due-ok {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* ─── Detail Tabs ─── */
.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.detail-tab {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.detail-tab:hover {
    color: var(--text-primary);
}

.detail-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ─── Detail Form ─── */
.detail-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .detail-form-grid {
        grid-template-columns: 1fr;
    }
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.form-control {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font-body);
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(10, 186, 238, 0.1);
}

/* Ensure native <select> elements render correctly in dark mode */
select.form-control {
    color-scheme: light dark;
    background-color: var(--bg-input);
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

select.form-control option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Typeahead dropdown animation */
.tt-dropdown {
    animation: ttSlideIn 0.15s ease-out;
    transform-origin: top center;
}

@keyframes ttSlideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-static {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 6px 0;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #b0b0b0;
    border: 1px solid #999;
    border-radius: 11px;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-fast);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* ─── Related Sections ─── */
.related-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.related-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: background var(--transition-fast);
}

.related-section-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.related-section-header h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.related-section-header .chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.related-section-body {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* Compact Table */
.data-table.compact th,
.data-table.compact td {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 4px;
}

/* ─── Xero Badges ─── */
.xero-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
}

.xero-badge.exported {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.xero-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 200ms ease;
}

.modal,
.modal-card,
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 250ms ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(16px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ─── Dark Theme ─── */
:root[data-theme="dark"] {
    --bg-primary: #1a1d2e;
    --bg-secondary: #232638;
    --bg-card: rgba(35, 38, 56, 0.9);
    --bg-card-hover: rgba(35, 38, 56, 1);
    --bg-input: rgba(255, 255, 255, 0.06);

    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.18);
    --border-focus: rgba(10, 186, 238, 0.5);

    --text-primary: #e8e9f0;
    --text-secondary: #9496a8;
    --text-muted: #5d5f73;

    --text: var(--text-primary);
    --accent: #0abaee;
    --card-bg: var(--bg-card);
    --glass-bg: rgba(35, 38, 56, 0.7);
    --glass-border: var(--border-color);
    --bg: var(--bg-primary);
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

:root[data-theme="dark"] .progress-track {
    background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .nav-item:hover {
    background: var(--sidebar-hover-bg);
}

:root[data-theme="dark"] .nav-item.active {
    background: var(--sidebar-active-bg);
}

:root[data-theme="dark"] .data-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .top-bar {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

:root[data-theme="dark"] .card {
    box-shadow: none;
}

/* ─── Pagination Bar ─── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 16px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 6px;
    color: var(--text-secondary);
}

.pagination-size {
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

/* ─── Sortable Table Headers ─── */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-th:hover {
    color: var(--accent);
}

.sort-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.5;
}

.sort-indicator.active {
    opacity: 1;
    color: var(--accent);
}

/* ─── Column Toggle ─── */
.column-toggle-wrap {
    position: relative;
}

.column-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.column-toggle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.column-toggle-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 180px;
    margin-top: 4px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.column-toggle-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    font-size: 0.82rem;
    border-radius: 4px;
    cursor: pointer;
}

.column-toggle-dropdown label:hover {
    background: rgba(255, 255, 255, .05);
}

/* ─── Hamburger Menu Button ─── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ─── Breadcrumb Bar ─── */
.breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.4rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    min-height: 28px;
}

.breadcrumb-bar:empty {
    display: none;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

a.breadcrumb-item:hover {
    color: var(--accent-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.breadcrumb-item.current {
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb-sep {
    margin: 0 0.4rem;
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 0.65rem;
    flex-shrink: 0;
}

/* ─── Loading State ─── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    gap: 1rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state .loading-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Empty State ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.empty-state-message {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.empty-state .btn {
    margin-top: 0.25rem;
}

.empty-state-clear {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--accent-blue);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    font-family: var(--font-body);
}

.empty-state-clear:hover {
    color: var(--accent-blue-hover);
}

/* ─── Error State ─── */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.error-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.error-state-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: 0.35rem;
}

.error-state-message {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.error-state .btn {
    margin-top: 0.25rem;
}

/* ─── Focus-Visible (Keyboard Accessibility) ─── */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 2px;
}

.form-input:focus-visible,
.form-select:focus-visible,
.form-control:focus-visible,
.input:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(10, 186, 238, 0.15);
}

/* ─── Tablet Responsive (769–1024px) ─── */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 56px;
        min-width: 56px;
        overflow: visible;
    }

    .sidebar-header {
        padding: 1rem 0.5rem;
        justify-content: center;
    }

    .sidebar-title {
        display: none;
    }

    .nav-label {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 0.6rem;
        border-left: none;
    }

    .nav-icon {
        width: auto;
        font-size: 1.1rem;
    }

    .nav-section-label {
        display: none;
    }

    .sidebar-footer {
        padding: 0.5rem;
        align-items: center;
    }

    .sidebar-footer .btn {
        font-size: 0;
        padding: 0.4rem;
    }

    .sidebar-footer .btn::before {
        font-size: 1rem;
    }

    .user-details {
        display: none;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .nav-dashboard-link .nav-label {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .stat-cards-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .breadcrumb-bar {
        padding: 0.4rem 1rem;
    }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 900;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .hamburger-btn.mobile-only,
    .sidebar .hamburger-btn {
        display: block;
    }

    .main-content {
        width: 100vw;
    }

    .top-bar {
        padding: 0 0.75rem;
    }

    .utilization-bar {
        display: none !important;
    }

    .page-container {
        padding: 1rem;
    }

    .breadcrumb-bar {
        padding: 0.4rem 0.75rem;
        font-size: 0.7rem;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Admin Console
   ═══════════════════════════════════════════════════════════════ */

.admin-console {
    margin: 0 -8px;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 8px 16px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    margin-bottom: 20px;
}

.admin-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.admin-tab:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.admin-tab.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.admin-tab .tab-icon {
    font-size: 1rem;
}

.admin-tab-content {
    padding: 0 8px;
}

/* ─── Admin Sidebar Layout ─── */
.admin-sidebar-layout {
    display: flex;
    gap: 24px;
    min-height: 70vh;
}

.admin-sidebar {
    width: 230px;
    min-width: 230px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    overflow-y: auto;
    max-height: 80vh;
    position: sticky;
    top: 0;
}

.admin-sidebar-group {
    margin-bottom: 8px;
}

.admin-sidebar-group-label {
    padding: 8px 16px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.7;
}

.admin-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast, 0.15s);
    text-align: left;
    white-space: nowrap;
}

.admin-sidebar-item:hover {
    background: var(--bg-elevated);
}

.admin-sidebar-item.active {
    background: var(--accent-blue);
    color: #fff;
    border-radius: 6px;
}

/* ─── My Settings Page ─── */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-value {
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-sidebar-item .sidebar-item-icon {
    font-size: 0.95rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.admin-sidebar-item .sidebar-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-layout .admin-tab-content {
    flex: 1;
    min-width: 0;
    padding: 0;
}

@media (max-width: 768px) {
    .admin-sidebar-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
        max-height: unset;
        position: static;
        padding: 0 8px 12px;
        gap: 2px;
    }

    .admin-sidebar-group {
        width: 100%;
    }

    .admin-sidebar-group-label {
        padding: 4px 8px 2px;
    }

    .admin-sidebar-item {
        padding: 6px 10px;
        font-size: 0.78rem;
    }
}

.admin-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-section-header h3 {
    margin: 0;
}

/* Filter row */
.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-row .form-control {
    max-width: 180px;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

/* Permission Matrix */
.permission-matrix td.center,
.permission-matrix th.center {
    text-align: center;
}

.category-row td {
    padding-top: 16px !important;
    border-bottom: 2px solid var(--border-color, rgba(255, 255, 255, 0.1)) !important;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.permission-matrix input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

/* Progress bar */
.progress-bar-container {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
    min-width: 80px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

/* Inline controls */
.inline-select,
.inline-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.inline-select:focus,
.inline-input:focus {
    border-color: var(--accent-blue);
    outline: none;
}

/* Badge variants for actions & jobs */
.badge-action-create {
    background: #10b981;
    color: white;
}

.badge-action-update {
    background: #0abaee;
    color: white;
}

.badge-action-delete {
    background: #e50046;
    color: white;
}

.badge-action-login {
    background: #303245;
    color: white;
}

.badge-action-invite {
    background: #f59e0b;
    color: black;
}

.badge-action-enable {
    background: #10b981;
    color: white;
}

.badge-action-disable {
    background: #e50046;
    color: white;
}

.badge-action-export {
    background: #0abaee;
    color: white;
}

.badge-action-revoke {
    background: #e50046;
    color: white;
}

.badge-action-execute {
    background: #f59e0b;
    color: black;
}

.badge-action-generate {
    background: #303245;
    color: white;
}

.badge-action-clear {
    background: #e50046;
    color: white;
}

.badge-action-retry {
    background: #f59e0b;
    color: black;
}

.badge-job-pending {
    background: #6b7280;
    color: white;
}

.badge-job-running {
    background: #0abaee;
    color: white;
    animation: pulse 1.5s infinite;
}

.badge-job-completed {
    background: #10b981;
    color: white;
}

.badge-job-failed {
    background: #e50046;
    color: white;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Dimmed rows */
.row-dimmed {
    opacity: 0.5;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* Role cards */
.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Nowrap */
.nowrap {
    white-space: nowrap;
}

/* Audit details */
.audit-details code {
    font-size: 0.75rem;
    word-break: break-all;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Alert */
.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #f59e0b;
}

/* Admin responsive */
@media (max-width: 768px) {
    .admin-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tab .tab-label {
        display: none;
    }

    .admin-tab .tab-icon {
        font-size: 1.2rem;
    }

    .filter-row .form-control {
        max-width: 100%;
    }
}

/* ── Integration Status Cards ── */
.integration-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.integration-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.integration-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

.integration-card.status-connected::before {
    background: #10b981;
}

.integration-card.status-configured::before {
    background: #f59e0b;
}

.integration-card.status-disconnected::before {
    background: #6b7280;
}

.integration-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
}

.integration-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.integration-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.integration-card-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.integration-card-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.integration-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.integration-status-badge .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.integration-status-badge.badge-connected {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.integration-status-badge.badge-connected .status-dot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.integration-status-badge.badge-configured {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.integration-status-badge.badge-configured .status-dot {
    background: #f59e0b;
}

.integration-status-badge.badge-disconnected {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.integration-status-badge.badge-disconnected .status-dot {
    background: #6b7280;
}

.integration-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.integration-card-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.78rem;
}

.integration-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.integration-detail-label {
    color: var(--text-muted);
}

.integration-detail-value {
    color: var(--text-secondary);
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .integration-cards {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════
   Save Indicator (floating pill)
   ═══════════════════════════════════════════════ */
.save-indicator {
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font-body);
    backdrop-filter: blur(12px);
    animation: saveIndicatorIn 0.2s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.save-indicator.saving {
    background: rgba(10, 186, 238, 0.15);
    border: 1px solid rgba(10, 186, 238, 0.25);
    color: #93bbfd;
}

.save-indicator.saved {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.save-indicator.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.save-indicator.fade-out {
    opacity: 0;
    transform: translateY(-8px);
}

@keyframes saveIndicatorIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.save-indicator .spinner-dots::after {
    content: '';
    animation: saveDots 1.2s steps(3, end) infinite;
}

@keyframes saveDots {
    0% {
        content: '';
    }

    33% {
        content: '.';
    }

    66% {
        content: '..';
    }

    100% {
        content: '...';
    }
}

/* ═══════════════════════════════════════════════
   Inline Field Validation
   ═══════════════════════════════════════════════ */
.input-error,
.form-control.input-error {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.field-error-msg {
    color: var(--accent-red);
    font-size: 0.72rem;
    margin-top: 4px;
    display: block;
    animation: fieldErrorIn 0.2s ease;
}

@keyframes fieldErrorIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════
   Client Detail Slide-in Panel
   ═══════════════════════════════════════════════ */
.detail-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.15s ease;
}

.detail-panel {
    width: 560px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    animation: slideInRight 0.25s ease;
    display: flex;
    flex-direction: column;
}

.detail-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.detail-panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.detail-panel-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.detail-panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.detail-field {
    margin-bottom: 16px;
}

.detail-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════
   Export CSV Button
   ═══════════════════════════════════════════════ */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-export:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ═══════════════════════════════════════════════════════════════
   §7 — NOTES / COMMENTS
   ═══════════════════════════════════════════════════════════════ */
.notes-section {
    margin-top: 0.5rem;
}

.notes-add {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.notes-add textarea {
    flex: 1;
    resize: vertical;
    min-height: 50px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.note-item {
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-fast);
}

.note-item:hover {
    border-color: var(--border-hover);
}

.note-pinned {
    border-left: 3px solid var(--accent);
    background: rgba(10, 186, 238, 0.05);
}

.note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.note-author {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.note-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.note-actions {
    margin-left: auto;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.note-item:hover .note-actions {
    opacity: 1;
}

.note-content {
    font-size: 0.88rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.btn-xs {
    padding: 2px 6px;
    font-size: 0.72rem;
    min-height: unset;
}

/* ═══════════════════════════════════════════════════════════════
   §7 — TAGS / LABELS
   ═══════════════════════════════════════════════════════════════ */
.tags-widget {
    margin: 4px 0;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    background: color-mix(in srgb, var(--tag-color) 15%, transparent);
    color: var(--tag-color);
    border: 1px solid color-mix(in srgb, var(--tag-color) 30%, transparent);
}

.tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    padding: 0;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-add-wrapper {
    position: relative;
}

.tag-input {
    border: 1px dashed var(--border-color);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.78rem;
    width: 100px;
    background: transparent;
    color: var(--text-primary);
    outline: none;
}

.tag-input:focus {
    border-color: var(--accent);
    width: 140px;
}

.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 180px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 4px;
}

.tag-dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-dropdown-item:hover {
    background: var(--bg-secondary);
}

.tag-chip-mini {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tag-color);
}

.tag-dropdown-create {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    border-top: 1px solid var(--border-color);
    color: var(--accent);
    font-weight: 500;
}

.tag-dropdown-create:hover {
    background: var(--bg-secondary);
}

/* ═══════════════════════════════════════════════════════════════
   §7 — HISTORY / ACTIVITY TIMELINE
   ═══════════════════════════════════════════════════════════════ */
.history-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-timeline {
    position: relative;
    padding-left: 20px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-color);
}

.history-entry {
    position: relative;
    padding-bottom: 12px;
}

.history-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
}

.history-body {
    padding-left: 4px;
}

.history-desc {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.history-desc strong {
    font-weight: 600;
}

.history-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   §8 — GLOBAL SEARCH / COMMAND PALETTE
   ═══════════════════════════════════════════════════════════════ */
.search-kbd {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1;
}

.global-search-trigger {
    border-bottom: 1px solid var(--border-color) !important;
    padding-bottom: 10px !important;
    margin-bottom: 4px;
}

.global-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    animation: gsOverlayIn 0.15s ease;
}

@keyframes gsOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.global-search-palette {
    width: 580px;
    max-width: 90vw;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: gsPaletteIn 0.2s ease;
}

@keyframes gsPaletteIn {
    from {
        transform: scale(0.96) translateY(-8px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.gs-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.gs-icon {
    font-size: 1.1rem;
    opacity: 0.5;
}

.gs-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.gs-input::placeholder {
    color: var(--text-muted);
}

.gs-esc {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: inherit;
}

.gs-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 6px 0;
}

.gs-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gs-loading::after {
    content: '';
}

.gs-group-label {
    padding: 8px 18px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.gs-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.gs-result:hover,
.gs-result.gs-selected {
    background: var(--bg-secondary);
}

.gs-result-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.gs-result-text {
    flex: 1;
    min-width: 0;
}

.gs-result-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gs-result-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gs-result-status {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(10, 186, 238, 0.1);
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.gs-footer {
    display: flex;
    gap: 16px;
    padding: 8px 18px;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   §10 — NOTIFICATION CENTER
   ═══════════════════════════════════════════════════════════════ */
.notif-wrapper {
    position: relative;
}

.notif-bell-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    position: relative;
    transition: background var(--transition-fast);
}

.notif-bell-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #e50046;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: notifPulse 2s ease infinite;
}

@keyframes notifPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    width: 360px;
    max-width: 90vw;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: gsPaletteIn 0.15s ease;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notif-panel-body {
    max-height: 360px;
    overflow-y: auto;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.notif-item:hover {
    background: var(--bg-secondary);
}

.notif-item.notif-unread {
    background: rgba(10, 186, 238, 0.06);
}

.notif-item.notif-unread:hover {
    background: rgba(10, 186, 238, 0.12);
}

.toast-pending .toast-icon {
    color: #0abaee;
}

.notif-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-msg {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   §11 — FILE PREVIEW & VERSIONING
   ═══════════════════════════════════════════════════════════════ */
.file-preview-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    animation: gsPaletteIn 0.15s ease;
}

.file-preview-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 80vw;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.file-preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    min-height: 300px;
}

.file-preview-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.file-preview-img {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 6px;
}

.file-preview-pdf {
    width: 100%;
    height: 65vh;
    border: none;
    border-radius: 6px;
}

.file-version-badge {
    display: inline-block;
    background: var(--accent-blue);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   CASE DETAIL — EDIT TOOLBAR
   ═══════════════════════════════════════════════════════════════ */
.case-edit-toolbar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════
   §12 — PRINT-FRIENDLY VIEWS
   ═══════════════════════════════════════════════════════════════ */
@media print {

    /* Hide non-essential UI */
    .sidebar,
    .top-bar,
    .btn,
    .btn-primary,
    .btn-ghost,
    .toast-container,
    .global-search-overlay,
    .file-preview-overlay,
    .notif-panel,
    .notif-wrapper,
    .command-palette,
    .page-header select,
    .page-header input,
    .pagination {
        display: none !important;
    }

    /* Reset layout */
    body,
    .app-container,
    .main-content {
        background: #fff !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Cards print clean */
    .card,
    .glass-card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 1rem !important;
    }

    /* Tables print with borders */
    .data-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #ccc !important;
        padding: 4px 8px !important;
        color: #000 !important;
        font-size: 10pt !important;
    }

    .data-table th {
        background: #f0f0f0 !important;
        font-weight: 700 !important;
    }

    /* Charts scale */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Page breaks between major sections */
    .reports-charts,
    .card {
        page-break-inside: avoid;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }

    /* Show active page only */
    .page {
        display: none !important;
    }

    .page.active {
        display: block !important;
    }
}

/* ─── Inline Field Validation ─── */
.input-error,
.form-control.input-error {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.field-error-msg {
    display: block;
    color: var(--accent-red);
    font-size: 0.72rem;
    margin-top: 3px;
    font-weight: 500;
}

/* ─── Session Timeout Warning ─── */
.session-warning-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.session-warning-box {
    background: var(--bg-card);
    border: 1px solid var(--accent-amber);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.session-warning-box h3 {
    color: var(--accent-amber);
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.session-warning-box p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 16px;
}

/* ═══════════════════════════════════════════════════════════════
   §12 — AGREEMENT DETAIL KEY-VALUE PAIRS
   ═══════════════════════════════════════════════════════════════ */
.detail-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-field:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: right;
}

/* Danger stat card */
.stat-card-danger {
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.06) !important;
}

.stat-card-danger .stat-value {
    color: #e50046;
}

/* ═══════════════════════════════════════════════
   Case Comments Sidebar
   ═══════════════════════════════════════════════ */

.case-body-columns {
    display: flex;
    gap: 0;
    min-height: 0;
}

.case-main-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.case-comments-sidebar {
    width: 340px;
    min-width: 300px;
    max-width: 400px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(17, 24, 39, 0.4);
    max-height: calc(100vh - 260px);
}

.comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.comments-header h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.comment-count-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.comments-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    animation: fadeInUp 200ms ease;
}

.comment-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    position: relative;
}

.comment-delete-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.comment-delete-btn:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    opacity: 1;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: white;
    letter-spacing: 0.5px;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.comment-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.comment-delete-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.comment-item:hover .comment-delete-btn {
    opacity: 1;
}

.comment-delete-btn:hover {
    color: var(--accent-red);
}

.comment-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* @Mention chips */
.mention-chip {
    display: inline;
    background: rgba(10, 186, 238, 0.15);
    color: #0abaee;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Comment Input Area */
.comments-input-area {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.comment-input-wrapper {
    position: relative;
}

.comment-textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    line-height: 1.4;
    resize: none;
    transition: border-color var(--transition-fast);
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(10, 186, 238, 0.1);
}

.comment-textarea::placeholder {
    color: var(--text-muted);
}

/* @Mention Dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mention-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mention-option:hover,
.mention-option.selected {
    background: rgba(10, 186, 238, 0.15);
}

.mention-option-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.mention-option-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Responsive — stack on smaller screens */
@media (max-width: 1100px) {
    .case-comments-sidebar {
        width: 280px;
        min-width: 260px;
    }
}

@media (max-width: 900px) {
    .case-body-columns {
        flex-direction: column;
    }

    .case-comments-sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        max-height: 400px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* ═══════════════════════════════════════════════
   BD WORKBOOK VIEWS — Excel-like Tables
   ═══════════════════════════════════════════════ */

.bd-workbook {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Division tab bar (Excel-style tabs) */
.bd-workbook-tab-bar {
    display: flex;
    gap: 0;
    background: #e8eaed;
    border-bottom: 2px solid #217346;
    padding: 0 4px;
    padding-top: 4px;
    overflow-x: auto;
}

.bd-wb-tab {
    padding: 8px 18px;
    border: 1px solid #c0c0c0;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    background: #e8eaed;
    color: #555;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 120ms ease;
    white-space: nowrap;
    margin-right: 1px;
    font-family: var(--font-body);
}

.bd-wb-tab:hover {
    background: #d4e8d4;
    color: #217346;
}

.bd-wb-tab.active {
    background: #ffffff;
    color: #217346;
    font-weight: 600;
    border-color: #217346 #217346 transparent;
    position: relative;
    top: 1px;
}

/* Filter bar */
.bd-workbook-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    flex-wrap: wrap;
}

.bd-workbook-filters .form-control {
    padding: 4px 8px;
    font-size: 0.78rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.bd-workbook-filters .form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(10, 186, 238, 0.1);
}

/* Column show/hide panel */
.bd-wb-col-panel {
    background: #fefefe;
    border-bottom: 1px solid var(--border-color);
    max-height: 160px;
    overflow-y: auto;
}

.bd-wb-col-panel label {
    font-size: 12px;
    color: var(--text-secondary);
}

.bd-wb-col-panel input[type="checkbox"] {
    accent-color: #217346;
}

/* Scrollable table container */
.bd-workbook-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    position: relative;
}

/* Excel-like table */
.bd-workbook-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    font-family: var(--font-body);
}

.bd-workbook-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    padding: 6px 10px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: none;
    color: #333;
    white-space: nowrap;
    user-select: none;
}

.bd-workbook-table td {
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
    color: var(--text-primary);
    vertical-align: middle;
}

.bd-workbook-table tbody tr:nth-child(even) {
    background: #fafcfa;
}

.bd-workbook-table tbody tr:hover td {
    background: rgba(33, 115, 70, 0.06);
}

.bd-workbook-table tbody tr:hover {
    outline: 1px solid #217346;
    outline-offset: -1px;
}

/* Sticky first column — MUST be opaque to avoid bleed-through on scroll (§B) */
.bd-workbook-table th.sticky-col,
.bd-workbook-table td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
    border-right: 2px solid #a0a0a0;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.bd-workbook-table th.sticky-col {
    z-index: 4;
    background: #e8e8e8;
}

.bd-workbook-table td.sticky-col {
    background: #ffffff;
    color: #1a1a1a;
}

.bd-workbook-table tbody tr:nth-child(even) td.sticky-col {
    background: #f3f7f3;
    color: #1a1a1a;
}

.bd-workbook-table tbody tr:hover td.sticky-col {
    background: rgba(33, 115, 70, 0.08);
}

/* Number alignment */
.bd-workbook-table .align-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Sort indicators — scoped to workbook to avoid overriding platform-wide .sort-indicator */
.bd-workbook-table .sort-indicator {
    font-size: 0.65rem;
    color: #bbb;
    margin-left: 2px;
}

.bd-workbook-table .sort-indicator.active {
    color: #217346;
}

/* Empty cell placeholder */
.wb-empty {
    color: #d0d0d0;
    font-size: 0.7rem;
}

/* Pagination */
.bd-workbook-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
    font-size: 0.78rem;
}

/* Dark theme overrides */
[data-theme="dark"] .bd-workbook-tab-bar {
    background: #2a2d35;
    border-bottom-color: #3d8a5c;
}

[data-theme="dark"] .bd-wb-tab {
    background: #2a2d35;
    color: #999;
    border-color: #444;
}

[data-theme="dark"] .bd-wb-tab:hover {
    background: #354035;
    color: #5cb87a;
}

[data-theme="dark"] .bd-wb-tab.active {
    background: var(--bg-card);
    color: #5cb87a;
    border-color: #5cb87a #5cb87a transparent;
}

[data-theme="dark"] .bd-workbook-filters {
    background: #1e2028;
}

[data-theme="dark"] .bd-workbook-table th {
    background: #2a2d35;
    border-color: #444;
    color: #ccc;
}

[data-theme="dark"] .bd-workbook-table td {
    border-color: #333;
}

[data-theme="dark"] .bd-workbook-table tbody tr:nth-child(even) {
    background: #252830;
}

[data-theme="dark"] .bd-workbook-table tbody tr:hover td {
    background: rgba(92, 184, 122, 0.10);
}

[data-theme="dark"] .bd-workbook-table th.sticky-col {
    background: #2a2d35;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bd-workbook-table td.sticky-col {
    background: #1e2028;
    color: #e0e0e0;
}

[data-theme="dark"] .bd-workbook-table tbody tr:nth-child(even) td.sticky-col {
    background: #252830;
    color: #e0e0e0;
}

[data-theme="dark"] .bd-wb-col-panel {
    background: #1e2028;
}

[data-theme="dark"] .bd-workbook-pagination {
    background: #1e2028;
}

/* ─── Dashboard ─── */
.dashboard-welcome {
    margin-bottom: 1.5rem;
}

.dashboard-welcome h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-welcome p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.dashboard-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.dashboard-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 24px rgba(10, 186, 238, 0.12);
    transform: translateY(-2px);
}

.dashboard-card-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 186, 238, 0.08);
    border-radius: 14px;
    flex-shrink: 0;
}

.dashboard-card-body {
    flex: 1;
    min-width: 0;
}

.dashboard-card-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.dashboard-card-arrow {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.dashboard-card:hover .dashboard-card-arrow {
    color: var(--accent-blue);
    transform: translateX(3px);
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

[data-theme="dark"] .dashboard-card {
    background: #1e2028;
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .dashboard-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 24px rgba(10, 186, 238, 0.15);
}

[data-theme="dark"] .dashboard-card-icon {
    background: rgba(10, 186, 238, 0.12);
}

/* ═══════════════════════════════════════════════
   §13 — TYPEAHEAD / AUTOCOMPLETE COMPONENT
   ═══════════════════════════════════════════════ */

.typeahead-wrap {
    position: relative;
}

.typeahead-dropdown {
    position: absolute;
    z-index: 9999;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    margin-top: 2px;
}

.typeahead-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

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

.typeahead-item:hover,
.typeahead-item.active {
    background: rgba(10, 186, 238, 0.10);
}

.typeahead-item mark {
    background: rgba(10, 186, 238, 0.25);
    color: inherit;
    padding: 0;
    border-radius: 2px;
    font-weight: 600;
}

.typeahead-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

.typeahead-loading {
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typeahead-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: ta-spin 0.6s linear infinite;
}

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

/* Dark theme overrides */
[data-theme="dark"] .typeahead-dropdown {
    background: #1e2028;
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .typeahead-item:hover,
[data-theme="dark"] .typeahead-item.active {
    background: rgba(10, 186, 238, 0.15);
}

[data-theme="dark"] .typeahead-item mark {
    background: rgba(10, 186, 238, 0.35);
}

/* ═══════════════════════════════════════════════════════════════
   Help & Support Content
   ═══════════════════════════════════════════════════════════════ */
.help-section-content h3 {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.help-section-content p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.help-workflow {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.help-workflow h4 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.help-steps {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.75;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.help-steps li {
    margin-bottom: 0.25rem;
}

.help-steps strong {
    color: var(--text-primary);
}

.help-tip {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-tip-icon {
    margin-right: 0.25rem;
}

.help-section-content kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.8rem;
    font-family: monospace;
}

/* ─── Zop-Bot Widget ─── */
#zopbot-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    border: none;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(10, 186, 238, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#zopbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(10, 186, 238, 0.5);
}

#zopbot-bubble.zopbot-bubble-hidden {
    display: none;
}

#zopbot-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: zopbot-slideup 0.2s ease;
}

#zopbot-panel.zopbot-hidden {
    display: none;
}

@keyframes zopbot-slideup {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#zopbot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.zopbot-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.zopbot-z {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--brand-blue);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
}

.zopbot-mode-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 2px;
    margin-left: auto;
}

.zopbot-mode {
    padding: 4px 12px;
    border: none;
    background: transparent;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-body);
}

.zopbot-mode.active {
    background: var(--brand-blue);
    color: #fff;
}

#zopbot-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

#zopbot-close:hover {
    color: var(--text-primary);
}

#zopbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zopbot-msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
}

.zopbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.zopbot-msg.bot {
    align-self: flex-start;
}

.zopbot-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
    background: var(--brand-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.zopbot-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.84rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.zopbot-msg.bot .zopbot-bubble {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.zopbot-msg.user .zopbot-bubble {
    background: var(--brand-blue);
    color: #fff;
}

/* Typing dots */
.zopbot-dots span {
    animation: zopbot-dot 1.2s infinite;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.zopbot-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.zopbot-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes zopbot-dot {

    0%,
    60%,
    100% {
        opacity: 0.2;
    }

    30% {
        opacity: 1;
    }
}

#zopbot-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

#zopbot-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.84rem;
    font-family: var(--font-body);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

#zopbot-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(10, 186, 238, 0.12);
}

#zopbot-send {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: var(--brand-blue);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#zopbot-send:hover {
    background: var(--accent-blue-hover);
}

@media (max-width: 480px) {
    #zopbot-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px;
    }
}

/* ─── Zop-Bot Action Cards (S2) ─── */
.zopbot-action-card {
    background: var(--bg-primary);
    border: 1px solid var(--brand-blue);
    border-radius: 12px;
    padding: 14px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zopbot-action-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--brand-blue);
}

.zopbot-action-icon {
    font-size: 1rem;
}

.zopbot-action-summary {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.zopbot-action-params {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.zopbot-param {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.zopbot-param-key {
    font-weight: 600;
    text-transform: capitalize;
    color: var(--text-primary);
}

.zopbot-action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.zopbot-btn-confirm,
.zopbot-btn-reject {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: var(--font-body);
}

.zopbot-btn-confirm {
    background: var(--brand-blue);
    color: #fff;
}

.zopbot-btn-confirm:hover {
    opacity: 0.85;
}

.zopbot-btn-reject {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.zopbot-btn-reject:hover {
    opacity: 0.7;
}

/* ─── Zop-Bot Animations (S3) ─── */
@keyframes zopbot-slideup {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Case Reports ── */
.cr-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.cr-sortable:hover {
    color: var(--accent);
}

.cr-sortable .sort-arrow {
    font-size: 0.65rem;
    opacity: 0.3;
    margin-left: 2px;
}

/* §S3 — Zebra rows + hover for report run table */
.cr-report-table tbody tr:nth-child(even) {
    background: rgba(var(--accent-rgb, 10, 186, 238), 0.03);
}

.cr-report-table tbody tr:hover {
    background: rgba(var(--accent-rgb, 10, 186, 238), 0.07);
}

@keyframes zopbot-pulse-ring {
    0% {
        box-shadow: 0 4px 16px rgba(10, 186, 238, 0.35), 0 0 0 0 rgba(10, 186, 238, 0.4);
    }

    70% {
        box-shadow: 0 4px 16px rgba(10, 186, 238, 0.35), 0 0 0 12px rgba(10, 186, 238, 0);
    }

    100% {
        box-shadow: 0 4px 16px rgba(10, 186, 238, 0.35), 0 0 0 0 rgba(10, 186, 238, 0);
    }
}

#zopbot-bubble.zopbot-pulse {
    animation: zopbot-pulse-ring 2s ease infinite;
}