* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f1f5f9;
    --bg-secondary: #e5e7eb;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Dark mode colors */
[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #0f172a;
    --bg-secondary: #1e293b;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}

/* Dark mode select/dropdown fix for Windows browsers */
[data-theme="dark"] select {
    background-color: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] select option {
    background-color: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] select option:checked,
[data-theme="dark"] select option:hover {
    background-color: #334155;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-info {
    background: #0ea5e9;
    color: white;
}

.btn-info:hover {
    background: #0284c7;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* Microsoft SSO Button */
.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #ffffff;
    color: #5e5e5e;
    border: 1px solid #8c8c8c;
    padding: 0.625rem 1rem;
    font-weight: 600;
    text-decoration: none;
}

.btn-microsoft:hover {
    background: #f5f5f5;
    border-color: #6e6e6e;
}

.btn-microsoft svg {
    flex-shrink: 0;
}

/* Dark mode Microsoft button */
[data-theme="dark"] .btn-microsoft {
    background: #2d2d2d;
    color: #ffffff;
    border-color: #5e5e5e;
}

[data-theme="dark"] .btn-microsoft:hover {
    background: #3d3d3d;
    border-color: #7e7e7e;
}

/* SSO Divider */
.sso-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.sso-divider::before,
.sso-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.sso-divider span {
    padding: 0 0.75rem;
}

/* Label with action button */
.label-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.label-with-action label {
    margin-bottom: 0;
}

.ai-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ai-generate-btn .ai-icon {
    font-size: 0.85rem;
}

.ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Date input styling for dark mode compatibility */
input[type="date"],
input[type="datetime-local"] {
    color-scheme: light;
    color: var(--text-primary);
    background-color: var(--card-bg);
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* Execution Toggle for Run Script Modal */
.execution-toggle {
    display: flex;
    gap: 20px;
}

.execution-toggle .radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

.execution-toggle .radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

#schedule-options {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
}

#schedule-options .form-group {
    margin-bottom: 1rem;
}

#schedule-options .form-group:last-child {
    margin-bottom: 0;
}

.timezone-hint {
    font-weight: normal;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-container h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-container .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.login-container a {
    color: var(--primary-color);
    text-decoration: none;
}

.error-message {
    background: #fef2f2;
    color: var(--danger-color);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* Header */
.header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Global Search */
.global-search {
    position: relative;
}

.global-search input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    width: 400px;
    background: var(--background);
    color: var(--text-primary);
}

.global-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.global-search input::placeholder {
    color: var(--text-secondary);
}

.global-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-group {
    border-bottom: 1px solid var(--border-color);
}

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

.search-group-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--background);
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.search-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Ticket Stats in Header */
.ticket-stats {
    display: flex;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--background);
    border-radius: 6px;
    font-size: 0.875rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.stat-item:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.stat-mine .stat-icon {
    color: var(--primary-color);
}

.stat-assigned .stat-icon {
    color: var(--success-color);
}

.stat-unassigned .stat-icon {
    color: var(--warning-color);
}

.stat-alerts .stat-icon {
    color: var(--danger-color);
    font-weight: bold;
}

.stat-alerts:hover {
    background: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
}

.stat-item span:last-child {
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

/* Quick Actions Dropdown */
.quick-actions-dropdown {
    position: relative;
}

.quick-actions-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.quick-actions-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.quick-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    text-align: left;
    transition: background-color 0.2s;
}

.quick-action-item:hover {
    background: var(--background);
}

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

/* Navigation */
.nav {
    background: var(--card-bg);
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-btn:hover {
    color: var(--primary-color);
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.content-page h2 {
    margin-bottom: 1.5rem;
}

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

.page-header h2 {
    margin-bottom: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.date-filter-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.date-filter-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid var(--border-color);
}

.date-filter-btn:last-child {
    border-right: none;
}

.date-filter-btn:hover {
    background: var(--border-color);
}

.date-filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

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

.filter-checkbox span {
    white-space: nowrap;
}

/* Refresh Controls */
.refresh-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.refresh-controls .refresh-icon {
    display: inline-block;
    font-weight: bold;
}

#refresh-tickets-btn:active .refresh-icon {
    animation: spin 0.5s ease;
}

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

.last-refresh-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Ticket List */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Clients List (matching ticket list) */
.clients-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Client Row Cards (matching ticket format) */
.client-row-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.client-row-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.client-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.client-row-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-row-name strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.client-badges {
    display: inline-flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.integration-badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-csp {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.badge-leader {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
}

.badge-synergy {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.badge-xero {
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: white;
}

[data-theme="dark"] .badge-csp {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

[data-theme="dark"] .badge-leader {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

[data-theme="dark"] .badge-synergy {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

[data-theme="dark"] .badge-xero {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.client-row-actions {
    display: flex;
    gap: 0.5rem;
}

.client-row-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.client-row-details span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Ticket List */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.ticket-card:hover {
    box-shadow: var(--shadow-lg);
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ticket-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Icon Button */
.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--background);
    color: var(--primary-color);
}

/* Help button styling */
.btn.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    font-weight: bold;
    font-size: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--background);
}

.btn.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Script parameter rows */
.parameter-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.parameter-row-inputs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.parameter-row-inputs > div {
    flex: 1;
    min-width: 100px;
}

.parameter-row-inputs > div.param-type-col {
    flex: 0 0 100px;
    min-width: 100px;
}

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

.parameter-row-checkboxes {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.parameter-row-checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.parameter-row-checkboxes label:hover {
    color: var(--text-primary);
}

.parameter-row-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}

/* Remove parameter button */
.btn-remove-param {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border: 1px solid var(--danger-color);
    border-radius: 4px;
    background: transparent;
    color: var(--danger-color);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.btn-remove-param:hover {
    background: var(--danger-color);
    color: white;
}

[data-theme="dark"] .btn-remove-param {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

[data-theme="dark"] .btn-remove-param:hover {
    background: #f87171;
    color: white;
}

/* Single device display (when running script from device detail) */
.single-device-display {
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* Device selector for multi-select */
.device-selector {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.device-selector-filters {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.device-selector-filters select {
    width: auto;
    min-width: 120px;
    flex-shrink: 0;
}

.device-selector-filters input {
    flex: 1;
    min-width: 100px;
}

.device-selector-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    justify-content: flex-end;
}

.device-selector-controls input {
    flex: 1;
    min-width: 0;
}

.device-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.device-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.device-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

.device-checkbox-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.device-checkbox-label strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.device-checkbox-label .device-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.device-checkbox-label .device-client {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.device-checkbox-label .device-type-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-muted);
}

[data-theme="dark"] .device-checkbox-item:hover {
    background: var(--bg-secondary);
}

/* Help content styling */
.help-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.help-content h4 {
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content h5 {
    margin: 1rem 0 0.25rem 0;
    color: var(--text-secondary);
}

.help-content p {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.help-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.help-content li {
    margin: 0.25rem 0;
}

.help-content code {
    background: var(--background-elevated);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.ticket-card-title {
    font-weight: 600;
    color: var(--text-primary);
}

.ticket-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Ticket Due Date Styles */
.ticket-due-date {
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.due-date-overdue {
    background-color: #fee2e2;
    color: #dc2626;
}

.due-date-today {
    background-color: #fef3c7;
    color: #d97706;
}

.due-date-upcoming {
    background-color: #dbeafe;
    color: #2563eb;
}

[data-theme="dark"] .due-date-overdue {
    background-color: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .due-date-today {
    background-color: #78350f;
    color: #fcd34d;
}

[data-theme="dark"] .due-date-upcoming {
    background-color: #1e3a8a;
    color: #93c5fd;
}

/* Inline Editing on Ticket Cards */
.inline-editable {
    cursor: pointer;
    position: relative;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.inline-editable:hover {
    background-color: var(--primary-color);
    color: white;
    padding: 0.125rem 0.375rem;
    margin: -0.125rem -0.375rem;
}

.inline-date-picker {
    z-index: 1000;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.inline-assignee-select,
.inline-status-select,
.inline-priority-select {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 120px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ticket-card-meta .inline-editable,
.ticket-card-actions .inline-editable {
    position: relative;
}

.ticket-card-actions .badge.inline-editable {
    cursor: pointer;
}

.ticket-card-actions .badge.inline-editable:hover {
    filter: brightness(0.9);
    transform: scale(1.05);
}

/* Down chevron indicator for inline editable fields */
.ticket-card-meta .inline-editable::after,
.ticket-card-actions .badge.inline-editable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.6;
}

.ticket-card-meta .inline-editable:hover::after,
.ticket-card-actions .badge.inline-editable:hover::after {
    opacity: 1;
}

.ticket-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-open { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-pending { background: #f3e8ff; color: #7c3aed; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-closed { background: #e2e8f0; color: #475569; }

.badge-low { background: #e2e8f0; color: #475569; }
.badge-medium { background: #dbeafe; color: #1e40af; }
.badge-high { background: #fef3c7; color: #92400e; }
.badge-urgent { background: #fee2e2; color: #991b1b; }

/* Signature Status Badges */
.badge-signature-pending { background: #fef3c7; color: #92400e; }
.badge-signature-viewed { background: #dbeafe; color: #1e40af; }
.badge-signature-signed { background: #d1fae5; color: #065f46; }
.badge-signature-expired { background: #fee2e2; color: #991b1b; }
.badge-signature-cancelled { background: #e2e8f0; color: #475569; }

/* Document Type Badges */
.badge-invoice { background: #dbeafe; color: #1e40af; }
.badge-estimate { background: #fef3c7; color: #92400e; }
.badge-contract { background: #f3e8ff; color: #7c3aed; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* Billing Status Badge */
.badge-billed { background: #d1fae5; color: #065f46; margin-left: 6px; }

/* Contract Coverage Badge (in ticket title) */
.badge-contract-covered {
    background: #f3e8ff;
    color: #7c3aed;
    font-size: 0.7rem;
    font-weight: 500;
    vertical-align: middle;
    margin-left: 8px;
}

/* Mailbox Source Badge (in ticket title) */
.badge-mailbox {
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.7rem;
    font-weight: 500;
    vertical-align: middle;
    margin-left: 8px;
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Client Detail Tabs */
.client-detail-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    align-items: center;
}

.client-tab-group {
    display: flex;
    align-items: center;
    gap: 0;
}

.client-tab-group:not(:last-child)::after {
    content: '';
    display: block;
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.client-tab {
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    white-space: nowrap;
}

.client-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 4px 4px 0 0;
}

.client-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.client-tab-content {
    min-height: 300px;
}

.client-info-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Client Row Cards (matching ticket format) */
.client-row-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.client-row-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Clients Table */
.clients-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.clients-table thead {
    background: var(--background);
    border-bottom: 2px solid var(--border-color);
}

.clients-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clients-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.clients-table tbody tr:hover {
    background: var(--background);
}

.clients-table tbody tr:last-child {
    border-bottom: none;
}

.clients-table td {
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.clients-table .actions-column {
    text-align: right;
    white-space: nowrap;
}

.clients-table .actions-column button {
    margin-left: 0.5rem;
}

.client-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.client-card h3 {
    margin-bottom: 0.5rem;
}

.client-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.client-card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Time Entries List */
.time-entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-entry-card {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
}

.time-entry-info h4 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.time-entry-info p {
    font-size: 0.75rem;
    color: var (--text-secondary);
}

.time-entry-hours {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.time-entry-hours.non-billable {
    color: var(--text-secondary);
}

/* Users List */
.users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.user-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.user-card h4 {
    margin-bottom: 0.25rem;
}

.user-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.user-card-selects {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group-inline label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 50px;
}

.form-group-inline select {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
}

/* Section description */
.section-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Settings description */
.settings-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* User count badge in groups */
.user-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

/* Empty message */
.empty-message {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* Inactive settings item */
.settings-item.inactive {
    opacity: 0.6;
}

/* Feature categories for group permissions */
.features-grid {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.feature-category {
    margin-bottom: 1.5rem;
}

.feature-category h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.feature-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.feature-checkbox {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.feature-checkbox:hover {
    background: var(--hover-bg);
}

.feature-checkbox input {
    margin-right: 0.5rem;
}

.feature-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.feature-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 1.25rem;
    margin-top: 0.125rem;
}

.form-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: auto;
    overscroll-behavior: contain;
}

/* Prevent background page scrolling when any modal is open */
body:has(.modal-overlay:not(.hidden)) {
    overflow: hidden;
}

#modal-overlay {
    z-index: 1100;
}

.modal {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-small {
    max-width: 400px;
    width: 90%;
}

.modal-large {
    max-width: 1200px;
    width: 95%;
    max-height: 95vh;
}

.modal-xl {
    max-width: 1400px;
    width: 98%;
    max-height: 95vh;
}

/* iPad/Tablet Modal Sizing */
@media (max-width: 1024px) {
    .modal-large {
        width: 98%;
        max-width: 95vw;
    }

    .modal-xl {
        width: 100%;
        max-width: 98vw;
    }
}

/* PDF Preview Modal */
.pdf-preview-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

/* Label-specific preview - more compact for small labels */
.pdf-preview-container.label-preview {
    height: 50vh;
    min-height: 300px;
    max-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    padding: 20px;
}

.pdf-preview-container.label-preview canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

.pdf-preview-iframe,
.pdf-preview-object {
    width: 100%;
    height: 100%;
    border: none;
}

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

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.modal-minimize,
.modal-help {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 0.25rem;
}

.modal-help {
    font-size: 0.85rem;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-minimize:hover,
.modal-close:hover,
.modal-help:hover {
    color: var(--text-primary);
}

.modal-help:hover {
    border-color: var(--text-primary);
}

/* Ticket Legend Modal */
.ticket-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.ticket-legend-section {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
}

.ticket-legend-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.ticket-legend-item:last-child {
    margin-bottom: 0;
}

.ticket-legend-item .badge,
.ticket-legend-item .note-source-badge,
.ticket-legend-item .charge-type-badge {
    flex-shrink: 0;
}

/* Minimized tickets tray */
.minimized-tickets {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 999;
    flex-wrap: wrap;
}

.minimized-tickets:empty {
    display: none;
}

.minimized-ticket {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    max-width: 250px;
    transition: all 0.2s;
}

.minimized-ticket:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.minimized-ticket-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
}

.minimized-ticket-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

.minimized-ticket-close:hover {
    color: var(--danger-color);
}

.minimized-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

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

.client-badge {
    background: var(--success-color);
    color: white;
}

.device-badge {
    background: var(--warning-color);
    color: white;
}

.estimate-badge {
    background: #8b5cf6;
    color: white;
}

.project-badge {
    background: #14b8a6;
    color: white;
}

.minimized-estimate-type {
    border-color: #8b5cf6;
}

.minimized-estimate-type:hover {
    border-color: #8b5cf6;
    background: var(--card-bg);
}

.minimized-project-type {
    border-color: #14b8a6;
}

.minimized-project-type:hover {
    border-color: #14b8a6;
    background: var(--card-bg);
}

/* Change indicator for minimized items */
.minimized-update-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: pulse-indicator 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

.minimized-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.minimized-status-dot.status-online {
    background-color: var(--success-color);
}

.minimized-status-dot.status-offline {
    background-color: var(--text-secondary);
}

.minimized-device-type {
    border-color: var(--warning-color);
}

.minimized-device-type:hover {
    border-color: var(--warning-color);
    background: var(--card-bg);
}

.modal-content {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Ticket Detail */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 280px;
    gap: 1.5rem;
}

.ticket-detail-main {
    min-width: 0;
    overflow: hidden;
}

/* Editable Ticket Title */
.ticket-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ticket-title-input {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    transition: border-color 0.2s, background-color 0.2s;
}

.ticket-title-input:hover {
    border-color: var(--border-color);
    background: var(--bg-secondary);
}

.ticket-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.ticket-detail-main h4 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Description Section */
.description-section {
    margin-bottom: 1.5rem;
}

.description-header {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0.5rem;
}

.description-header:hover h4 {
    color: var(--primary-color);
}

.description-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.description-collapse-icon {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.description-section.collapsed .description-collapse-icon {
    transform: rotate(-90deg);
}

.ticket-detail-description {
    background: var(--background);
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    transition: max-height 0.3s ease;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 500px;
    position: relative;
}

/* When content exceeds 500px, show gradient fade */
.ticket-detail-description.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--background));
    pointer-events: none;
}

/* Expanded state - no height limit */
.description-section.expanded .ticket-detail-description {
    max-height: none;
    overflow-y: auto;
}

.description-section.expanded .ticket-detail-description.truncated::after {
    display: none;
}

/* Collapsed state (click header to collapse) */
.description-section.collapsed .ticket-detail-description {
    max-height: 80px;
}

.description-section.collapsed .ticket-detail-description::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--background));
    pointer-events: none;
}

/* Expand/Show More button */
.description-expand-btn {
    display: none;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.description-expand-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.description-expand-btn.visible {
    display: block;
}

.ticket-detail-sidebar {
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
    flex-shrink: 0;
    min-width: 280px;
}

.ticket-detail-sidebar .detail-row {
    display: block;
    margin-bottom: 1rem;
    padding: 0;
    border-bottom: none;
}

.ticket-detail-sidebar .detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    min-width: unset;
    margin-right: 0;
}

/* Client, Contact, and Location select rows with view buttons */
.client-select-row,
.contact-select-row,
.location-select-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.client-select-row select,
.contact-select-row select,
.location-select-row select {
    flex: 1;
}

.client-select-row .btn,
.contact-select-row .btn,
.location-select-row .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* Contact and Location info displays */
.contact-info-row,
.location-info-row {
    margin-top: -0.5rem;
    margin-bottom: 0.75rem;
    padding-left: 0;
}

.contact-info-details,
.location-info-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    line-height: 1.5;
}

.contact-info-details a {
    color: var(--primary-color);
    text-decoration: none;
}

.contact-info-details a:hover {
    text-decoration: underline;
}

/* Additional Assignees Checkboxes */
.additional-assignees-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.additional-assignees-checkboxes .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    color: var(--text-primary);
}

.additional-assignees-checkboxes .checkbox-label:hover {
    background: var(--card-bg);
}

.additional-assignees-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Notes Section */
.notes-section {
    margin-top: 1.5rem;
}

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

.notes-header h4 {
    margin: 0;
}

.note-card {
    background: var(--background);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.note-card.internal {
    border-left: 3px solid var(--warning-color);
}

.note-card.email-note {
    border-left: 3px solid #3b82f6;
}

.note-card.call-note {
    border-left: 3px solid #10b981;
}

.note-card.outbound-email-note {
    border-left: 3px solid #8b5cf6;
}

.note-card.email-note.internal,
.note-card.call-note.internal,
.note-card.outbound-email-note.internal {
    border-left: 3px solid var(--warning-color);
}

.note-source-badge {
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.note-source-badge.email-badge {
    background: #e0f2fe;
    color: #0369a1;
}

.note-source-badge.outbound-email-badge {
    background: #ede9fe;
    color: #6d28d9;
}

.note-source-badge.call-badge {
    background: #d1fae5;
    color: #047857;
}

.note-source-badge.sms-in-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.note-source-badge.sms-out-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.note-card.sms-in-note {
    border-left: 4px solid #3b82f6;
}

.note-card.sms-out-note {
    border-left: 4px solid #22c55e;
}

.note-source-badge.time-badge {
    background: #fef3c7;
    color: #92400e;
}

.note-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.note-header:hover {
    color: var(--text-primary);
}

.note-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-collapse-icon {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    display: inline-block;
}

.note-card.collapsed .note-collapse-icon {
    transform: rotate(-90deg);
}

.note-body {
    transition: max-height 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
}

.note-card.collapsed .note-body {
    display: none;
}

.note-card.collapsed .note-header {
    margin-bottom: 0;
}

.note-content {
    font-size: 0.875rem;
    white-space: pre-wrap;
}

/* Email HTML content styling */
.note-content img,
.ticket-detail-description img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
    margin: 0.5rem 0;
}

.note-content blockquote,
.ticket-detail-description blockquote {
    border-left: 3px solid #d1d5db;
    margin: 0.5rem 0;
    padding-left: 1rem;
    color: #6b7280;
}

.note-content a,
.ticket-detail-description a {
    color: #3b82f6;
    text-decoration: underline;
}

.note-content table,
.ticket-detail-description table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    display: block;
    overflow-x: auto;
}

.note-content pre,
.ticket-detail-description pre {
    overflow-x: auto;
    max-width: 100%;
}

.note-content img,
.ticket-detail-description img {
    max-width: 100%;
    height: auto;
}

.note-content td,
.note-content th,
.ticket-detail-description td,
.ticket-detail-description th {
    border: 1px solid #d1d5db;
    padding: 0.5rem;
}

.add-note-form {
    margin-top: 1rem;
}

.add-note-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    background: var(--card-bg);
    color: var(--text-primary);
}

/* Quill Editor Styling */
#note-editor {
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 0 0 6px 6px;
    min-height: 120px;
}

#note-editor .ql-editor {
    min-height: 120px;
}

#note-editor .ql-editor.ql-blank::before {
    color: var(--text-secondary);
    font-style: normal;
}

.ql-toolbar.ql-snow {
    border: 1px solid var(--border-color);
    border-radius: 6px 6px 0 0;
    background: var(--background);
}

.ql-container.ql-snow {
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

[data-theme="dark"] .ql-toolbar.ql-snow {
    border-color: var(--border-color);
}

[data-theme="dark"] .ql-container.ql-snow {
    border-color: var(--border-color);
}

[data-theme="dark"] .ql-toolbar .ql-stroke {
    stroke: var(--text-secondary);
}

[data-theme="dark"] .ql-toolbar .ql-fill {
    fill: var(--text-secondary);
}

[data-theme="dark"] .ql-toolbar .ql-picker {
    color: var(--text-secondary);
}

[data-theme="dark"] .ql-toolbar .ql-picker-options {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-toolbar .ql-picker-label:hover .ql-stroke {
    stroke: var(--primary-color);
}

[data-theme="dark"] .ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-toolbar .ql-picker-label:hover .ql-fill {
    fill: var(--primary-color);
}

[data-theme="dark"] .ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--primary-color);
}

[data-theme="dark"] .ql-toolbar button.ql-active .ql-fill {
    fill: var(--primary-color);
}

/* Project WYSIWYG Editors */
.wysiwyg-editor {
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 0 0 6px 6px;
    min-height: 150px;
}

.wysiwyg-editor .ql-editor {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
}

.wysiwyg-editor .ql-editor.ql-blank::before {
    color: var(--text-secondary);
    font-style: normal;
}

#project-description-editor .ql-editor {
    min-height: 180px;
}

#project-notes-editor .ql-editor {
    min-height: 120px;
}

/* Rich text content display */
.rich-text-content {
    line-height: 1.6;
}

.rich-text-content p {
    margin: 0 0 0.75em 0;
}

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

.rich-text-content ul,
.rich-text-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.rich-text-content li {
    margin: 0.25em 0;
}

.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3 {
    margin: 0.75em 0 0.5em 0;
    font-weight: 600;
}

.rich-text-content h1:first-child,
.rich-text-content h2:first-child,
.rich-text-content h3:first-child {
    margin-top: 0;
}

.rich-text-content a {
    color: var(--primary-color);
}

/* Note content styling for rich text */
.note-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.note-content h1,
.note-content h2,
.note-content h3 {
    margin: 0.5rem 0;
}

.note-content ul,
.note-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.note-content a {
    color: var(--primary-color);
}

/* Email HTML content dark mode fixes */
/* Force email content to be readable in dark mode by overriding inline styles */
[data-theme="dark"] .note-content,
[data-theme="dark"] .ticket-detail-description {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .note-content *:not(img):not(a),
[data-theme="dark"] .ticket-detail-description *:not(img):not(a) {
    color: inherit !important;
    background-color: transparent !important;
}

[data-theme="dark"] .note-content a,
[data-theme="dark"] .ticket-detail-description a {
    color: var(--primary-color) !important;
}

[data-theme="dark"] .note-content blockquote,
[data-theme="dark"] .ticket-detail-description blockquote {
    border-left-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .note-content td,
[data-theme="dark"] .note-content th,
[data-theme="dark"] .ticket-detail-description td,
[data-theme="dark"] .ticket-detail-description th {
    border-color: var(--border-color) !important;
}

.add-note-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.add-note-actions label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.add-note-actions label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--primary-color);
}

.add-note-actions label input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.send-email-option {
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

.send-sms-option {
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

/* Time Tracking in Notes */
.time-tracking-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--background);
    border-radius: 6px;
}

.time-tracking-row .form-group {
    margin-bottom: 0;
}

.time-tracking-row input[type="datetime-local"] {
    padding: 0.4rem;
    font-size: 0.8rem;
    background: var(--card-bg);
    color: var(--text-primary);
    color-scheme: light;
}

[data-theme="dark"] .time-tracking-row input[type="datetime-local"] {
    color-scheme: dark;
}

.duration-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    padding-top: 1.5rem;
}

.duration-display.has-time {
    color: var(--primary-color);
}

.note-time-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.note-time-range {
    font-size: 0.75rem;
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    background: #dbeafe;
    border-radius: 4px;
    display: inline-block;
}

.edit-time-entry-btn {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
}

.badge-non-billable {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.add-note-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Recent Section */
.recent-section {
    margin-top: 2rem;
}

.recent-section h3 {
    margin-bottom: 1rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 0.5rem;
}

.dashboard-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.dashboard-item .item-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
}

.dashboard-item .item-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-item .item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dashboard-item .item-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.dashboard-item .item-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dashboard-item.priority-high,
.dashboard-item.priority-critical {
    border-left: 3px solid var(--danger-color);
}

.dashboard-item.priority-medium {
    border-left: 3px solid var(--warning-color);
}

/* Mini Progress Bar */
.mini-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
}

.mini-progress-bar {
    height: 6px;
    background: var(--primary-color);
    border-radius: 3px;
    flex: 1;
}

.mini-progress span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 30px;
}

.badge-sm {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* iPad/Tablet Responsive (1024px) */
@media (max-width: 1024px) {
    /* Device info - stack screenshot and details */
    .device-info-layout {
        flex-direction: column;
    }

    .device-screenshot-container {
        flex: none;
        width: 100%;
        max-width: 400px;
    }

    /* Device tabs - allow horizontal scroll */
    .device-detail-tabs .tab-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }

    .device-detail-tabs .tab-btn {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
    }

    /* Form rows - single column on tablet */
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Responsive - Mobile (768px) */
@media (max-width: 768px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }

    .ticket-detail-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-left: 0;
        padding-top: 1.5rem;
    }

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

    .nav {
        overflow-x: auto;
    }

    .time-tracking-row {
        grid-template-columns: 1fr;
    }

    .duration-display {
        padding-top: 0;
    }

    /* Device modal - smaller screens */
    .device-screenshot-container {
        max-width: 100%;
    }

    .device-detail-tabs .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .device-detail-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .device-detail-actions .action-group-left,
    .device-detail-actions .action-group-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Region Badge in Header */
.region-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.user-menu-btn svg {
    transition: transform 0.2s;
}

.user-menu-btn.active svg {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
}

.dropdown-section {
    padding: 0.5rem;
}

.dropdown-label {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    transition: background-color 0.2s;
}

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

.dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.theme-option {
    position: relative;
}

.theme-check {
    margin-left: auto;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s;
}

.theme-option.active .theme-check {
    opacity: 1;
}

/* Toggle switch for dropdown settings */
.dropdown-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.dropdown-toggle-item:hover {
    background: var(--background);
}

.dropdown-toggle-item input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border-color);
    border-radius: 11px;
    transition: background-color 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dropdown-toggle-item input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.dropdown-toggle-item input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(18px);
}

/* ============ EXTENSION STATUS WIDGET ============ */
.extension-widget {
    position: relative;
}

.extension-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.extension-btn:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.ext-status-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ext-status-icon.status-available {
    background: var(--success-color);
    box-shadow: 0 0 4px var(--success-color);
}

.ext-status-icon.status-busy {
    background: var(--danger-color);
    box-shadow: 0 0 4px var(--danger-color);
    animation: pulse-busy 1.5s infinite;
}

.ext-status-icon.status-ringing {
    background: var(--warning-color);
    box-shadow: 0 0 4px var(--warning-color);
    animation: pulse-ring 0.5s infinite;
}

.ext-status-icon.status-away {
    background: var(--warning-color);
}

.ext-status-icon.status-dnd {
    background: var(--danger-color);
}

.ext-status-icon.status-lunch {
    background: #f97316;
}

.ext-status-icon.status-offline {
    background: var(--secondary-color);
}

@keyframes pulse-busy {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-ring {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.ext-number {
    font-weight: 500;
}

.extension-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    padding: 0.5rem 0;
}

.ext-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.ext-call-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.ext-call-badge.idle {
    background: var(--background);
    color: var(--text-secondary);
}

.ext-call-badge.busy {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

.ext-call-badge.ringing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.presence-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.presence-option:hover {
    background: var(--background);
}

.presence-option.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.presence-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.presence-dot.available {
    background: var(--success-color);
}

.presence-dot.away {
    background: var(--warning-color);
}

.presence-dot.dnd {
    background: var(--danger-color);
}

.presence-dot.lunch {
    background: #f97316;
}

.presence-dot.business-trip {
    background: #8b5cf6;
}

/* ============ NOTIFICATIONS WIDGET ============ */
.notifications-widget {
    position: relative;
}

.notifications-btn {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    position: relative;
}

.notifications-btn:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.notifications-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--background);
}

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

.notification-item.unread {
    background: rgba(37, 99, 235, 0.05);
}

.notification-item.unread:hover {
    background: rgba(37, 99, 235, 0.1);
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notification-icon.ticket {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
}

.notification-icon.due-date {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.notification-icon.follow-up {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.notification-icon.device {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

.notification-icon.system {
    background: rgba(100, 116, 139, 0.15);
    color: var(--secondary-color);
}

.notification-icon.chat {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

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

.notification-title {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.15rem;
    color: var(--text-primary);
}

.notification-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.notifications-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    max-width: 350px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    cursor: pointer;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Hide desktop logout button on mobile */
@media (max-width: 768px) {
    .header-right > #logout-btn {
        display: none;
    }

    .extension-widget {
        display: none;
    }
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.admin-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.admin-tab.active {
    background: var(--primary-color);
    color: white;
}

.admin-tab-content {
    min-height: 300px;
}

.admin-tab-content .page-header {
    margin-bottom: 1rem;
}

.admin-tab-content .page-header h3 {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Settings List (Statuses, Priorities, Regions) */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-item {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-item-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

.settings-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.settings-item-info strong {
    font-size: 0.9rem;
}

.settings-item-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.settings-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Badge Variants for Admin */
.badge-active {
    background: #d1fae5;
    color: #065f46;
}

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

.badge-default {
    background: #dbeafe;
    color: #1e40af;
}

/* Role Select in User Cards */
.role-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--card-bg);
}

/* Form Control for Ticket Detail */
.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Color Input Styling */
input[type="color"] {
    width: 60px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .admin-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* Invoicing Tabs */
.invoicing-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.invoicing-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.invoicing-tab.active {
    background: var(--primary-color);
    color: white;
}

.invoicing-tab-content {
    min-height: 300px;
}

/* Pending Charges Summary */
.pending-charges-summary {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pending-charges-summary span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#pending-selected-info {
    color: var(--primary-color);
    font-weight: 600;
}

/* Pending View Toggle */
.pending-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pending-view-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.pending-view-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.pending-view-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Charge Type Badges */
.charge-type-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    margin-right: 0.5rem;
}

.charge-type-time {
    background: #fef3c7;
    color: #b45309;
}

.charge-type-product {
    background: #dbeafe;
    color: #1d4ed8;
}

.charge-type-service {
    background: #dcfce7;
    color: #15803d;
}

.charge-type-custom {
    background: #fef3c7;
    color: #b45309;
}

.charge-type-expense {
    background: #fce7f3;
    color: #be185d;
}

.charge-type-project {
    background: #e0e7ff;
    color: #4338ca;
}

[data-theme="dark"] .charge-type-time {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

[data-theme="dark"] .charge-type-product {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .charge-type-service {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

[data-theme="dark"] .charge-type-custom {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

[data-theme="dark"] .charge-type-expense {
    background: rgba(236, 72, 153, 0.2);
    color: #f9a8d4;
}

[data-theme="dark"] .charge-type-project {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

/* Charge Amount Display */
.charge-amount {
    text-align: right;
}

.charge-amount small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Time Entry Cards for Invoicing */
.time-entry-selectable {
    background: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.time-entry-selectable:hover {
    border-color: var(--primary-color);
}

.time-entry-selectable.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

[data-theme="dark"] .time-entry-selectable.selected {
    background: rgba(59, 130, 246, 0.1);
}

.time-entry-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.time-entry-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.time-entry-ticket {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.time-entry-client {
    font-size: 0.8rem;
    color: var(--primary-color);
}

.time-entry-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.time-entry-meta {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.time-entry-date {
    margin-bottom: 0.25rem;
}

.time-entry-user {
    color: var(--text-secondary);
}

.time-entry-duration {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 80px;
    text-align: right;
}

/* Invoices List */
.invoices-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 1.5rem;
    align-items: center;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.invoice-card:hover {
    box-shadow: var(--shadow-lg);
}

.invoice-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.invoice-number {
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-client {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.invoice-notes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.invoice-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.invoice-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.invoice-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-status-draft {
    background: #e2e8f0;
    color: #475569;
}

.invoice-status-sent {
    background: #dbeafe;
    color: #1e40af;
}

.invoice-status-paid {
    background: #d1fae5;
    color: #065f46;
}

.invoice-status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.invoice-status-cancelled {
    background: #fef3c7;
    color: #92400e;
}

.invoice-status-approved {
    background: #d1fae5;
    color: #065f46;
}

.invoice-status-won {
    background: #d1fae5;
    color: #065f46;
}

/* Recurring Invoice Card */
.recurring-invoice-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 1.5rem;
    align-items: center;
}

.recurring-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recurring-client {
    font-weight: 600;
    color: var(--text-primary);
}

.recurring-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.recurring-schedule {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.recurring-next-date {
    font-size: 0.875rem;
    font-weight: 500;
}

.recurring-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Filter Date Inputs */
.filters input[type="date"] {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .filters input[type="date"] {
    color-scheme: dark;
}

/* Disabled button styling */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive invoicing */
@media (max-width: 768px) {
    .invoicing-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .time-entry-selectable {
        grid-template-columns: auto 1fr;
        gap: 0.75rem;
    }

    .time-entry-meta,
    .time-entry-duration {
        grid-column: 2;
    }

    .invoice-card,
    .recurring-invoice-card {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .pending-charges-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* =====================================================
   EMAIL SETTINGS STYLES
   ===================================================== */

.email-settings-container {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.email-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.email-sub-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.email-sub-tab:hover {
    color: var(--text-primary);
    background: var(--background);
}

.email-sub-tab.active {
    color: var(--primary-color);
    background: var(--background);
    font-weight: 500;
}

.email-sub-content {
    padding-top: 1rem;
}

.email-config-form {
    max-width: 800px;
}

.email-config-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.email-config-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.email-config-form .form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.email-config-form .form-group input,
.email-config-form .form-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.email-config-form .form-group input:focus,
.email-config-form .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.email-config-form .checkbox-group {
    display: flex;
    align-items: center;
    padding-top: 1.5rem;
}

.email-config-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.email-config-form .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.email-config-form .form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.config-status {
    margin-top: 1rem;
    font-size: 0.875rem;
}

.config-status:empty {
    display: none;
}

.config-status .success-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.config-status .error-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.config-status .loading {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.config-status.success {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.config-status.error {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.config-status.info {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.config-status.warning {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
}

/* Email Filters */
.filter-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.email-config-form textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: monospace;
    background: var(--card-bg);
    color: var(--text-primary);
    resize: vertical;
}

.email-config-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    color: var(--warning-color);
}

/* Email Section */
.email-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.email-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.email-section .page-header {
    margin-bottom: 12px;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Graph API Setup Box */
.graph-setup-box {
    background: var(--card-bg);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
}

.graph-setup-box h4 {
    margin: 0 0 12px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.graph-setup-box p {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.graph-setup-box ul {
    margin: 0 0 16px 20px;
    padding: 0;
    color: var(--text-secondary);
}

.graph-setup-box li {
    margin-bottom: 4px;
}

.graph-setup-progress {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
}

.graph-setup-progress h5 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.graph-setup-progress .device-code-box {
    background: var(--card-bg);
    border: 2px dashed var(--primary-color);
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    margin: 12px 0;
}

.graph-setup-progress .device-code {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.graph-setup-progress .auth-link {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.graph-setup-progress .auth-link:hover {
    background: var(--primary-hover);
}

.graph-setup-progress .status-message {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.graph-setup-progress .status-message.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.graph-setup-progress .status-message.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.graph-setup-progress .status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.polling-status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--background);
    border: 1px solid var(--border-color);
}

.polling-status .status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.polling-status .status-indicator.running {
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.polling-status .status-indicator.stopped {
    background: var(--text-secondary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Email Templates List */
.templates-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.template-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

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

.template-card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.template-type-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
}

.template-card-subject {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.template-card-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 4px;
    max-height: 80px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.template-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Email Logs */
.email-logs-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.email-logs-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.email-logs-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.email-stat {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    text-align: center;
    min-width: 100px;
}

.email-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.email-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.email-logs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.email-log-item {
    display: grid;
    grid-template-columns: auto 100px 1fr 120px auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

.email-log-direction {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.email-log-direction.inbound {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.email-log-direction.outbound {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.email-log-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.email-log-status.sent,
.email-log-status.processed {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.email-log-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.email-log-status.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.email-log-subject {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-log-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.email-log-actions {
    display: flex;
    gap: 0.5rem;
}

/* Mailboxes Management */
.mailboxes-info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.mailboxes-info p {
    margin: 0 0 0.5rem 0;
}

.mailboxes-info p:last-child {
    margin-bottom: 0;
}

.mailboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.mailbox-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mailbox-card.inactive {
    opacity: 0.6;
}

.mailbox-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mailbox-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mailbox-type-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
}

.mailbox-type-badge.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.mailbox-type-badge.shared {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.mailbox-card-address {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.mailbox-card-provider .provider-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.mailbox-card-provider .provider-badge.graph_api {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.mailbox-card-provider .provider-badge.imap {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.mailbox-card-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mailbox-card-defaults {
    color: var(--text-secondary);
}

.mailbox-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Mailbox Polling Toggle */
.mailbox-card-polling {
    margin: 0.5rem 0;
}

.polling-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.polling-toggle input[type="checkbox"] {
    display: none;
}

.polling-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.polling-toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
}

.polling-toggle input:checked + .polling-toggle-slider {
    background: var(--primary);
}

.polling-toggle input:checked + .polling-toggle-slider::after {
    transform: translateX(16px);
}

.polling-toggle-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.polling-toggle input:checked ~ .polling-toggle-label {
    color: var(--primary);
}

/* Status indicator for paused polling */
.status-indicator.paused {
    background-color: #f59e0b;
}

/* Template Edit Modal */
.template-edit-form .form-group {
    margin-bottom: 1rem;
}

.template-edit-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.template-edit-form input,
.template-edit-form textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.template-edit-form textarea {
    min-height: 200px;
    font-family: monospace;
    resize: vertical;
}

.template-variables-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.template-variables-hint code {
    background: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* Responsive email settings */
@media (max-width: 768px) {
    .email-config-form .form-row {
        grid-template-columns: 1fr;
    }

    .email-config-form .checkbox-group {
        padding-top: 0;
    }

    .email-log-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .email-logs-stats {
        flex-direction: column;
    }
}

/* =====================================================
   PRODUCTS/SERVICES MODULE STYLES
   ===================================================== */

/* Products/Services Sub-tabs */
.ps-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.ps-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.ps-tab.active {
    background: var(--primary-color);
    color: white;
}

.ps-tab-content {
    min-height: 300px;
}

.purchasing-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.purchasing-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.purchasing-tab.active {
    background: var(--primary-color);
    color: white;
}

.purchasing-tab-content {
    min-height: 300px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Products List (row-based like clients) */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-row-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.product-row-card:hover {
    box-shadow: var(--shadow-lg);
}

.product-row-card.inactive {
    opacity: 0.6;
}

.product-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.product-row-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-row-name strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.product-row-sku {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.product-row-description {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    padding: 0 1rem;
}

.product-row-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.product-row-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    align-items: center;
}

.product-row-price {
    font-weight: 600;
    color: var(--primary-color);
}

.product-row-stock {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.product-row-stock.low-stock {
    color: var(--warning-color);
    font-weight: 600;
}

.product-row-category {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
}

/* Price Check Modal */
.price-check-container {
    min-height: 300px;
}

.price-check-results {
    margin-top: 1.5rem;
}

.price-check-current {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.price-check-current h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

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

.price-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 6px;
    text-align: center;
}

.price-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.price-check-suppliers h4 {
    margin-bottom: 0.5rem;
}

.price-check-suppliers .search-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.price-diff {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.price-diff.higher {
    background: #fee2e2;
    color: #dc2626;
}

.price-diff.lower {
    background: #dcfce7;
    color: #16a34a;
}

[data-theme="dark"] .price-diff.higher {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

[data-theme="dark"] .price-diff.lower {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

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

.price-check-stats {
    display: flex;
    gap: 1.5rem;
}

.price-check-stats .stat {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.price-check-stats .stat strong {
    color: var(--text-primary);
}

.price-check-stats .stat.has-changes strong {
    color: var(--warning-color);
}

.price-check-table {
    font-size: 0.875rem;
}

.price-check-table code {
    font-size: 0.75rem;
    background: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.price-check-table tr.has-change {
    background: rgba(245, 158, 11, 0.05);
}

[data-theme="dark"] .price-check-table tr.has-change {
    background: rgba(245, 158, 11, 0.1);
}

.price-check-table .supplier-select {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    max-width: 150px;
}

.price-same {
    color: var(--text-secondary);
}

.price-check-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.product-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.product-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.product-card-sku {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.product-card-category {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    color: var(--text-secondary);
}

.product-card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.product-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-card-cost {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.product-card-inventory {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.product-stock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stock-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stock-indicator.in-stock {
    background: var(--success-color);
}

.stock-indicator.low-stock {
    background: var(--warning-color);
}

.stock-indicator.out-of-stock {
    background: var(--danger-color);
}

.stock-label {
    color: var(--text-secondary);
}

.stock-count {
    font-weight: 600;
    color: var(--text-primary);
}

.product-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* Product Detail View */
.product-detail-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.product-detail-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.product-detail-info .product-sku {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.product-detail-info .product-description {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.product-detail-stats {
    display: flex;
    gap: 1rem;
}

.stat-box {
    background: var(--secondary-bg);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    min-width: 80px;
}

.stat-box.stat-warning {
    background: rgba(239, 68, 68, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.product-detail-section {
    margin-top: 1rem;
}

.product-detail-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Data Table for serial numbers and movements */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.data-table th {
    background: var(--secondary-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: var(--secondary-bg);
}

.data-table .notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.text-success {
    color: #10b981;
}

.text-danger {
    color: #ef4444;
}

.badge-info {
    background: #3b82f6;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-danger {
    background: #ef4444;
    color: white;
}

.badge-secondary {
    background: var(--text-secondary);
    color: white;
}

/* Services List */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.service-item {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 1.5rem;
    align-items: center;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.service-item:hover {
    box-shadow: var(--shadow-lg);
}

.service-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.service-name {
    font-weight: 600;
    color: var(--text-primary);
}

.service-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.service-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-pricing {
    text-align: right;
}

.service-rate {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
}

.service-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.service-duration {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: center;
}

.service-actions {
    display: flex;
    gap: 0.5rem;
}

/* Categories List */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-row {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s, background-color 0.2s;
}

.category-row:hover {
    box-shadow: var(--shadow-lg);
    background-color: var(--background);
}

.category-row.inactive {
    opacity: 0.6;
}

.category-row.subcategory {
    margin-left: 2rem;
    border-left: 3px solid var(--primary-color);
}

.category-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-row-name {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.category-row-name strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.category-row-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.category-row-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.category-row-sort {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.category-row-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.subcategory-indent {
    color: var(--primary-color);
    margin-right: 0.25rem;
    font-weight: bold;
    font-size: 1rem;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-static-text {
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
    padding: 0.5rem 0;
}

/* Suppliers Grid */
.suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.25rem;
}

.supplier-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.supplier-card:hover {
    box-shadow: var(--shadow-lg);
}

.supplier-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.supplier-card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.supplier-card-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.supplier-card-contact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.supplier-card-contact a {
    color: var(--primary-color);
    text-decoration: none;
}

.supplier-card-contact a:hover {
    text-decoration: underline;
}

.supplier-card-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 4px;
}

.supplier-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.supplier-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.supplier-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Purchase List (for requests and orders) */
.purchase-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.purchase-item {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 1.5rem;
    align-items: center;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.purchase-item:hover {
    box-shadow: var(--shadow-lg);
}

.purchase-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.purchase-number-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.purchase-notes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.purchase-number {
    font-weight: 600;
    color: var(--text-primary);
}

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

.purchase-supplier,
.purchase-requester {
    font-size: 0.875rem;
    color: var(--primary-color);
}

.purchase-total {
    text-align: right;
}

.purchase-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.purchase-items-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.purchase-actions {
    display: flex;
    gap: 0.5rem;
}

/* Purchase Status Badges */
.purchase-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Purchase Request Statuses */
.purchase-status-draft {
    background: #e2e8f0;
    color: #475569;
}

.purchase-status-submitted {
    background: #dbeafe;
    color: #1e40af;
}

.purchase-status-approved {
    background: #d1fae5;
    color: #065f46;
}

.purchase-status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.purchase-status-ordered {
    background: #e0e7ff;
    color: #3730a3;
}

.purchase-status-cancelled {
    background: #fef3c7;
    color: #92400e;
}

/* Purchase Order Statuses */
.purchase-status-confirmed {
    background: #cffafe;
    color: #0e7490;
}

.purchase-status-partial {
    background: #fef3c7;
    color: #92400e;
}

.purchase-status-received {
    background: #d1fae5;
    color: #065f46;
}

.purchase-status-complete {
    background: #bbf7d0;
    color: #166534;
}

/* Purchase status classes (space-separated variant) */
.purchase-status.draft {
    background: #e2e8f0;
    color: #475569;
}

.purchase-status.submitted {
    background: #dbeafe;
    color: #1e40af;
}

.purchase-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.purchase-status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.purchase-status.ordered {
    background: #e0e7ff;
    color: #3730a3;
}

.purchase-status.confirmed {
    background: #cffafe;
    color: #0e7490;
}

.purchase-status.partial {
    background: #fef3c7;
    color: #92400e;
}

.purchase-status.received {
    background: #d1fae5;
    color: #065f46;
}

.purchase-status.complete {
    background: #bbf7d0;
    color: #166534;
}

.purchase-status.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* Bills List */
.bills-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bill-item {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 1.5rem;
    align-items: center;
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.bill-item:hover {
    box-shadow: var(--shadow-lg);
}

.bill-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bill-number {
    font-weight: 600;
    color: var(--text-primary);
}

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

.bill-supplier {
    font-size: 0.875rem;
    color: var(--primary-color);
}

.bill-total {
    text-align: right;
}

.bill-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.bill-items-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.bill-due-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.bill-due-date.overdue {
    color: var(--danger-color);
    font-weight: 600;
}

/* Bill Status Badges */
.bill-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.bill-status.draft {
    background: #e2e8f0;
    color: #475569;
}

.bill-status.approved {
    background: #dbeafe;
    color: #1e40af;
}

.bill-status.paid {
    background: #d1fae5;
    color: #065f46;
}

.bill-status.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* Bill Detail View */
.bill-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.bill-detail .bill-header h3 {
    margin: 0;
}

.bill-detail .bill-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.bill-detail .bill-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bill-detail .bill-info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.bill-detail .bill-info-value {
    font-weight: 500;
}

.bill-detail .bill-items {
    margin-top: 1rem;
}

.bill-detail .bill-items h4 {
    margin-bottom: 0.75rem;
}

.bill-detail .bill-totals {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    text-align: right;
}

.bill-detail .bill-totals p {
    margin: 0.25rem 0;
}

.bill-detail .bill-totals .total-row {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Bill Attachments */
.bill-attachments {
    margin-top: 1rem;
}

.bill-attachments h4 {
    margin-bottom: 0.75rem;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.attachment-item .attachment-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
}

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

.attachment-item .file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #e74c3c;
    flex-shrink: 0;
}

.attachment-item .attachment-size {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.bill-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.bill-dropzone p {
    margin: 0;
}

.bill-dropzone .upload-link {
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
}

.bill-dropzone .upload-link:hover {
    text-decoration: underline;
}

.bill-dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    color: var(--primary-color);
}

/* Items Table in Modal */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.items-table thead {
    background: var(--background);
}

.items-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.items-table th:last-child,
.items-table td:last-child {
    text-align: right;
}

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

.items-table tbody tr:hover {
    background: var(--background);
}

.items-table .item-product {
    font-weight: 500;
}

.items-table .item-sku {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.items-table .item-qty {
    font-weight: 600;
}

.items-table .item-amount {
    font-weight: 600;
    color: var(--primary-color);
}

.items-table tfoot {
    font-weight: 600;
}

.items-table tfoot td {
    padding-top: 1rem;
    border-bottom: none;
}

.items-table.compact {
    font-size: 0.8rem;
}

.items-table.compact th,
.items-table.compact td {
    padding: 0.5rem;
}

/* Purchase Order Import Requests Section */
.po-import-requests {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
}

.po-import-requests h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.po-import-requests .help-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.available-requests-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.available-requests-list .checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
}

.available-requests-list .checkbox-item:hover {
    border-color: var(--primary-color);
}

.available-requests-list .checkbox-item input {
    margin-top: 0.25rem;
}

.available-requests-list .checkbox-item span {
    flex: 1;
}

.available-requests-list .pr-details {
    flex: 1;
}

.available-requests-list .pr-notes {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.available-requests-list .pr-items-list {
    margin: 0.5rem 0 0 0;
    padding-left: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.available-requests-list .pr-items-list li {
    margin-bottom: 0.125rem;
}

/* Purchase Order Serial Numbers Section */
.po-serials {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.po-serials h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.serial-group {
    margin-bottom: 1rem;
}

.serial-group h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.serial-group:last-child {
    margin-bottom: 0;
}

/* Serial status badges */
.badge.in_stock {
    background: #dcfce7;
    color: #166534;
}

.badge.sold {
    background: #dbeafe;
    color: #1e40af;
}

.badge.returned {
    background: #fef3c7;
    color: #92400e;
}

.badge.defective {
    background: #fee2e2;
    color: #991b1b;
}

.badge.reserved {
    background: #f3e8ff;
    color: #7c3aed;
}

/* Purchase Detail Section */
.purchase-detail-section {
    margin-bottom: 1.5rem;
}

.purchase-detail-section h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.purchase-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.purchase-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.purchase-detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.purchase-detail-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* Add Item Form */
.add-item-form {
    background: var(--background);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.add-item-form .form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.add-item-form .form-group {
    margin-bottom: 0;
}

.add-item-form .form-group label {
    font-size: 0.75rem;
}

.add-item-form .form-group input,
.add-item-form .form-group select {
    padding: 0.4rem 0.5rem;
    font-size: 0.875rem;
}

/* Stock Adjustment Modal */
.stock-adjustment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stock-current {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.stock-current-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stock-current-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Category Filter Pills */
.category-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.category-pill {
    padding: 0.375rem 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.category-pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Product/Service Inactive Badge */
.badge-product-inactive {
    background: #fecaca;
    color: #991b1b;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Inventory Badge */
.badge-inventory {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.badge-serial {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* Search Input in Filters */
.filters input[type="text"] {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    min-width: 320px;
}

.filters input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Responsive Products/Services */
@media (max-width: 768px) {
    .ps-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .purchasing-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .suppliers-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .service-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .service-pricing,
    .service-duration {
        text-align: left;
    }

    .purchase-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .purchase-total {
        text-align: left;
    }

    .add-item-form .form-row {
        grid-template-columns: 1fr;
    }

    .purchase-detail-grid {
        grid-template-columns: 1fr;
    }

    .items-table {
        display: block;
        overflow-x: auto;
    }
}

/* =====================================================
   TOOLS PAGE STYLES
   ===================================================== */

/* Tools Tabs */
.tools-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tools-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.tools-tab.active {
    background: var(--primary-color);
    color: white;
}

.tools-tab-content {
    min-height: 300px;
}

/* TTS Container */
.tts-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
}

.tts-form-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.tts-form-section textarea {
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
}

.tts-actions {
    margin-top: 1rem;
}

.tts-actions .btn {
    min-width: 150px;
}

#generate-tts-btn .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

#generate-tts-btn .btn-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tts-spin 0.8s linear infinite;
}

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

/* TTS Preview */
.tts-preview-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 1.5rem;
}

.tts-preview-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tts-preview-section audio {
    width: 100%;
    margin-bottom: 1rem;
}

.tts-preview-actions {
    display: flex;
    gap: 0.5rem;
}

/* TTS Info Panel */
.tts-info {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: start;
}

.tts-info h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tts-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tts-info li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.tts-info li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.tts-info .text-secondary {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Info Banner (for configuration warnings) */
.info-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-banner a {
    color: var(--primary-color);
    font-weight: 500;
}

[data-theme="dark"] .info-banner {
    background: #422006;
    border-color: #b45309;
    color: #fef3c7;
}

/* Responsive TTS */
@media (max-width: 768px) {
    .tts-container {
        grid-template-columns: 1fr;
    }

    .tts-info {
        grid-column: 1;
        grid-row: auto;
    }

    .tools-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* =====================================================
   TICKET CHARGES STYLES
   ===================================================== */

/* Charges Section */
.charges-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.charges-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.charges-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Charge Card */
.charge-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.charge-card:hover {
    border-color: var(--primary-color);
}

/* Charge Type Badge */
.charge-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: 4px;
    min-width: 60px;
}

.charge-type-product {
    background: #dbeafe;
    color: #1d4ed8;
}

.charge-type-service {
    background: #dcfce7;
    color: #16a34a;
}

.charge-type-expense {
    background: #fef3c7;
    color: #d97706;
}

.charge-type-custom {
    background: #f3e8ff;
    color: #9333ea;
}

[data-theme="dark"] .charge-type-product {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .charge-type-service {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

[data-theme="dark"] .charge-type-expense {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .charge-type-custom {
    background: rgba(147, 51, 234, 0.2);
    color: #c084fc;
}

/* Charge Info */
.charge-info {
    flex: 1;
    min-width: 0;
}

.charge-description {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charge-non-billable {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--secondary-color);
    color: white;
    border-radius: 3px;
}

/* Charge Details */
.charge-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.charge-qty {
    white-space: nowrap;
}

.charge-amount {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 80px;
    text-align: right;
}

/* Charge Actions */
.charge-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.charge-card:hover .charge-actions {
    opacity: 1;
}

.charge-actions button {
    padding: 0.375rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.2s;
}

.charge-actions button:hover {
    background: var(--card-bg);
}

.charge-actions .edit-btn:hover {
    color: var(--primary-color);
}

.charge-actions .delete-btn:hover {
    color: var(--danger-color);
}

/* Grouped charge children */
.charge-group-child {
    border-left: 3px solid var(--primary-color);
    margin-left: 0.5rem;
    background: var(--card-bg);
}

.charge-group-items {
    transition: all 0.2s;
}

/* Charges Total */
.charges-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.75rem;
}

.charges-total-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.charges-total-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Empty Charges State */
.no-charges {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--background);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

/* Purchase Requests Section */
.purchase-requests-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.purchase-requests-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.pr-links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Purchase Request Link Card */
.pr-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pr-link-card:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.pr-link-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pr-number {
    font-weight: 600;
    color: var(--primary-color);
}

.pr-total {
    font-weight: 500;
    color: var(--text-primary);
}

/* Add Charge Modal Specific Styles */
.charge-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.charge-type-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.charge-type-btn:hover {
    border-color: var(--primary-color);
}

.charge-type-btn.active {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

[data-theme="dark"] .charge-type-btn.active {
    background: rgba(59, 130, 246, 0.2);
}

/* Stock Warning */
.stock-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

[data-theme="dark"] .stock-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.stock-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .charge-card {
        flex-wrap: wrap;
    }

    .charge-details {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }

    .charge-actions {
        opacity: 1;
    }

    .charges-total {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }

    .charge-type-selector {
        flex-direction: column;
    }
}

/* =====================================================
   SUPPLIER DETAIL VIEW STYLES
   ===================================================== */

.supplier-detail-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Supplier Detail Tabs */
.supplier-detail-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    margin-bottom: 1rem;
}

.supplier-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

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

.supplier-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

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

.supplier-tab-content.hidden {
    display: none;
}

/* Supplier Info Grid */
.supplier-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-section p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.detail-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail-section a:hover {
    text-decoration: underline;
}

/* Client Detail Tabs - already handled in main definition */

.client-tab-content.hidden {
    display: none;
}

/* ============ Data Export/Import ============ */
.data-management-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.data-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.data-section h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.export-controls,
.import-controls {
    margin-top: 1rem;
}

.export-controls .form-group,
.import-controls .form-group {
    margin-bottom: 1rem;
}

.export-controls .btn,
.import-controls .btn {
    margin-right: 0.5rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.target-preview {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.target-preview-list {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

#targeting-filters {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#policy-target-clients {
    width: 100%;
    min-height: 100px;
}

.export-status,
.import-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    background: var(--background);
}

.success-message {
    color: var(--success-color);
    font-weight: 500;
}

.error-message {
    color: var(--danger-color);
}

.import-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.import-preview h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.import-preview-json {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.import-results h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.import-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.import-stats .stat-item {
    display: flex;
    gap: 0.5rem;
}

.import-stats .stat-label {
    color: var(--text-secondary);
}

.import-stats .stat-value {
    font-weight: 600;
}

.import-stats .stat-value.success {
    color: var(--success-color);
}

.import-stats .stat-value.info {
    color: var(--primary-color);
}

.import-stats .stat-value.warning {
    color: var(--warning-color);
}

.import-errors {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
}

.import-errors h5 {
    color: var(--danger-color);
    margin-bottom: 0.5rem;
}

.import-errors ul {
    margin: 0;
    padding-left: 1.5rem;
    font-size: 0.875rem;
}

.import-errors li {
    margin-bottom: 0.25rem;
}

/* ============ Integrations ============ */
.integrations-container {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.integration-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.integration-sub-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.integration-sub-tab:hover {
    color: var(--text-primary);
    background: var(--background);
}

.integration-sub-tab.active {
    color: var(--primary-color);
    background: var(--background);
    font-weight: 500;
}

.integration-sub-content {
    padding-top: 1rem;
}

/* OpenAI Internal Subtabs */
.openai-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.openai-subtab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.openai-subtab:hover {
    color: var(--text-primary);
    background: var(--background);
}

.openai-subtab.active {
    color: var(--primary-color);
    background: var(--background);
    font-weight: 500;
}

.integration-config-form {
    max-width: 800px;
}

.integration-config-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.integration-config-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.integration-config-form .form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.integration-config-form .form-group input,
.integration-config-form .form-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.integration-config-form .form-group input:focus,
.integration-config-form .form-group select:focus,
.integration-config-form .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.integration-config-form .form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    width: 100%;
}

.integration-config-form .checkbox-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0;
}

.integration-config-form .checkbox-group-inline .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.integration-config-form .checkbox-group-inline .checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.integration-config-form .form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sync-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 6px;
}

.sync-status h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Sync Status Badges - styled to match integration badges */
.sync-status-success {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.sync-status-error {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.sync-status-warning {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.sync-status-pending {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.xero-sync-info {
    padding: 8px;
    margin-top: 5px;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* OAuth Status Section */
.oauth-status-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.oauth-status-header h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.oauth-info {
    margin-bottom: 1rem;
}

.oauth-info p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.oauth-authenticated,
.oauth-not-authenticated,
.oauth-warning {
    padding: 0.75rem;
    border-radius: 6px;
}

.oauth-authenticated {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid #22c55e;
}

.oauth-not-authenticated {
    background: rgba(100, 116, 139, 0.1);
    border-left: 3px solid var(--text-secondary);
}

.oauth-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
}

.oauth-status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.oauth-status-badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.oauth-status-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.oauth-status-badge:not(.success):not(.warning) {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.oauth-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.info-message {
    padding: 0.75rem 1rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* CSP Customer Mapping Styles */
.csp-customers-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.csp-customers-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.csp-customers-section .section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.csp-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.csp-stats .stat-item strong {
    color: var(--text-primary);
}

.csp-filter-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.csp-filter-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.csp-filter-row input[type="text"] {
    flex: 1;
    max-width: 300px;
}

.csp-customers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.csp-customer-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    align-items: center;
}

.csp-customer-row:hover {
    border-color: var(--primary-color);
}

.csp-customer-info h5 {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.csp-customer-info .csp-customer-domain {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.csp-customer-mapping {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.csp-customer-mapping select {
    min-width: 200px;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.csp-customer-mapping .mapped-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.csp-customer-mapping .unmapped-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.csp-customer-actions {
    display: flex;
    gap: 0.5rem;
}

.csp-subscription-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.csp-subscription-count:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Make customer info clickable */
.csp-customer-clickable {
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0.25rem;
    border-radius: 4px;
    margin: -0.25rem;
}

.csp-customer-clickable:hover {
    background-color: var(--hover-color, rgba(0, 0, 0, 0.05));
}

/* CSP Sync Status Badges */
.csp-sync-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

.sync-badge-success {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
}

.sync-badge-warning {
    background-color: rgba(234, 179, 8, 0.15);
    color: rgb(161, 98, 7);
}

.sync-badge-error {
    background-color: rgba(239, 68, 68, 0.15);
    color: rgb(220, 38, 38);
}

.sync-badge-info {
    background-color: rgba(59, 130, 246, 0.15);
    color: rgb(37, 99, 235);
}

.sync-badge-pending {
    background-color: rgba(107, 114, 128, 0.15);
    color: rgb(75, 85, 99);
}

/* Dark mode sync badges */
[data-theme="dark"] .sync-badge-success {
    background-color: rgba(34, 197, 94, 0.25);
    color: rgb(74, 222, 128);
}

[data-theme="dark"] .sync-badge-warning {
    background-color: rgba(234, 179, 8, 0.25);
    color: rgb(250, 204, 21);
}

[data-theme="dark"] .sync-badge-error {
    background-color: rgba(239, 68, 68, 0.25);
    color: rgb(248, 113, 113);
}

[data-theme="dark"] .sync-badge-info {
    background-color: rgba(59, 130, 246, 0.25);
    color: rgb(96, 165, 250);
}

[data-theme="dark"] .sync-badge-pending {
    background-color: rgba(107, 114, 128, 0.25);
    color: rgb(156, 163, 175);
}

/* Dark mode standard badge colors */
[data-theme="dark"] .badge-success {
    background-color: rgba(34, 197, 94, 0.25);
    color: rgb(74, 222, 128);
}

[data-theme="dark"] .badge-warning {
    background-color: rgba(234, 179, 8, 0.25);
    color: rgb(250, 204, 21);
}

[data-theme="dark"] .badge-danger {
    background-color: rgba(239, 68, 68, 0.25);
    color: rgb(248, 113, 113);
}

[data-theme="dark"] .badge-info {
    background-color: rgba(59, 130, 246, 0.25);
    color: rgb(96, 165, 250);
}

[data-theme="dark"] .badge-secondary {
    background-color: rgba(107, 114, 128, 0.25);
    color: rgb(156, 163, 175);
}

/* Contacts Preview Styles */
.contacts-preview-section .btn {
    margin-bottom: 1rem;
}

.contacts-preview-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 6px;
}

.contacts-preview-stats .stat-item {
    font-size: 0.85rem;
}

.contacts-preview-stats .stat-item strong {
    color: var(--primary-color, #0d6efd);
}

.user-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: capitalize;
}

.user-type-badge.member {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
}

.user-type-badge.guest {
    background-color: rgba(234, 179, 8, 0.15);
    color: rgb(161, 98, 7);
}

.guest-row {
    opacity: 0.7;
}

[data-theme="dark"] .contacts-preview-stats {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .user-type-badge.member {
    background-color: rgba(34, 197, 94, 0.25);
    color: rgb(74, 222, 128);
}

[data-theme="dark"] .user-type-badge.guest {
    background-color: rgba(234, 179, 8, 0.25);
    color: rgb(250, 204, 21);
}

/* License display styles */
.license-count {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(59, 130, 246, 0.15);
    color: rgb(37, 99, 235);
    cursor: help;
}

.no-license {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(156, 163, 175, 0.15);
    color: rgb(107, 114, 128);
}

[data-theme="dark"] .license-count {
    background-color: rgba(59, 130, 246, 0.25);
    color: rgb(96, 165, 250);
}

[data-theme="dark"] .no-license {
    background-color: rgba(107, 114, 128, 0.25);
    color: rgb(156, 163, 175);
}

/* Contact license tags */
.contact-licenses {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.contact-licenses .license-label {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    margin-right: 0.25rem;
}

.license-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(59, 130, 246, 0.12);
    color: rgb(37, 99, 235);
    white-space: nowrap;
}

[data-theme="dark"] .license-tag {
    background-color: rgba(59, 130, 246, 0.2);
    color: rgb(96, 165, 250);
}

/* Contact card styles */
.contact-card .settings-item-info {
    flex-direction: column;
    align-items: flex-start;
}

.contact-card:hover {
    background-color: var(--bg-hover, rgba(0, 0, 0, 0.02));
}

[data-theme="dark"] .contact-card:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Small license badges on contact list */
.contact-license-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.license-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background-color: rgba(59, 130, 246, 0.12);
    color: rgb(37, 99, 235);
    cursor: default;
}

.license-badge.license-more {
    background-color: rgba(107, 114, 128, 0.15);
    color: rgb(107, 114, 128);
}

[data-theme="dark"] .license-badge {
    background-color: rgba(59, 130, 246, 0.2);
    color: rgb(96, 165, 250);
}

[data-theme="dark"] .license-badge.license-more {
    background-color: rgba(107, 114, 128, 0.25);
    color: rgb(156, 163, 175);
}

/* Contact view modal styles */
.contact-view .field-value {
    padding: 0.5rem;
    background-color: var(--bg-secondary, #f8f9fa);
    border-radius: 4px;
    min-height: 1.5rem;
}

[data-theme="dark"] .contact-view .field-value {
    background-color: rgba(255, 255, 255, 0.05);
}

.contact-sync-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(59, 130, 246, 0.08);
    border-radius: 6px;
}

.contact-sync-info .text-muted {
    font-size: 0.8rem;
}

.contact-licenses-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.license-item {
    padding: 0.5rem 0.75rem;
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid rgb(59, 130, 246);
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

[data-theme="dark"] .license-item {
    background-color: rgba(59, 130, 246, 0.15);
}

.primary-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

[data-theme="dark"] .primary-badge {
    background-color: rgba(34, 197, 94, 0.2);
    color: rgb(74, 222, 128);
}

/* Contact filters */
.contacts-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background-color: var(--bg-secondary, #f8f9fa);
    border-radius: 6px;
}

.contacts-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contacts-filters .filter-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.filter-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    background-color: var(--bg-primary, #fff);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background-color: var(--bg-hover, #f3f4f6);
}

.filter-btn.active {
    background-color: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: #fff;
}

.filter-select {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    background-color: var(--bg-primary, #fff);
}

.filter-group-search {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.contact-search-input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    background-color: var(--bg-primary, #fff);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.contact-search-input:focus {
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.contact-search-input::placeholder {
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .contact-search-input {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .contact-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .contacts-filters {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .filter-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="dark"] .filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .filter-select {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* User type pills */
.user-type-pill {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 500;
    margin-left: 0.25rem;
}

.user-type-pill.licensed {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
}

.user-type-pill.unlicensed {
    background-color: rgba(239, 68, 68, 0.15);
    color: rgb(185, 28, 28);
}

.user-type-pill.shared {
    background-color: rgba(168, 85, 247, 0.15);
    color: rgb(126, 34, 206);
}

.user-type-pill.external {
    background-color: rgba(107, 114, 128, 0.15);
    color: rgb(75, 85, 99);
}

[data-theme="dark"] .user-type-pill.licensed {
    background-color: rgba(34, 197, 94, 0.25);
    color: rgb(74, 222, 128);
}

[data-theme="dark"] .user-type-pill.shared {
    background-color: rgba(168, 85, 247, 0.25);
    color: rgb(192, 132, 252);
}

[data-theme="dark"] .user-type-pill.external {
    background-color: rgba(107, 114, 128, 0.25);
    color: rgb(156, 163, 175);
}

/* CSP Sync Details Modal Styles */
.csp-sync-details {
    max-height: 70vh;
    overflow-y: auto;
}

.csp-sync-details .sync-details-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.csp-sync-details .section-header h4 {
    margin: 0;
}

.sync-capabilities,
.sync-issues {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
}

.sync-capabilities {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.sync-issues {
    background-color: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.sync-capabilities h4,
.sync-issues h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.sync-capabilities ul,
.sync-issues ul {
    margin: 0;
    padding-left: 1.25rem;
}

.sync-capabilities li,
.sync-issues li {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.capability-ok {
    color: rgb(22, 163, 74);
}

.issue-warning {
    color: rgb(161, 98, 7);
}

.sync-summary {
    margin-bottom: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.summary-card {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color, #0066cc);
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d);
    margin-top: 0.25rem;
}

.sync-customer-info {
    margin-bottom: 1.5rem;
}

.info-table {
    width: 100%;
    font-size: 0.85rem;
}

.info-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.info-table td:first-child {
    width: 140px;
    color: var(--text-secondary, #6c757d);
}

.sync-section {
    margin-bottom: 1.5rem;
}

.sync-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding-bottom: 0.5rem;
}

.sync-section .data-table {
    font-size: 0.8rem;
}

.sync-section .data-table th,
.sync-section .data-table td {
    padding: 0.4rem 0.5rem;
}

.sync-section code {
    font-size: 0.75rem;
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-primary, #212529);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    border: 1px solid var(--border-color, #dee2e6);
}

/* Dark mode code styling */
[data-theme="dark"] .sync-section code {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e9ecef);
    border-color: rgba(255, 255, 255, 0.15);
}

/* General code element in modals/tables for dark mode */
[data-theme="dark"] .modal code,
[data-theme="dark"] .data-table code {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e9ecef);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Status badges for sync details */
.status-badge.status-enabled {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
}

.status-badge.status-completed {
    background-color: rgba(34, 197, 94, 0.15);
    color: rgb(22, 163, 74);
}

.status-badge.status-started {
    background-color: rgba(59, 130, 246, 0.15);
    color: rgb(37, 99, 235);
}

.status-badge.status-failed {
    background-color: rgba(239, 68, 68, 0.15);
    color: rgb(220, 38, 38);
}

.status-badge.xero-synced {
    background-color: rgba(19, 181, 234, 0.15);
    color: rgb(0, 128, 165);
    font-size: 0.7rem;
    padding: 2px 6px;
}

[data-theme="dark"] .status-badge.xero-synced {
    background-color: rgba(19, 181, 234, 0.25);
    color: rgb(77, 200, 240);
}

/* Responsive */
@media (max-width: 1024px) {
    .data-management-container {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .supplier-info-grid {
        grid-template-columns: 1fr;
    }

    .supplier-detail-tabs,
    .client-detail-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .client-tab-group {
        flex-shrink: 0;
    }

    .client-tab-group:not(:last-child)::after {
        margin: 0 0.125rem;
    }
}

/* ==================== CALL POPUP STYLES ==================== */

/* Call popup overlay */
.call-popup-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 20px;
}

.call-popup-overlay.hidden {
    display: none;
}

/* Call popup container */
.call-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 380px;
    max-width: 95vw;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
}

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

/* Call popup header */
.call-popup-header {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.call-popup-direction {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.call-direction-icon {
    font-size: 24px;
}

.call-direction-icon.inbound {
    animation: ring 1s ease-in-out infinite;
}

.call-direction-icon.outbound {
    color: #a8d4ff;
}

.call-direction-icon.call-ended {
    color: #a8e6cf;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

.call-popup-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.call-popup-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Call popup body */
.call-popup-body {
    padding: 20px;
}

/* Caller info */
.call-popup-caller {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.caller-number {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.caller-name {
    font-size: 18px;
    color: #4a90d9;
    font-weight: 500;
    margin-bottom: 4px;
}

.caller-client {
    font-size: 14px;
    color: #666;
}

.caller-name.hidden,
.caller-client.hidden {
    display: none;
}

/* Call timer */
.call-popup-timer {
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.call-popup-timer span:first-child {
    font-size: 14px;
    font-weight: normal;
    color: #666;
    display: block;
    margin-bottom: 4px;
    font-family: inherit;
}

/* Ticket selection */
.call-popup-ticket-section {
    margin-bottom: 16px;
}

.call-popup-ticket-section label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.call-popup-ticket-section select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
}

.call-popup-ticket-section select:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

/* Notes section */
.call-popup-notes-section {
    margin-bottom: 16px;
}

.call-popup-notes-section label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.call-popup-notes-section textarea {
    width: 100%;
    height: 100px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

.call-popup-notes-section textarea:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

/* Call popup footer */
.call-popup-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.call-popup-footer .btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
}

.call-popup-footer .btn-primary:disabled {
    background: #a0c5e8;
    cursor: not-allowed;
}

/* Minimized call badge */
.call-minimized-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
    z-index: 9999;
    cursor: pointer;
    animation: pulse 2s infinite;
}

.call-minimized-badge.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(74, 144, 217, 0.6); }
}

.call-min-icon {
    font-size: 18px;
}

.call-minimized-badge span:nth-child(2) {
    font-size: 16px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.call-expand-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.call-expand-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive call popup */
@media (max-width: 480px) {
    .call-popup-overlay {
        padding: 10px;
    }

    .call-popup {
        width: 100%;
    }

    .caller-number {
        font-size: 20px;
    }

    .call-popup-timer {
        font-size: 24px;
    }
}

/* OpenAI Test Request Section */
.test-request-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    max-width: 800px;
}

.test-request-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.test-request-section .section-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.test-request-section .form-group {
    margin-bottom: 1rem;
}

.test-request-section .form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.test-request-section textarea,
.test-request-section input,
.test-request-section select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
}

.test-request-section textarea:focus,
.test-request-section input:focus,
.test-request-section select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.test-request-section .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.test-request-section .form-actions {
    margin-top: 1rem;
}

.test-result-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.test-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.test-result-header h5 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.test-meta .meta-item {
    white-space: nowrap;
}

.test-meta .meta-item strong {
    color: var(--text-primary);
}

.test-response {
    font-size: 0.875rem;
    line-height: 1.6;
}

.test-response .success-response {
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.test-response .error-message {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: 6px;
}

.test-response .loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

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

    .test-result-header {
        flex-direction: column;
    }

    .test-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}


/* =====================================================
   CONTRACTS STYLES
   ===================================================== */

.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contracts-summary {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.contracts-summary span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contract-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    border-left: 4px solid var(--border-color);
}

.contract-card:hover {
    box-shadow: var(--shadow-lg);
}

.contract-card.status-active {
    border-left-color: var(--success-color);
}

.contract-card.status-draft {
    border-left-color: var(--text-secondary);
}

.contract-card.status-expired {
    border-left-color: var(--warning-color);
}

.contract-card.status-cancelled {
    border-left-color: var(--danger-color);
}

.contract-card.status-suspended {
    border-left-color: var(--danger-color);
}

/* Contract coverage badges for ticket detail */
.badge-included {
    background: #d1fae5;
    color: #065f46;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.badge-discounted {
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.badge-capped {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.badge-excluded {
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.contract-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.contract-info a:hover {
    text-decoration: underline;
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.contract-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.contract-number {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.contract-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contract-client {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.contract-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contract-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.contract-detail {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.contract-detail .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.contract-detail .value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.contract-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Contract Details Modal */
.contract-details-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contract-overview {
    background: var(--background);
    border-radius: 8px;
    padding: 1.25rem;
}

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

.overview-header h3 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.overview-client {
    text-align: right;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.overview-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.overview-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.overview-item span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.overview-description {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.overview-description label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.overview-description p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Contract Tabs */
.contract-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
}

.contract-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

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

.contract-tab.active {
    color: var(--primary-color);
}

.contract-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.contract-section {
    padding: 1rem 0;
}

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

.section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Badge styles for contract types */
.badge-type {
    background: var(--primary-color);
    color: white;
}

.badge-draft {
    background: var(--text-secondary);
    color: white;
}

.badge-active {
    background: var(--success-color);
    color: white;
}

.badge-expired {
    background: var(--warning-color);
    color: white;
}

.badge-cancelled,
.badge-suspended {
    background: var(--danger-color);
    color: white;
}

.badge-included {
    background: var(--success-color);
    color: white;
}

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

.badge-capped {
    background: var(--warning-color);
    color: white;
}

.badge-excluded {
    background: var(--text-secondary);
    color: white;
}

/* Form Grid for Contracts */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.form-section {
    background: var(--background);
    border-radius: 8px;
    padding: 1.25rem;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

/* Data Table for contract services/products */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: var(--background);
}

.data-table td strong {
    color: var(--text-primary);
}

.data-table td small {
    color: var(--text-secondary);
}

/* Responsive contracts */
@media (max-width: 768px) {
    .contract-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .contract-badges {
        align-self: flex-start;
    }

    .contract-details {
        grid-template-columns: 1fr 1fr;
    }

    .overview-grid {
        grid-template-columns: 1fr 1fr;
    }

    .contract-tabs {
        overflow-x: auto;
    }

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

    .data-table {
        display: block;
        overflow-x: auto;
    }
}

/* Line Item badges */
.badge-service {
    background: #dbeafe;
    color: #1e40af;
}

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

.badge-subscription {
    background: #fef3c7;
    color: #92400e;
}

/* Searchable Dropdown */
.searchable-dropdown {
    position: relative;
}

.searchable-dropdown input[type="text"] {
    width: 100%;
}

.searchable-dropdown .dropdown-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.searchable-dropdown .dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.searchable-dropdown .dropdown-item:hover {
    background: var(--gray-50);
}

.searchable-dropdown .dropdown-item strong {
    font-size: 0.95rem;
}

.searchable-dropdown .dropdown-item small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.searchable-dropdown .dropdown-item.no-results,
.searchable-dropdown .dropdown-item.error {
    color: var(--text-muted);
    cursor: default;
}

.searchable-dropdown .dropdown-item.error {
    color: var(--danger);
}

.searchable-dropdown .selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    padding: 8px 12px;
    border-radius: 4px;
}

.searchable-dropdown .selected-item .selected-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.searchable-dropdown .selected-item .clear-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 4px;
    line-height: 1;
}

.searchable-dropdown .selected-item .clear-btn:hover {
    color: var(--danger);
}

/* Searchable Dropdown - Dark Mode */
[data-theme="dark"] .searchable-dropdown .dropdown-results {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .searchable-dropdown .dropdown-item {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .searchable-dropdown .dropdown-item:hover {
    background: var(--background);
}

[data-theme="dark"] .searchable-dropdown .dropdown-item strong {
    color: var(--text-primary);
}

[data-theme="dark"] .searchable-dropdown .dropdown-item small {
    color: var(--text-secondary);
}

[data-theme="dark"] .searchable-dropdown .selected-item {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary-color);
}

[data-theme="dark"] .searchable-dropdown .selected-item .selected-text {
    color: var(--text-primary);
}

[data-theme="dark"] .searchable-dropdown .selected-item .clear-btn {
    color: var(--text-secondary);
}

[data-theme="dark"] .searchable-dropdown .selected-item .clear-btn:hover {
    color: var(--danger-color);
}

/* Pending Adjustments Section - Dark Mode */
[data-theme="dark"] .pending-adjustments-section {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .pending-adjustments-section h4 {
    color: #fbbf24 !important;
}

[data-theme="dark"] .pending-adjustments-section p {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .pending-adjustments-section .data-table th,
[data-theme="dark"] .pending-adjustments-section .data-table td {
    color: var(--text-primary);
    background: transparent;
}

[data-theme="dark"] .pending-adjustments-section .data-table thead th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

[data-theme="dark"] .pending-adjustments-section .data-table tbody tr {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .pending-adjustments-section .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .pending-adjustments-section tfoot tr {
    background: rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .pending-adjustments-section tfoot td {
    color: var(--text-primary) !important;
}

.badge-custom {
    background: #f3e8ff;
    color: #7c3aed;
}

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

/* Line item total display */
.line-item-total-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-radius: 6px;
    font-size: 1rem;
}

.line-item-total-display label {
    font-weight: 600;
    color: var(--text-secondary);
}

.line-item-total-display span {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* Data table tfoot styling */
.data-table tfoot td {
    font-size: 0.9rem;
    padding-top: 1rem;
    border-bottom: none;
}

.text-muted {
    color: var(--text-secondary);
}

/* Readonly form value display */
.readonly-value {
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Readonly input fields */
input.input-readonly,
input[readonly].input-readonly {
    background: var(--background-secondary, var(--background));
    color: var(--text-primary);
    cursor: not-allowed;
    opacity: 0.8;
}

/* Disabled input fields */
input.input-disabled,
input[disabled].input-disabled {
    background: var(--background-secondary, var(--background));
    color: var(--text-primary);
    cursor: not-allowed;
    opacity: 0.7;
    border-color: var(--border-color);
}

/* Leader Cloud collapsible sections */
.leadercloud-section.collapsible {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.leadercloud-section.collapsible .lc-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--background-secondary, var(--background));
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.leadercloud-section.collapsible .lc-section-header:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.leadercloud-section.collapsible .lc-section-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.leadercloud-section.collapsible .collapse-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.leadercloud-section.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.leadercloud-section.collapsible .lc-section-content {
    padding: 1rem;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
}

.leadercloud-section.collapsible.collapsed .lc-section-content {
    max-height: 0;
    padding: 0 1rem;
    opacity: 0;
    overflow: hidden;
}

[data-theme="dark"] .leadercloud-section.collapsible .lc-section-header:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Info note in forms */
.info-note {
    padding: 0.5rem 0.75rem;
    background: #dbeafe;
    border-radius: 6px;
    margin-bottom: 1rem;
    color: #1e40af;
}

[data-theme="dark"] .info-note {
    background: #1e3a5f;
    color: #93c5fd;
}

/* ============ COLLAPSIBLE SECTIONS ============ */
.product-detail-section.collapsible .section-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.product-detail-section.collapsible .section-header:hover {
    color: var(--primary-color);
}

.product-detail-section.collapsible .collapse-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}

.product-detail-section.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.product-detail-section.collapsible .section-content {
    padding-top: 1rem;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.product-detail-section.collapsible.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    opacity: 0;
    overflow: hidden;
}

/* ============ ESTIMATES STYLES ============ */
.estimates-list {
    margin-top: 1rem;
}

.estimates-summary {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.estimates-summary span {
    font-weight: 500;
}

/* Estimate status badges */
.status-badge.status-draft {
    background: #e2e8f0;
    color: #475569;
}

.status-badge.status-sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.status-won,
.status-badge.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-lost {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.status-converted {
    background: #e9d5ff;
    color: #7c3aed;
}

/* Estimate detail modal */
.estimate-header-info {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.estimate-header-info .info-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.estimate-header-info .info-row:last-child {
    margin-bottom: 0;
}

.add-item-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.add-item-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .status-badge.status-draft {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .status-badge.status-sent {
    background: #1e3a5f;
    color: #93c5fd;
}

[data-theme="dark"] .status-badge.status-won,
[data-theme="dark"] .status-badge.status-approved {
    background: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .status-badge.status-lost {
    background: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .status-badge.status-converted {
    background: #4c1d95;
    color: #c4b5fd;
}

/* ============ DOCUMENT TEMPLATES STYLES ============ */
.templates-container {
    margin-top: 1rem;
}

.templates-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.templates-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.templates-list .template-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s;
}

.templates-list .template-card:hover {
    border-color: var(--primary-color);
}

.templates-list .template-card.is-default {
    border-left: 3px solid var(--success-color);
}

.templates-list .template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.templates-list .template-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.templates-list .template-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.templates-list .template-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.templates-list .template-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* =====================================================
   COMPANY SETTINGS STYLES
   ===================================================== */

.company-settings-container {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.company-config-form {
    max-width: 900px;
}

.company-config-form .form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.company-config-form .form-section:last-of-type {
    border-bottom: none;
}

.company-config-form .form-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.company-config-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.company-config-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.company-config-form .form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.company-config-form .form-group label .required {
    color: var(--danger-color);
}

.company-config-form .form-group input,
.company-config-form .form-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.company-config-form .form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    width: 100%;
}

.company-config-form .form-group input:focus,
.company-config-form .form-group select:focus,
.company-config-form .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.company-config-form .help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Logo Upload */
.logo-upload-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.logo-preview-wrapper {
    flex-shrink: 0;
}

.logo-preview {
    width: 200px;
    height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-preview .no-logo-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.logo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.logo-upload-controls .btn {
    width: fit-content;
}

/* Favicon Preview */
.favicon-preview {
    width: 64px;
    height: 64px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    overflow: hidden;
}

.favicon-preview img {
    max-width: 48px;
    max-height: 48px;
    object-fit: contain;
}

.favicon-preview .no-logo-text {
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-align: center;
    padding: 0.25rem;
}

@media (max-width: 768px) {
    .company-config-form .form-row {
        grid-template-columns: 1fr;
    }

    .logo-upload-container {
        flex-direction: column;
    }
}


/* =====================================================
   EMAILER / BULK CAMPAIGN STYLES
   ===================================================== */

.emailer-container {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.emailer-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.emailer-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.campaigns-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.campaign-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s;
}

.campaign-card:hover {
    border-color: var(--primary-color);
}

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

.campaign-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.campaign-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.campaign-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.campaign-subject {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.campaign-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.campaign-actions {
    display: flex;
    gap: 0.5rem;
}

/* Campaign type badges */
.badge-outage {
    background: var(--danger-color) !important;
}

.badge-update {
    background: var(--primary-color) !important;
}

.badge-newsletter {
    background: var(--success-color) !important;
}

.badge-custom {
    background: var(--secondary-color) !important;
}

/* Campaign status badges */
.badge-draft {
    background: var(--secondary-color) !important;
}

.badge-scheduled {
    background: var(--warning-color) !important;
}

.badge-sending {
    background: var(--primary-color) !important;
}

.badge-sent {
    background: var(--success-color) !important;
}

.badge-cancelled {
    background: var(--danger-color) !important;
}

.badge-pending {
    background: var(--secondary-color) !important;
}

.badge-failed {
    background: var(--danger-color) !important;
}

.badge-delivered {
    background: var(--success-color) !important;
}

.badge-opened {
    background: var(--primary-color) !important;
}

.badge-clicked {
    background: #8b5cf6 !important;
}

/* Email Editor styles */
.email-editor {
    min-height: 300px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
}

.email-editor .ql-container {
    min-height: 250px;
    font-size: 0.9rem;
}

.email-editor .ql-toolbar {
    border-color: var(--border-color);
    background: var(--background);
}

.email-editor .ql-container {
    border-color: var(--border-color);
}

.email-editor textarea {
    width: 100%;
    border: none;
    padding: 1rem;
    font-family: inherit;
    resize: vertical;
    background: var(--card-bg);
    color: var(--text-primary);
}

/* Quill table button styling */
.ql-toolbar .ql-table {
    width: 28px;
}

.ql-toolbar .ql-table::before {
    content: '⊞';
    font-size: 16px;
}

/* quill-better-table styling */
.email-editor .quill-better-table {
    border-collapse: collapse;
    width: 100%;
}

.email-editor .quill-better-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    min-width: 50px;
}

.email-editor .quill-better-table-wrapper {
    margin: 10px 0;
    overflow-x: auto;
}

/* Table operation menu styling */
.qlbt-operation-menu {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
}

.qlbt-operation-menu .qlbt-operation-menu-item {
    color: var(--text-primary) !important;
    padding: 8px 12px !important;
}

.qlbt-operation-menu .qlbt-operation-menu-item:hover {
    background: var(--background) !important;
}

/* Recipients manager */
.recipients-manager h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.clients-contacts-list {
    font-size: 0.875rem;
}

.client-item {
    margin-bottom: 0.75rem;
}

.contact-items {
    margin-top: 0.25rem;
}

.contact-items label {
    padding: 0.25rem 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.recipient-item {
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

/* Campaign details modal */
.campaign-details h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.campaign-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.stat-card {
    text-align: center;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .emailer-filters {
        flex-direction: column;
    }

    .campaign-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .campaign-stats {
        flex-wrap: wrap;
    }

    .campaign-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Email template badge */
.badge-email {
    background: #8b5cf6 !important;
}

/* ============ AI CLIENT REVIEW SIDEBAR ============ */

.modal-with-ai-sidebar {
    display: flex;
    flex-direction: column;
}

.modal-body-with-sidebar {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.modal-body-with-sidebar > .modal-content {
    flex: 1;
    overflow-y: auto;
    transition: margin-right 0.3s ease;
}

/* AI Sidebar */
.ai-review-sidebar {
    width: 380px;
    min-width: 380px;
    border-left: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.ai-review-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
    opacity: 0;
    pointer-events: none;
}

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

.ai-sidebar-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.ai-sidebar-header .ai-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* AI Badge for inline use (buttons) */
.ai-badge-inline {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.ai-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-collapse-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.625rem;
    transition: all 0.15s;
}

.ai-collapse-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.ai-collapse-btn .collapse-icon {
    transition: transform 0.2s;
}

.ai-time-range-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.ai-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* AI Summary Sections */
.ai-summary-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.ai-summary-overall {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    line-height: 1.7;
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

.ai-section {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.ai-section-header {
    padding: 0.75rem 1rem;
    background: var(--background);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s;
}

.ai-section-header:hover {
    background: var(--hover-bg);
}

.ai-section-header h5 {
    margin: 0;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.ai-section-count {
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.625rem;
    font-weight: 600;
}

.ai-section-toggle {
    font-size: 0.625rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.ai-section.expanded .ai-section-toggle {
    transform: rotate(180deg);
}

.ai-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--card-bg);
}

.ai-section.expanded .ai-section-content {
    max-height: 300px;
    padding: 0.75rem 1rem;
    overflow-y: auto;
}

.ai-section-content p {
    margin: 0;
}

/* AI Loading State */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: ai-spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.ai-loading span {
    font-size: 0.875rem;
}

/* AI Error State */
.ai-error {
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    color: var(--danger-color);
    text-align: center;
}

.ai-error p {
    margin: 0 0 0.5rem 0;
}

.ai-error p:last-of-type {
    font-size: 0.75rem;
    opacity: 0.8;
}

.ai-error button {
    margin-top: 0.75rem;
}

/* AI Ticket Review Modal */
.ai-review-overall {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 6px;
}

.ai-review-overall p {
    margin: 0;
    line-height: 1.5;
}

.ai-review-tickets {
    margin-bottom: 1rem;
}

.ai-ticket-review-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: var(--card-bg);
}

.ai-ticket-review-item:last-child {
    margin-bottom: 0;
}

.ai-ticket-review-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ai-ticket-link {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
}

.ai-ticket-link:hover {
    text-decoration: underline;
}

.ai-ticket-summary {
    color: var(--text-primary);
    font-weight: 500;
}

.ai-ticket-resolution {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.ai-ticket-resolution strong {
    color: var(--text-primary);
}

.ai-ticket-steps {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.ai-ticket-steps ol {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.ai-ticket-steps li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.ai-review-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.ai-review-empty p {
    margin: 0;
}

.ai-review-filter {
    padding: 1rem 0;
}

.ai-review-filter .form-group {
    margin-bottom: 1.5rem;
}

.ai-review-filter .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.ai-review-filter select {
    width: 100%;
    max-width: 300px;
}

.ai-review-filter-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.ai-review-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.ai-ticket-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Sub-modal (modal on top of modal) */
.sub-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.sub-modal {
    background: var(--card-bg);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

.sub-modal-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sub-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.sub-modal-body textarea {
    width: 100%;
    resize: vertical;
    min-height: 120px;
}

.sub-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Toggle Button in Header */
.modal-ai-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.6875rem;
    font-weight: 600;
    transition: opacity 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-ai-toggle:hover {
    opacity: 0.9;
}

.modal-ai-toggle.active {
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5);
}

.ai-generated-time {
    margin-top: 1rem;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.7;
}

/* AI Chat */
.ai-chat-container {
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    min-height: 180px;
    max-height: 300px;
}

.ai-chat-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 80px;
}

.ai-chat-message {
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.5rem 0.625rem;
    border-radius: 8px;
    max-width: 95%;
    word-wrap: break-word;
}

.ai-chat-user {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-user .ai-chat-role {
    font-weight: 600;
    display: block;
    font-size: 0.625rem;
    opacity: 0.85;
    margin-bottom: 2px;
}

.ai-chat-assistant {
    background: var(--gray-100);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-chat-assistant .ai-chat-role {
    font-weight: 600;
    display: block;
    font-size: 0.625rem;
    color: #6366f1;
    margin-bottom: 2px;
}

.ai-chat-error {
    background: #fef2f2;
    color: #dc2626;
    align-self: center;
    font-size: 0.6875rem;
    border: 1px solid #fecaca;
}

.ai-chat-error-icon {
    margin-right: 4px;
}

.ai-chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
}

.ai-chat-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.ai-chat-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.ai-chat-send-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.ai-chat-send-btn:active {
    transform: scale(0.95);
}

/* Typing indicator animation */
.ai-typing-indicator {
    display: inline-flex;
    gap: 3px;
    padding: 4px 0;
}

.ai-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #6366f1;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .ai-review-sidebar {
        width: 320px;
        min-width: 320px;
    }
}

@media (max-width: 1024px) {
    .ai-review-sidebar {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 10;
        box-shadow: -4px 0 10px rgba(0, 0, 0, 0.1);
        width: 350px;
        min-width: 350px;
    }
}

@media (max-width: 768px) {
    .ai-review-sidebar {
        width: 100%;
        min-width: 100%;
    }
}

/* AI Sidebar Dark Mode */
[data-theme="dark"] .ai-review-sidebar {
    background: var(--card-bg);
    border-left-color: var(--border-color);
}

[data-theme="dark"] .ai-sidebar-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .ai-summary-overall {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .ai-section {
    border-color: var(--border-color);
}

[data-theme="dark"] .ai-section-header:hover {
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .ai-chat-container {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .ai-chat-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .ai-chat-messages {
    background: var(--background);
}

[data-theme="dark"] .ai-chat-assistant {
    background: var(--card-bg);
    color: var(--text-primary);
}

[data-theme="dark"] .ai-chat-input-container {
    background: var(--card-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .ai-chat-input {
    background: var(--background);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .ai-chat-input::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] .ai-chat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .ai-chat-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

[data-theme="dark"] .ai-time-range-select {
    background: var(--background);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .ai-collapse-btn {
    background: var(--background);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .ai-collapse-btn:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

/* ============ LINKED TICKETS ============ */
.linked-tickets-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.linked-tickets-section h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.linked-tickets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.linked-ticket-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.linked-ticket-item:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
}

.link-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    min-width: 70px;
    text-align: center;
}

.link-type-related {
    background: #dbeafe;
    color: #1e40af;
}

.link-type-duplicate {
    background: #e2e8f0;
    color: #475569;
}

.link-type-parent {
    background: #f3e8ff;
    color: #7c3aed;
}

.link-type-child {
    background: #ccfbf1;
    color: #0f766e;
}

[data-theme="dark"] .link-type-related {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .link-type-duplicate {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

[data-theme="dark"] .link-type-parent {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

[data-theme="dark"] .link-type-child {
    background: rgba(20, 184, 166, 0.2);
    color: #5eead4;
}

.linked-ticket-info {
    flex: 1;
    min-width: 0;
}

.linked-ticket-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.linked-ticket-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.remove-link-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.remove-link-btn:hover {
    opacity: 1;
    color: #ef4444;
}

.no-links-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* Link Ticket Modal */
.link-ticket-modal {
    min-width: 400px;
}

.link-search-results {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.link-search-results:empty {
    display: none;
}

.link-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.link-search-item:hover {
    background: var(--card-bg);
}

.link-search-item.selected {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary-color);
}

.link-search-id {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
}

.link-search-title {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-search-client {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ===== TEMPLATE EDITOR STYLES ===== */
.template-editor {
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 1.5rem;
    max-height: 80vh;
}

.template-editor-settings {
    overflow-y: auto;
    padding-right: 1rem;
}

.template-editor-preview {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    position: sticky;
    top: 0;
    max-height: 75vh;
    overflow-y: auto;
}

.template-preview-container {
    background: white;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    border-radius: 4px;
    transform-origin: top center;
    transform: scale(0.75);
    margin: 0 auto -180px auto;
    width: 595px; /* A4 width at 72dpi */
    min-height: 842px; /* A4 height */
}

.template-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    background: var(--card-bg);
}

.template-section-header {
    background: var(--background);
    padding: 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: var(--text-primary);
}

.template-section-header:hover {
    background: var(--border-color);
}

.template-section-toggle {
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.template-section.collapsed .template-section-toggle {
    transform: rotate(-90deg);
}

.template-section.collapsed .template-section-content {
    display: none;
}

.template-section-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.template-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.template-form-row.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.template-form-group {
    margin-bottom: 0.75rem;
}

.template-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.template-form-group input[type="text"],
.template-form-group input[type="number"],
.template-form-group select,
.template-form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.template-form-group input[type="color"] {
    width: 100%;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: var(--card-bg);
}

.template-color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-color-picker input[type="color"] {
    width: 40px;
    height: 32px;
    flex-shrink: 0;
}

.template-color-picker input[type="text"] {
    flex: 1;
    font-family: monospace;
    font-size: 0.8rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
}

.template-checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.template-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.template-checkbox-group label {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.template-block {
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--background);
    position: relative;
}

.template-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.template-block-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.template-block-toggle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Preview Styles - Always light background since it's a document preview */
.preview-header {
    padding: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.preview-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.preview-logo {
    max-width: 150px;
    height: auto;
}

.preview-company-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #333;
}

.preview-company-details {
    font-size: 10px;
    color: #666;
    line-height: 1.4;
}

.preview-document-title {
    text-align: right;
}

.preview-document-type {
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
}

.preview-document-number {
    font-size: 12px;
    color: #666;
}

.preview-body {
    padding: 20px;
    color: #333;
}

.preview-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.preview-info-block {
    flex: 1;
}

.preview-info-label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 10px;
}

.preview-table th {
    background: #2563eb;
    color: white;
    padding: 8px;
    text-align: left;
    font-weight: 600;
}

.preview-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #333;
}

.preview-table tr:nth-child(even) {
    background: #f8fafc;
}

.preview-table .text-right {
    text-align: right;
}

.preview-totals {
    margin-left: auto;
    width: 200px;
}

.preview-total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 10px;
    color: #333;
}

.preview-total-row.grand-total {
    font-weight: 700;
    font-size: 12px;
    border-top: 2px solid #333;
    padding-top: 8px;
    margin-top: 4px;
}

.preview-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
}

.preview-terms {
    font-size: 9px;
    color: #666;
    margin-bottom: 15px;
}

.preview-terms-label {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.preview-payment-info {
    font-size: 9px;
    background: #f8fafc;
    padding: 10px;
    border-radius: 4px;
    color: #333;
}

.preview-payment-label {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

/* Font selector with preview */
.font-preview {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.25rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

/* ============ SMS STYLES ============ */
.sms-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.sms-sub-tab {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

.sms-sub-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.sms-sub-tab.active {
    color: var(--primary-color);
    background: var(--card-bg);
    font-weight: 500;
    border-bottom: 2px solid var(--primary-color);
}

.sms-sub-content.hidden {
    display: none;
}

.sms-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 300px);
}

/* Bulk SMS Styles */
.sms-bulk-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 300px);
}

.sms-bulk-recipients,
.sms-bulk-message {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
}

.sms-bulk-recipients h3,
.sms-bulk-message h3 {
    margin: 0 0 1.25rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.bulk-sms-recipient-list {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.bulk-sms-recipient-list h4 {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

#bulk-sms-recipients-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    background: var(--bg-secondary);
}

.bulk-recipient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.bulk-recipient-item:last-child {
    margin-bottom: 0;
}

.bulk-recipient-item .remove-recipient {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
}

.bulk-recipient-item .remove-recipient:hover {
    color: #dc2626;
}

.bulk-sms-summary {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.bulk-sms-summary p {
    margin: 0.25rem 0;
}

#bulk-sms-clear {
    margin-top: 0.75rem;
}

@media (max-width: 1000px) {
    .sms-bulk-container {
        grid-template-columns: 1fr;
    }
}

.sms-compose-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.sms-history-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.sms-compose-section.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.sms-compose-section h3,
.sms-history-section h3 {
    margin: 0 0 1.25rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.sms-compose-section .form-group {
    margin-bottom: 1rem;
}

.sms-compose-section select,
.sms-compose-section input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.sms-compose-section textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 120px;
}

#sms-contact-picker,
#sms-manual-entry {
    margin-top: 0.75rem;
}

.sms-char-counter {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

.sms-compose-section .form-actions {
    margin-top: 1.25rem;
}

.sms-compose-section .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.sms-history-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sms-history-filters select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

#sms-logs-list {
    flex: 1;
    overflow-y: auto;
    min-height: 400px;
    max-height: calc(100vh - 350px);
}

.sms-log-item {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--bg-secondary);
    transition: box-shadow 0.2s ease;
}

.sms-log-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sms-log-item.inbound {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(to right, rgba(59, 130, 246, 0.05), transparent);
}

.sms-log-item.outbound {
    border-left: 4px solid var(--success-color);
    background: linear-gradient(to right, rgba(34, 197, 94, 0.05), transparent);
}

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

    .sms-compose-section {
        position: static;
    }

    #sms-logs-list {
        max-height: 400px;
    }
}

.sms-log-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.sms-direction {
    font-weight: 600;
    font-size: 0.9rem;
}

.sms-direction.inbound {
    color: #3b82f6;
}

.sms-direction.outbound {
    color: var(--success-color);
}

/* SMS status badge colors */
.sms-log-item .badge-info {
    background-color: #3b82f6;
    color: white;
}

.sms-log-item .badge-success {
    background-color: var(--success-color);
    color: white;
}

.sms-log-item .badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.sms-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sms-log-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.sms-log-details > div {
    margin-bottom: 0.25rem;
}

.sms-phone {
    font-weight: 500;
    color: var(--text-primary);
}

.sms-ticket a {
    color: var(--primary-color);
}

.sms-body {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Ticket detail SMS section */
.sms-section {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.sms-section .notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#ticket-sms-list {
    max-height: 300px;
    overflow-y: auto;
}

#ticket-sms-list .sms-log-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

.sms-log-body {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}

.sms-direction-badge {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.sms-direction-badge.inbound {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.sms-direction-badge.outbound {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

.sms-log-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sms-status-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.sms-status-badge.delivered,
.sms-status-badge.sent,
.sms-status-badge.received {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

.sms-status-badge.pending,
.sms-status-badge.queued {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning-color);
}

.sms-status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

.sms-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.sms-log-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.sms-contact {
    margin-left: 0.5rem;
    font-style: italic;
}

#ticket-sms-compose {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.sms-compose-form .form-group {
    margin-bottom: 0.75rem;
}

.sms-compose-form label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.sms-compose-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Guni integration webhook URLs */
.webhook-url {
    margin: 0.5rem 0;
}

.webhook-url label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.webhook-url code {
    display: block;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.85rem;
    word-break: break-all;
}

/* SMS status banner */
#sms-status-banner {
    padding: 1rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

#sms-status-banner a {
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .template-editor {
        grid-template-columns: 1fr;
    }

    .template-editor-preview {
        order: -1;
        max-height: 300px;
    }

    .template-preview-container {
        transform: scale(0.4);
        margin: -150px auto;
    }
}

/* =====================================================
   PROJECTS MODULE STYLES
   ===================================================== */

/* Projects List */
.projects-list {
    display: grid;
    gap: 1rem;
}

.projects-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.projects-summary .separator {
    color: var(--border-color);
}

/* Project Card */
.project-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    border-left: 4px solid var(--primary-color);
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-info {
    flex: 1;
}

.project-number {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.project-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.25rem 0;
    color: var(--text-primary);
}

.project-client {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.project-badges {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.project-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-detail {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.project-detail .label {
    color: var(--text-secondary);
}

.project-detail .value {
    color: var(--text-primary);
}

/* Progress Bar */
.project-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 40px;
}

.project-progress-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-progress-inline .progress-bar {
    width: 80px;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Project Detail Modal */
.project-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.project-detail-info h3 {
    margin: 0.25rem 0;
}

.project-client-name {
    color: var(--text-secondary);
}

.project-detail-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.project-status-dropdown {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    padding: 0.35rem 1.5rem 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23fff' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    transition: opacity 0.15s;
}

.project-status-dropdown:hover {
    opacity: 0.85;
}

.project-status-dropdown:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.project-status-dropdown option {
    background: var(--card-bg);
    color: var(--text-primary);
    font-weight: 500;
}

/* Project Tabs */
.project-detail-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.project-tab {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.project-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.project-tab-content {
    min-height: 300px;
}

/* Task View Header */
.task-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.task-view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--background);
    padding: 0.25rem;
    border-radius: 6px;
}

.task-view-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.task-view-btn:hover {
    color: var(--text-primary);
}

.task-view-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Task Stage Group (List View) */
.task-stage-group {
    margin-bottom: 1.5rem;
}

.stage-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Task Card */
.task-card {
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.task-card:hover {
    box-shadow: var(--shadow);
}

.task-card.priority-low {
    border-left-color: var(--text-secondary);
}

.task-card.priority-medium {
    border-left-color: var(--primary-color);
}

.task-card.priority-high {
    border-left-color: var(--warning-color);
}

.task-card.priority-critical {
    border-left-color: var(--danger-color);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.task-title {
    font-weight: 500;
    color: var(--text-primary);
}

.task-status-badge {
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    color: white;
}

.task-card-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.task-assignee.unassigned {
    font-style: italic;
}

/* Task Board (Kanban) */
.task-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.task-column {
    flex: 0 0 280px;
    background: var(--background);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

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

.column-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.column-count {
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.task-column-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100px;
}

.task-column-content.drag-over {
    background: var(--primary-color-transparent, rgba(59, 130, 246, 0.1));
    border-radius: 4px;
}

.task-board-card {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    cursor: grab;
    border-left: 3px solid var(--border-color);
}

.task-board-card:hover {
    box-shadow: var(--shadow-lg);
}

.task-board-card.dragging {
    opacity: 0.5;
}

.task-board-card.priority-low {
    border-left-color: var(--text-secondary);
}

.task-board-card.priority-medium {
    border-left-color: var(--primary-color);
}

.task-board-card.priority-high {
    border-left-color: var(--warning-color);
}

.task-board-card.priority-critical {
    border-left-color: var(--danger-color);
}

.task-board-card-content .task-title {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.task-board-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

/* Task Detail Modal */
.task-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.task-detail-header h3 {
    margin: 0;
}

.task-title-input {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--text-primary);
    margin-right: 1rem;
}

.task-title-input:hover {
    border-color: var(--border-color);
    background: var(--background);
}

.task-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
}

.task-description-input {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--background);
    padding: 0.75rem;
    border-radius: 6px;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.task-description-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.task-description-input::placeholder {
    color: var(--text-secondary);
}

.task-detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

.task-detail-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.task-description {
    background: var(--background);
    padding: 1rem;
    border-radius: 6px;
    min-height: 60px;
}

.task-notes-section h4 {
    margin: 0 0 1rem 0;
}

.task-note {
    background: var(--background);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.note-header {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.note-author {
    font-weight: 500;
    color: var(--text-primary);
}

.note-date {
    color: var(--text-secondary);
}

.note-time {
    background: var(--primary-color);
    color: white;
    padding: 0 0.375rem;
    border-radius: 4px;
}

.note-content {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.add-note-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.badge-internal {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

[data-theme="dark"] .badge-internal {
    background: #78350f;
    color: #fde68a;
}

.task-detail-sidebar {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-detail-sidebar .form-group input[type="date"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    box-sizing: border-box;
    height: auto;
    line-height: normal;
}

[data-theme="dark"] .task-detail-sidebar .form-group input[type="date"] {
    color-scheme: dark;
}

.task-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 6px;
}

.task-stats .stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.task-stats .stat label {
    color: var(--text-secondary);
}

/* Stages Tab */
.stages-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.stages-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stage-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-info h4 {
    margin: 0 0 0.25rem 0;
}

.stage-info p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stage-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stage-actions {
    display: flex;
    gap: 0.5rem;
}

/* Billing Tab */
.billing-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.billing-stat {
    display: flex;
    gap: 0.5rem;
}

.billing-stat .label {
    color: var(--text-secondary);
}

.billing-stat.total {
    font-weight: 600;
    font-size: 1.1rem;
}

.billing-section {
    margin-bottom: 1.5rem;
}

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

.section-header h4 {
    margin: 0;
}

.items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.item-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.remove-item-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.remove-item-btn:hover {
    color: var(--danger-color);
}

/* Overview Tab */
.project-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.overview-section {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
}

.overview-section.full-width {
    grid-column: 1 / -1;
}

.overview-section h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

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

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

.detail-row .detail-label {
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 100px;
    margin-right: 1rem;
    flex-shrink: 0;
}

.detail-row .label {
    color: var(--text-secondary);
}

.description-content {
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Empty states */
.empty-state-small {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

.empty-cell {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Button variations */
.btn-full {
    width: 100%;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

/* Task Tabs */
.task-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.task-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

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

.task-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Task Communication Grid */
.task-communication-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.task-comm-compose {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
}

.task-comm-history {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.task-comm-history h4 {
    margin: 0 0 1rem 0;
}

/* Communication Type Tabs */
.comm-type-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.comm-type-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.comm-type-tab:hover {
    background: var(--background);
}

.comm-type-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Communication Compose Form */
.comm-compose-form .form-group {
    margin-bottom: 1rem;
}

.comm-compose-form .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.comm-compose-form input[type="email"],
.comm-compose-form input[type="tel"],
.comm-compose-form input[type="text"],
.comm-compose-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.comm-compose-form textarea {
    resize: vertical;
}

/* Communication History Header */
.comm-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.comm-history-header h4 {
    margin: 0;
}

.comm-refresh-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Communication List */
.comm-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comm-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
}

.comm-item.comm-sent {
    border-left-color: var(--primary-color);
}

.comm-item.comm-received {
    border-left-color: var(--success-color);
}

.comm-icon {
    font-size: 1.25rem;
}

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

.comm-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.comm-type {
    font-weight: 600;
}

.comm-direction {
    text-transform: capitalize;
}

.comm-status {
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.675rem;
    text-transform: uppercase;
}

.comm-status.success {
    background: var(--success-color);
    color: white;
}

.comm-status.error {
    background: var(--danger-color);
    color: white;
}

.comm-status.pending {
    background: var(--warning-color);
    color: #333;
}

.comm-date {
    color: var(--text-secondary);
    margin-left: auto;
}

.comm-subject {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.comm-addresses,
.comm-phone {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.comm-preview {
    font-size: 0.813rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-full-body {
    font-size: 0.813rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.comm-item.expandable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.comm-item.expandable:hover {
    background-color: var(--bg-hover);
}

.comm-item.expanded {
    background-color: var(--bg-hover);
}

.comm-expand-icon {
    font-size: 0.625rem;
    color: var(--text-secondary);
    margin-left: auto;
    transition: transform 0.2s ease;
}

/* Character count */
.char-count {
    display: block;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .project-details {
        grid-template-columns: 1fr;
    }

    .task-detail-grid {
        grid-template-columns: 1fr;
    }

    .task-detail-sidebar {
        order: -1;
    }

    .project-overview-grid {
        grid-template-columns: 1fr;
    }

    .task-board {
        flex-direction: column;
    }

    .task-column {
        flex: none;
        width: 100%;
    }

    .task-communication-grid {
        grid-template-columns: 1fr;
    }
}

/* ============ Email Review Queue ============ */

.review-queue-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.review-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.review-queue-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.review-item-checkbox {
    padding-top: 0.25rem;
}

.review-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.review-item-from {
    font-weight: 500;
    color: var(--text-primary);
}

.review-item-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.review-item-subject {
    font-weight: 500;
    color: var(--text-primary);
}

.review-item-reason {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-reason-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-radius: 4px;
    font-size: 0.75rem;
}

.mailbox-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border-radius: 4px;
    font-size: 0.75rem;
}

.review-item-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.review-item-actions .btn-sm {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

.filter-reason-highlight {
    background: rgba(245, 158, 11, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    color: #f59e0b;
    margin: 0;
}

/* Search Results Dropdown */
.search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.5rem;
    background: var(--card-bg);
}

.search-results:empty {
    display: none;
}

.search-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

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

.search-result-error {
    padding: 0.5rem;
    color: var(--danger-color);
    font-size: 0.875rem;
}

.selected-item-preview {
    padding: 0.5rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 4px;
    margin-top: 0.5rem;
    color: #22c55e;
}

.email-body-preview {
    white-space: pre-wrap;
    max-height: 300px;
    overflow: auto;
    background: var(--background);
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    margin: 0;
}

/* Add filtered status color to email logs */
.email-log-status.filtered {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.email-log-status.reviewed {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

@media (max-width: 768px) {
    .review-queue-item {
        grid-template-columns: 1fr;
    }

    .review-item-checkbox {
        position: absolute;
        right: 1rem;
        top: 1rem;
    }

    .review-queue-item {
        position: relative;
    }

    .review-item-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ============ TOAST NOTIFICATION SYSTEM ============ */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--card-bg);
    border-left: 4px solid var(--primary-color);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* Toast Types */
.toast-success {
    border-left-color: var(--success-color);
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-error {
    border-left-color: var(--danger-color);
}

.toast-error .toast-icon {
    color: var(--danger-color);
}

.toast-warning {
    border-left-color: var(--warning-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast-info {
    border-left-color: var(--primary-color);
}

.toast-info .toast-icon {
    color: var(--primary-color);
}

/* Dark mode adjustments */
[data-theme="dark"] .toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@media (max-width: 480px) {
    #toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* ============================================
   DEVICES PAGE (RMM)
   ============================================ */

.devices-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.devices-stats .stat-card.stat-small {
    flex: 1;
    padding: 1rem;
    min-width: 0;
}

.devices-stats .stat-card.stat-small h4 {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.devices-stats .stat-card.stat-small .stat-number {
    font-size: 1.5rem;
}

.devices-stats .stat-success {
    border-left: 3px solid var(--success-color);
}

.devices-stats .stat-warning {
    border-left: 3px solid var(--warning-color);
}

.devices-stats .stat-clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.devices-stats .stat-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: var(--bg-tertiary);
}

.devices-stats .stat-selected {
    box-shadow: 0 0 0 2px var(--primary-color);
    background-color: var(--bg-tertiary);
}

/* Device Info Layout with Screenshot */
.device-info-layout {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.device-screenshot-container {
    flex: 0 0 400px;
    position: relative;
}

.screenshot-refresh-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.screenshot-refresh-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.device-screenshot {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    min-height: 225px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-screenshot .screenshot-img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.device-screenshot .screenshot-img:hover {
    opacity: 0.9;
}

.device-screenshot .screenshot-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 2rem;
    text-align: center;
}

.device-info-details {
    flex: 1;
    min-width: 0;
}

.detail-grid.compact .detail-row {
    padding: 0.35rem 0;
}

.detail-grid.compact .detail-label {
    min-width: 100px;
    margin-right: 0.5rem;
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.device-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.device-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

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

.device-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.device-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.device-status-dot.status-online {
    background: var(--success-color);
    box-shadow: 0 0 6px var(--success-color);
}

.device-status-dot.status-offline {
    background: var(--warning-color);
}

.device-status-dot.status-pending {
    background: var(--secondary-color);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-online {
    background: var(--success-color);
    color: white;
}

.status-badge.status-offline {
    background: var(--warning-color);
    color: white;
}

.status-badge.status-pending {
    background: var(--secondary-color);
    color: white;
}

.device-details {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.device-notes {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.device-actions {
    display: flex;
    gap: 0.5rem;
}

/* Device Detail Modal */
#device-detail-content {
    padding-right: 2rem;
}

#device-detail-content .detail-section,
#device-detail-content .detail-grid,
#device-detail-content .device-info-layout {
    margin-right: 0.5rem;
}

.device-detail-content .detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.device-detail-content .detail-section:last-child {
    border-bottom: none;
}

.device-detail-content .detail-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.device-detail-content .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.device-detail-content .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 4px;
}

.device-detail-content .detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.device-detail-content .detail-value {
    font-weight: 500;
    text-align: right;
}

.device-detail-content .detail-value code {
    font-size: 0.75rem;
    background: var(--border-color);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.disk-item, .ip-item {
    padding: 0.5rem;
    background: var(--background);
    border-radius: 4px;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

/* Enrollment Token */
.token-result {
    padding: 1rem 0;
}

.token-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.token-display code {
    flex: 1;
    font-size: 0.9rem;
    word-break: break-all;
    background: transparent;
}

/* Filter search input */
.filter-search {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 320px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

/* Page header actions */
.page-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Job History */
.jobs-list {
    max-height: 300px;
    overflow-y: auto;
}

.job-item {
    padding: 0.75rem;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.job-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.job-type {
    font-weight: 500;
    font-size: 0.9rem;
}

.job-item-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Job Detail */
.job-detail-content {
    max-height: 70vh;
    overflow-y: auto;
}

.job-params, .job-output {
    background: var(--background);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.job-stdout {
    border-left: 3px solid var(--success-color);
}

.job-stderr, .job-error {
    border-left: 3px solid var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.empty-state-small {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* History Tab */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-filters {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.history-filter-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--background);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.history-filter-btn:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.history-filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--border-color);
    border-color: var(--primary-color);
}

.history-item-icon {
    font-size: 1.25rem;
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
}

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

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.history-item-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.history-item-category {
    text-transform: capitalize;
    background: var(--background-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.history-load-more {
    text-align: center;
    padding: 1rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

/* Chat History Messages */
.chat-history-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 6px;
}

.chat-history-msg {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    max-width: 85%;
}

.chat-history-msg.tech {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
}

.chat-history-msg.user {
    background: var(--border-color);
    align-self: flex-start;
}

.chat-history-msg.system {
    background: var(--background-secondary);
    color: var(--text-secondary);
    font-style: italic;
    align-self: center;
    font-size: 0.85rem;
}

.chat-history-sender {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.chat-history-content {
    font-size: 0.9rem;
    word-break: break-word;
}

.chat-history-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    text-align: right;
}

/* Device Detail Tabs */
.device-detail-tabs {
    max-height: 60vh;
    overflow-y: auto;
}

.device-detail-tabs .tab-buttons {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.device-detail-tabs .tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.device-detail-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.device-detail-tabs .tab-content {
    display: none;
}

.device-detail-tabs .tab-content.active {
    display: block;
}

/* Device Detail Actions */
.device-detail-actions {
    justify-content: space-between !important;
}

.device-detail-actions .action-group-left,
.device-detail-actions .action-group-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.device-detail-actions .action-group-left {
    flex: 1;
}

.device-detail-actions .action-group-right {
    justify-content: flex-end;
}

/* Agent Versions */
.versions-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.versions-list {
    max-height: 50vh;
    overflow-y: auto;
}

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--card-background);
}

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

.version-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.version-info strong {
    font-size: 1rem;
}

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

.version-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

.version-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Device Services List (Windows services panel) */
#device-services-list {
    max-height: 400px;
    overflow-y: auto;
}

.services-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.services-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.service-row {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.service-row:hover {
    background: var(--background);
}

.svc-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.svc-status {
    width: 100px;
    text-align: center;
}

.svc-startup {
    width: 120px;
    text-align: center;
    color: var(--text-secondary);
}

.svc-startup-select {
    width: 100%;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-background);
    color: var(--text-primary);
    cursor: pointer;
}

.svc-startup-select:hover {
    border-color: var(--primary);
}

.svc-actions {
    width: 110px;
    text-align: center;
}

.svc-action-btns {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.btn-tiny {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 3px;
    min-width: 28px;
    line-height: 1.2;
}

.btn-tiny:hover {
    opacity: 0.85;
}

/* Processes Table */
.processes-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
}

.processes-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.process-row {
    display: flex;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.process-row:hover {
    background: var(--background);
}

.proc-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.proc-pid {
    width: 70px;
    text-align: right;
    padding-right: 1rem;
    font-family: monospace;
    color: var(--text-secondary);
}

.proc-mem {
    width: 80px;
    text-align: right;
    padding-right: 1rem;
}

.proc-cpu {
    width: 60px;
    text-align: right;
    padding-right: 1rem;
}

.proc-actions {
    width: 60px;
    text-align: center;
}

/* Scripts Table */
.scripts-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.scripts-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.script-row {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.script-row:hover {
    background: var(--background);
}

.script-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.script-status {
    width: 100px;
    text-align: center;
}

.script-date {
    width: 150px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.script-actions {
    width: 60px;
    text-align: center;
}

/* Installer Modal */
.installer-modal p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.installer-info {
    background: var(--background);
    border-radius: 8px;
    padding: 1rem;
    margin: 1.5rem 0;
}

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

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

.installer-info .info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.installer-info .info-value {
    font-family: monospace;
    color: var(--text-primary);
}

.installer-note {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    border-radius: 0 6px 6px 0;
}

.installer-note strong {
    color: var(--primary-color);
}

/* Applications List */
.apps-list {
    max-height: 400px;
    overflow-y: auto;
}

.apps-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.apps-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.app-row {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.app-row:hover {
    background: var(--background);
}

.app-name {
    flex: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.app-version {
    width: 120px;
    color: var(--text-secondary);
}

.app-publisher {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* Application Change History */
.app-changes-list {
    max-height: 300px;
    overflow-y: auto;
}

.app-changes-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.app-changes-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.app-change-row {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.app-change-row:hover {
    background: var(--background);
}

.app-change-row .change-type {
    width: 100px;
}

.app-change-row .change-app {
    flex: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.app-change-row .change-version {
    flex: 1;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.8rem;
}

.app-change-row .change-date {
    width: 150px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: right;
}

.app-changes-header .change-type { width: 100px; }
.app-changes-header .change-app { flex: 2; }
.app-changes-header .change-version { flex: 1; }
.app-changes-header .change-date { width: 150px; text-align: right; }

.change-type-installed {
    border-left: 3px solid var(--success);
}

.change-type-uninstalled {
    border-left: 3px solid var(--danger);
}

.change-type-updated {
    border-left: 3px solid var(--info);
}

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

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

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

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.filter-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-background);
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Service Change History */
.service-changes-list {
    max-height: 300px;
    overflow-y: auto;
}

.service-changes-table {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.service-changes-header {
    display: flex;
    padding: 0.5rem 0.75rem;
    background: var(--background);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}

.service-change-row {
    display: flex;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.service-change-row:hover {
    background: var(--background);
}

.service-change-row .change-type {
    width: 100px;
}

.service-change-row .change-service {
    flex: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1rem;
}

.service-change-row .change-detail {
    flex: 1;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.8rem;
}

.service-change-row .change-date {
    width: 150px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: right;
}

.service-changes-header .change-type { width: 100px; }
.service-changes-header .change-service { flex: 2; }
.service-changes-header .change-detail { flex: 1; }
.service-changes-header .change-date { width: 150px; text-align: right; }

.change-type-status {
    border-left: 3px solid var(--warning);
}

.badge-warning {
    background: var(--warning);
    color: #333;
}

/* =====================================================
   DEVICES PAGE SUBTABS
   ===================================================== */

.devices-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.devices-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

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

.devices-tab.active {
    background: var(--primary-color);
    color: white;
}

.devices-subtab-content {
    min-height: 300px;
}

.devices-subtab-content.hidden {
    display: none;
}

.subtab-header {
    margin-bottom: 1rem;
}

.subtab-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Alerts Stats */
.alerts-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Alert Cards */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: box-shadow 0.2s;
}

.alert-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.alert-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.alert-title strong {
    font-size: 1rem;
    color: var(--text-primary);
}

.alert-policy {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.alert-details {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.alert-violations {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.violation-badge {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-color, #dc2626);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
}

/* Alert Detail Modal */
.alert-detail .detail-section {
    margin-bottom: 1.5rem;
}

.alert-detail .detail-section h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.alert-detail .violations-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-detail .violation-item {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger-color, #dc2626);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.alert-detail textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

/* Admin Sub-tabs (within Devices Admin) */
.admin-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.admin-sub-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.admin-sub-tab:hover {
    color: var(--text-primary);
    background: var(--background);
}

.admin-sub-tab.active {
    color: var(--primary-color);
    background: var(--background);
    font-weight: 500;
}

.devices-admin-tab-content {
    padding-top: 0.5rem;
}

.devices-admin-tab-content.hidden {
    display: none;
}

/* Scripts List */
.scripts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.script-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.script-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.script-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    border-radius: 8px;
    margin-right: 1rem;
    font-size: 1.25rem;
}

.script-info {
    flex: 1;
    min-width: 0;
}

.script-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.script-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.script-type {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.script-card .script-actions {
    display: flex;
    gap: 0.5rem;
    width: auto;
    flex-shrink: 0;
}

/* Policies List */
.policies-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.policy-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.policy-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.policy-card.disabled {
    opacity: 0.6;
}

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

.policy-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.policy-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.policy-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.policy-conditions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.policy-condition-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--background);
    border-radius: 4px;
    font-size: 0.75rem;
}

.policy-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: auto;
}

/* Toggle Switch for Policies */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

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

.toggle-switch .toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 44px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 24px;
    transition: 0.3s;
}

/* Override base .toggle-slider::after to prevent duplicate knob */
.toggle-switch .toggle-slider::after {
    display: none;
}

.toggle-switch .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

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

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

/* ============ SCHEDULES ============ */
.schedules-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.schedules-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.schedule-card {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    position: relative;
}

.schedule-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.schedule-status-indicator {
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 8px 0 0 8px;
}

.schedule-status-indicator.enabled {
    background: var(--success-color);
}

.schedule-status-indicator.disabled {
    background: var(--text-muted);
}

.schedule-info {
    flex: 1;
    min-width: 0;
    padding-left: 0.5rem;
}

.schedule-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.schedule-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.schedule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.schedule-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.schedule-meta .meta-icon {
    font-style: normal;
}

.schedule-timing {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.schedule-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.status-badge.status-enabled {
    background: var(--success-color);
    color: white;
}

.status-badge.status-disabled {
    background: var(--text-muted);
    color: white;
}

/* Schedule form sections */
.form-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Checkbox list for device selection */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background: var(--card-bg);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

.checkbox-item:hover {
    background: var(--background);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-item span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Schedule history */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
}

.history-status {
    flex-shrink: 0;
}

.history-details {
    flex: 1;
}

.history-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.history-jobs {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-error {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--danger-bg, rgba(239, 68, 68, 0.1));
    border-radius: 4px;
    color: var(--danger-color);
    font-size: 0.8rem;
}

.status-badge.status-success {
    background: var(--success-color);
    color: white;
}

.status-badge.status-warning {
    background: var(--warning-color);
    color: white;
}

.status-badge.status-danger {
    background: var(--danger-color);
    color: white;
}

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

.stat-info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* Script Editor Modal */
.script-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.script-editor textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    min-height: 300px;
    resize: vertical;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
}

/* Script Parameters Editor */
.parameters-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 60px;
    background: var(--background);
}

.parameters-list .empty-state {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.parameter-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    align-items: flex-start;
}

.parameter-row input,
.parameter-row select {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
}

.parameter-row input:focus,
.parameter-row select:focus {
    outline: none;
    border-color: var(--primary);
}

.script-run-parameters {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 1rem;
}

.script-run-parameters .form-group {
    margin-bottom: 0.75rem;
}

.script-run-parameters .form-group:last-child {
    margin-bottom: 0;
}

/* Policy Editor */
.policy-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.condition-builder, .action-builder {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.condition-builder h4, .action-builder h4 {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.condition-row, .action-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.condition-row select, .action-row select {
    min-width: 120px;
}

.condition-row input, .action-row input {
    min-width: 80px;
    max-width: 120px;
}

/* Policy Form Sections */
.policy-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

.section-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Form Rows */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Condition and Action Items */
.condition-item, .action-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 4px;
}

.condition-item select, .action-item select {
    min-width: 140px;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-primary);
}

.condition-item input, .action-item input {
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-primary);
}

.condition-value {
    width: 80px;
}

.condition-service-select {
    width: 200px;
    min-width: 200px;
}

.condition-value-placeholder {
    width: 80px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.condition-duration {
    width: 100px;
}

.action-config {
    flex: 1;
    min-width: 200px;
}

select.action-config {
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-primary);
}

.action-config-small {
    flex: 0 1 auto;
    min-width: 120px;
    max-width: 150px;
}

.action-config-placeholder {
    flex: 1;
    min-width: 200px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.4rem;
}

.conditions-list, .actions-list {
    min-height: 40px;
}

/* Policy Assignment Modal */
.assign-policy-modal p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.assign-devices-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.assign-device-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.assign-device-item:hover {
    background: var(--hover-bg);
}

.assign-device-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.assign-device-item span {
    color: var(--text-primary);
}

.assign-client {
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
}

/* Empty state small */
.empty-state-small {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Integrations Grid */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.integration-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s;
}

.integration-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.integration-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.integration-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.integration-title h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.integration-status {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.integration-status.status-enabled {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
}

.integration-status.status-disabled {
    background: var(--hover-bg);
    color: var(--text-secondary);
}

.integration-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.integration-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal toolbar for integration modals */
.modal-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Quick Support Session Code */
.quick-support-info {
    text-align: center;
}

.quick-support-info .session-code {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    color: var(--primary-color);
    background: var(--hover-bg);
    padding: 1rem 2rem;
    border-radius: 8px;
    margin: 0.5rem 0;
    font-family: 'Consolas', 'Monaco', monospace;
}

.quick-support-info .form-group {
    margin-bottom: 1.5rem;
}

.quick-support-info input[readonly] {
    background: var(--hover-bg);
    cursor: pointer;
}

.quick-support-instructions {
    text-align: left;
    background: var(--hover-bg);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.quick-support-instructions label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.quick-support-instructions ol {
    margin: 0;
    padding-left: 1.25rem;
}

.quick-support-instructions li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.quick-support-instructions li:last-child {
    margin-bottom: 0;
}

/* Quick Support Subtab */
.quick-support-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 1rem 0;
}

.quick-support-intro {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.quick-support-intro h3 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
}

.quick-support-intro ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.quick-support-intro li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.quick-support-intro ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.quick-support-intro code {
    background: var(--hover-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary-color);
}

.quick-support-intro h4 {
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.quick-support-tip {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--hover-bg);
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.quick-support-tip a {
    color: var(--primary-color);
    font-weight: 600;
}

.quick-support-sessions {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.quick-support-sessions h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.session-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-card {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

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

.session-code-display {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.3rem;
    color: var(--primary-color);
    font-family: 'Consolas', 'Monaco', monospace;
}

.session-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.session-urls {
    margin-bottom: 1rem;
}

.session-url-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-url-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.session-url-row input {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.session-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .quick-support-container {
        grid-template-columns: 1fr;
    }
}

/* Groups section styling */
.groups-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

/* Text muted helper */
.text-muted {
    color: var(--text-secondary);
    font-style: italic;
}

/* Checkbox label styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* ============ SYNCRO VIEWER STYLES ============ */

.syncro-stats {
    margin-bottom: 1.5rem;
}

.syncro-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.syncro-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px 4px 0 0;
    transition: all 0.2s;
}

.syncro-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.syncro-tab.active {
    background: var(--primary-color);
    color: white;
}

.syncro-tab-content {
    padding: 1rem 0;
}

.syncro-tab-content.hidden {
    display: none;
}

.syncro-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.syncro-search {
    flex: 1;
    max-width: 400px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.syncro-list {
    min-height: 200px;
}

.syncro-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

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

/* Syncro Detail Modal */
.syncro-detail {
    padding: 1rem 0;
}

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

.syncro-detail .detail-header h3 {
    margin: 0;
}

.syncro-detail .detail-section {
    margin-bottom: 1.5rem;
}

.syncro-detail .detail-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.syncro-detail .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.syncro-detail .detail-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.syncro-detail .detail-stats .stat-item {
    text-align: center;
}

.syncro-detail .detail-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.syncro-detail .detail-stats .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.syncro-detail .detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.syncro-detail .ticket-comments {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 4px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Ticket Notes Container - visual separation of comments */
.syncro-detail .ticket-notes-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.syncro-detail .syncro-note-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    padding: 1rem;
}

.syncro-detail .syncro-note-card .note-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.syncro-detail .syncro-note-card .note-content p {
    margin: 0 0 0.5rem 0;
}

.syncro-detail .syncro-note-card .note-content p:last-child {
    margin-bottom: 0;
}

/* Time Entries List - card-based layout */
.syncro-detail .time-entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.syncro-detail .time-entry-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem 1rem;
}

.syncro-detail .time-entry-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.syncro-detail .time-entry-dates {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.syncro-detail .time-entry-duration {
    font-weight: 600;
    color: var(--primary-color);
}

.syncro-detail .time-entry-billable {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.syncro-detail .time-entry-billable.billable {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.syncro-detail .time-entry-billable.non-billable {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-secondary);
}

.syncro-detail .time-entry-notes {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Line items import modal */
.import-form .help-text {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.import-form .current-count-info {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.import-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.import-form .checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.import-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
}

.import-result .success-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 1rem;
    border-radius: 4px;
}

.import-result .error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 1rem;
    border-radius: 4px;
}

.import-result .errors {
    color: #f97316;
    font-size: 0.9em;
    margin-top: 0.5rem;
}

/* Line items description cell in invoice detail */
.syncro-detail .description-cell {
    max-width: 300px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Toolbar buttons container */
.syncro-toolbar .toolbar-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Filter checkbox in toolbar */
.syncro-toolbar .filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.syncro-toolbar .filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

/* Detail ID display */
.syncro-detail .detail-id {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.syncro-detail .code-block {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Data table for syncro viewer */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

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

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table.compact th,
.data-table.compact td {
    padding: 0.5rem;
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

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

/* Serial status badges */
.status-badge.status-in-stock {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-badge.status-sold {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-badge.status-reserved {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.status-badge.status-returned {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.status-badge.status-in-transfer {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-badge.status-breakage {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-badge.status-used-in-refurb {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Syncro filter select */
.syncro-filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 150px;
}

.syncro-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state.error {
    color: #ef4444;
}

.muted {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Syncro Admin Settings */
.syncro-admin-settings {
    max-width: 600px;
    padding: 1.5rem;
}

.syncro-admin-settings h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.syncro-admin-settings > .help-text {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.syncro-admin-settings .form-group {
    margin-bottom: 1.25rem;
}

.syncro-admin-settings label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.syncro-admin-settings .form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.syncro-admin-settings .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.syncro-admin-settings .input-with-suffix {
    display: flex;
    align-items: center;
}

.syncro-admin-settings .input-with-suffix input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.syncro-admin-settings .input-suffix {
    padding: 0.625rem 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.syncro-admin-settings .form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.api-status {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.api-status.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.api-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

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

/* ============ DOMAIN/HOSTING TOOLS ============ */
.domain-hosting-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.domain-hosting-sub-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.domain-hosting-sub-tab:hover {
    background: var(--background);
    color: var(--text-primary);
}

.domain-hosting-sub-tab.active {
    background: var(--primary-color);
    color: white;
}

.domain-hosting-sub-content {
    padding: 1rem 0;
}

.domain-hosting-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.domain-hosting-filters select,
.domain-hosting-filters .search-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.domain-hosting-filters .search-input {
    flex: 1;
    min-width: 200px;
}

.domain-hosting-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.domain-hosting-stats .stat-card {
    flex: 1;
    min-width: 150px;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    text-align: center;
}

.domain-hosting-stats .stat-card.warning {
    background: rgba(251, 191, 36, 0.1);
}

.domain-hosting-stats .stat-card.warning .stat-value {
    color: #f59e0b;
}

.domain-hosting-stats .stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    display: block;
    color: var(--primary-color);
}

.domain-hosting-stats .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.domain-hosting-stats .stat-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.domain-hosting-stats .stat-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.domain-hosting-stats .stat-card.clickable.active {
    border-color: var(--primary-color);
    background: var(--bg-primary);
}

.domain-hosting-stats .stat-card.clickable.warning.active {
    border-color: #f59e0b;
}

.header-balance {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.header-balance span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Domain Search/Registration */
.register-domain-container {
    max-width: 800px;
}

.domain-search-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.domain-search-section h4 {
    margin: 0 0 1rem 0;
}

.domain-search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.domain-search-input-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.domain-name-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
}

.tld-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 120px;
}

.domain-search-results {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.domain-search-results h5 {
    margin: 0 0 1rem 0;
}

.domain-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border-left: 3px solid;
}

.domain-result.available {
    border-left-color: #22c55e;
}

.domain-result.unavailable {
    border-left-color: #ef4444;
}

.domain-result-name {
    font-weight: 500;
}

.domain-result-status {
    margin-right: 1rem;
}

.domain-result-price {
    font-weight: 600;
    color: #22c55e;
    margin: 0 1rem;
}

.domain-cost-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #22c55e;
    margin: -0.5rem 0 1.5rem 0;
    padding: 0.75rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 6px;
    display: inline-block;
}

.domain-registration-section {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.domain-registration-section h4 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
}

.domain-registration-section h5 {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Add Hosting */
.add-hosting-container {
    max-width: 600px;
}

.add-hosting-container h4 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
}

.plan-details {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.plan-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.plan-info span {
    color: var(--text-secondary);
}

.plan-info strong {
    color: var(--text-primary);
}

/* AU Eligibility */
.au-eligibility-container {
    max-width: 800px;
}

.au-eligibility-container h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.au-eligibility-form {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.au-eligibility-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.au-eligibility-form .form-group-btn {
    flex: 0 0 auto;
    padding-bottom: 0;
}

.au-eligibility-results {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.au-eligibility-results h5 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

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

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

.eligibility-table th {
    width: 150px;
    color: var(--text-secondary);
    font-weight: 500;
}

.eligibility-table td {
    color: var(--text-primary);
}

/* AU Domains Eligibility Status Section */
.au-domains-eligibility-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.au-domains-eligibility-section h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.au-domains-eligibility-section .text-muted {
    margin-bottom: 1rem;
}

#au-domains-eligibility-table-container {
    margin-top: 1.5rem;
}

#au-domains-eligibility-table .row-warning {
    background-color: rgba(239, 68, 68, 0.05);
}

#au-domains-eligibility-table .row-warning:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.badge-danger {
    background-color: #ef4444;
    color: white;
}

.domain-eligibility-details .details-table {
    width: 100%;
    border-collapse: collapse;
}

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

.domain-eligibility-details .details-table th {
    width: 150px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

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

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Domain Details Modal */
.domain-details .details-table {
    width: 100%;
    border-collapse: collapse;
}

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

.domain-details .details-table th {
    color: var(--text-secondary);
    font-weight: 500;
    width: 150px;
}

.domain-details .details-table td {
    color: var(--text-primary);
}

/* Syncro Sync Progress */
.sync-progress-container {
    flex: 1;
    margin-left: 1rem;
}

.sync-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sync-progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

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

.sync-progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sync-progress-text .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.sync-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.sync-result-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.sync-result-warning {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.sync-result-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sync-result .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    opacity: 0.7;
}

.sync-result .btn-sm:hover {
    opacity: 1;
}

/* Related PO link confidence styles */
.po-link-high {
    color: #22c55e;
    font-weight: 500;
}

.po-link-high:hover {
    color: #16a34a;
}

.po-link-low {
    color: var(--text-secondary);
    font-style: italic;
}

.po-link-low:hover {
    color: var(--text-primary);
}

/* Help tooltip icon */
.help-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--border-color);
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
}

.help-tooltip:hover {
    background: var(--primary-color);
    color: white;
}

/* Help popup content */
.help-popup-content {
    padding: 0.5rem 0;
    line-height: 1.6;
}

.help-popup-content p {
    margin: 0;
}

/* =====================================================
   Web Proxy Controls
   ===================================================== */
.section-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.proxy-form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.proxy-form-row .form-group {
    margin-bottom: 0;
}

.proxy-form-row input[type="text"],
.proxy-form-row input[type="number"] {
    width: 100%;
}

.proxy-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.proxy-status-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.proxy-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.proxy-status-badge.status-connected {
    background: #dcfce7;
    color: #16a34a;
}

.proxy-status-badge.status-pending {
    background: #fef3c7;
    color: #d97706;
    animation: pulse-yellow 1.5s ease-in-out infinite;
}

[data-theme="dark"] .proxy-status-badge.status-connected {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

[data-theme="dark"] .proxy-status-badge.status-pending {
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
}

@keyframes pulse-yellow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.proxy-actions {
    display: flex;
    gap: 0.5rem;
}

#proxy-target-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ============ Ticket Merge Modal ============ */

.ticket-actions-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.ticket-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ticket-action-buttons .btn {
    width: 100%;
    text-align: center;
}

.merge-ticket-modal {
    min-width: 400px;
}

.merge-description {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.merge-ticket-results {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 0.5rem;
}

.merge-ticket-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.merge-ticket-result:last-child {
    border-bottom: none;
}

.merge-ticket-result:hover {
    background: var(--background);
}

.merge-ticket-id {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
}

.merge-ticket-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merge-ticket-client {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merge-no-results,
.merge-error {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.merge-error {
    color: var(--danger-color);
}

.merge-ticket-selected {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 6px;
    border: 2px solid var(--primary-color);
}

.selected-ticket-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.selected-ticket-info span {
    font-weight: 500;
}

/* Item Approval Badges */
.approval-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

.approval-badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.approval-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.approval-badge.pending {
    background: #e2e8f0;
    color: #475569;
}

/* Partial Approval Badge */
.status-partial {
    background: #fef3c7 !important;
    color: #92400e !important;
}

/* Rejected Item Row Styling */
.item-rejected td {
    opacity: 0.6;
    text-decoration: line-through;
}

.item-rejected td:first-child {
    text-decoration: none;
}

/* ================================================
   Admin Notifications Settings Styles
   ================================================ */

.notification-category {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.notification-category-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.notification-category-header:hover {
    background: var(--hover-color);
}

.notification-category-header .category-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.notification-category-header strong {
    flex: 1;
    font-size: 0.95rem;
}

.notification-category-header .category-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.notification-category-header .expand-icon {
    width: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
}

.notification-category-content {
    padding: 1rem 1.25rem;
}

.notification-category-content .category-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.notification-types-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notification-type-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-radius: 6px;
    gap: 1rem;
}

.notification-type-item.disabled {
    opacity: 0.6;
}

.notification-type-info {
    flex: 1;
}

.notification-type-info strong {
    font-size: 0.9rem;
    display: inline-block;
    margin-right: 0.5rem;
}

.notification-type-info .badge-system {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    vertical-align: middle;
}

.notification-type-info .type-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
}

.notification-type-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-type-controls .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.notification-type-controls .toggle-label.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.notification-type-controls .toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.notification-type-controls .toggle-label.locked input[type="checkbox"] {
    cursor: not-allowed;
}

/* Recipient Summary Badges */
.recipient-summary {
    margin-top: 0.5rem;
}

.recipient-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.35rem;
}

.recipient-badge.default {
    background: #e2e8f0;
    color: #475569;
}

.recipient-badge.groups {
    background: #dbeafe;
    color: #1e40af;
}

.recipient-badge.users {
    background: #d1fae5;
    color: #065f46;
}

/* Recipient Config Modal */
.recipient-config-modal .modal-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.recipient-section {
    margin-bottom: 1.5rem;
}

.recipient-section h4 {
    font-size: 0.9rem;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

.recipient-list {
    background: var(--background);
    border-radius: 6px;
    padding: 0.75rem;
}

.recipient-list-scrollable {
    max-height: 250px;
    overflow-y: auto;
}

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

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

.recipient-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    flex: 1;
}

.recipient-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.recipient-checkbox .user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.recipient-delivery-options {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.recipient-delivery-options label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.recipient-delivery-options input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

/* Loading inline */
.loading-inline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.error-text {
    font-size: 0.8rem;
    color: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .notification-type-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .notification-type-controls {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .recipient-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .recipient-delivery-options {
        margin-left: 1.5rem;
    }
}

/* Policy Action Config Info */
.action-config-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 4px;
    flex: 1;
}

.action-config-info i {
    color: var(--primary-color);
}

.action-config-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.action-config-info a:hover {
    text-decoration: underline;
}

/* ============ RETURNS MANAGEMENT ============ */
.returns-tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.returns-sub-tabs {
    display: flex;
    gap: 0.5rem;
}

.returns-help-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.returns-help-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Inline Help Button (for page headers) */
.help-btn-inline {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    vertical-align: middle;
    transition: all 0.2s;
}

.help-btn-inline:hover {
    background: var(--primary-color);
    color: white;
}

.returns-sub-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.returns-sub-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.returns-sub-tab.active {
    background: var(--primary-color);
    color: white;
}

.returns-sub-content {
    padding: 1rem 0;
}

/* Return Status Badges */
.return-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.return-status.draft {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.return-status.submitted {
    background: #fef3c7;
    color: #92400e;
}

.return-status.approved,
.return-status.authorized {
    background: #dbeafe;
    color: #1e40af;
}

.return-status.received,
.return-status.shipped {
    background: #e0e7ff;
    color: #3730a3;
}

.return-status.processed,
.return-status.received_credit {
    background: #d1fae5;
    color: #065f46;
}

.return-status.closed,
.return-status.applied {
    background: #dcfce7;
    color: #166534;
}

.return-status.cancelled,
.return-status.voided {
    background: #fee2e2;
    color: #991b1b;
}

.return-status.issued {
    background: #cffafe;
    color: #0e7490;
}

/* Return Detail View */
.return-detail {
    max-height: 70vh;
    overflow-y: auto;
}

.return-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.return-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.return-meta p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.return-items {
    margin-bottom: 1.5rem;
}

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

.items-header h4 {
    margin: 0;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.items-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.items-table tfoot td {
    font-weight: 500;
    border-top: 2px solid var(--border-color);
}

.return-notes {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.return-notes h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.return-notes p {
    margin: 0;
    font-size: 0.875rem;
}

.return-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Store Credits Stats */
#store-credits-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Store Credit History */
.store-credit-history .current-balance {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.store-credit-history .current-balance h4 {
    margin: 0;
    color: var(--success-color);
}

/* Text utility classes for returns */
.text-success {
    color: var(--success-color);
}

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

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

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

/* Returns Help Content */
.returns-help-content {
    max-height: 70vh;
    overflow-y: auto;
    line-height: 1.6;
}

.returns-help-content h4 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.returns-help-content h4:first-child {
    margin-top: 0;
}

.returns-help-content h5 {
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

.returns-help-content p {
    margin: 0.5rem 0;
}

.returns-help-content ul,
.returns-help-content ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.returns-help-content li {
    margin: 0.25rem 0;
}

.workflow-diagram {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.workflow-diagram pre {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    margin: 0;
    white-space: pre;
    color: var(--text-primary);
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.help-table th,
.help-table td {
    padding: 0.5rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.help-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.help-workflow {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.help-workflow h5 {
    margin-top: 0;
}

.help-workflow ol {
    margin-bottom: 0;
}

/* Responsive for returns */
@media (max-width: 768px) {
    .returns-tab-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .returns-sub-tabs {
        flex-wrap: wrap;
    }

    .return-header {
        flex-direction: column;
        gap: 1rem;
    }

    #store-credits-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .return-actions {
        flex-direction: column;
    }

    .return-actions .btn {
        width: 100%;
    }

    .workflow-diagram pre {
        font-size: 0.6rem;
    }
}

/* ============================================
   PRODUCT RESEARCH TAB
   ============================================ */

.research-container {
    max-width: 900px;
    margin: 0 auto;
}

.research-form {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.research-form .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.research-form .form-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
}

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

.research-form .form-row .checkbox-label {
    padding-bottom: 0.5rem;
}

.research-form .form-actions {
    margin-top: 1rem;
}

.research-form .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.research-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.research-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.research-error {
    background: var(--danger-bg);
    color: var(--danger-color);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

.research-results {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.research-analysis {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.research-analysis h4 {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.research-analysis p {
    margin: 0;
    line-height: 1.6;
}

.research-recommendations {
    padding: 1.25rem;
}

.research-recommendations h4 {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.research-recommendation-card {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.research-recommendation-card:last-child {
    margin-bottom: 0;
}

.recommendation-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.recommendation-rank {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.recommendation-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.recommendation-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.recommendation-supplier {
    color: var(--text-secondary);
}

.recommendation-price {
    font-weight: 600;
    color: var(--success-color);
}

.recommendation-stock {
    color: var(--text-secondary);
}

.recommendation-mpn {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.recommendation-reason {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.research-meta {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

#research-detected-category {
    background: var(--primary-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Follow-up conversation */
.research-conversation {
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.research-conversation:empty {
    display: none;
}

.research-qa-pair {
    border-bottom: 1px solid var(--border-color);
}

.research-qa-pair:last-child {
    border-bottom: none;
}

.research-message {
    padding: 0.875rem 1.25rem;
}

.research-message-user {
    background: var(--bg-secondary);
    border-bottom: none;
}

.research-message-user .message-content {
    font-weight: 500;
}

.research-message-assistant {
    background: var(--bg-primary);
    padding-top: 0.5rem;
}

.research-message .message-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.research-message .message-content {
    line-height: 1.6;
}

.research-message .message-content.error {
    color: var(--danger-color);
}

.research-message-loading {
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Follow-up input */
.research-followup {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.followup-input-group {
    display: flex;
    gap: 0.5rem;
}

.followup-input-group input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.followup-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.followup-input-group .btn {
    padding: 0.625rem 1.25rem;
    min-width: 70px;
}

.followup-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    align-items: center;
}

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

.suggestion-btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.suggestion-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    .research-form .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .recommendation-details {
        flex-direction: column;
        gap: 0.25rem;
    }

    .research-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .followup-suggestions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   DEVICE MERGE MODAL
   ============================================ */

.merge-device-modal {
    max-width: 600px;
}

.merge-candidates-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.merge-candidate-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s;
}

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

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

.merge-candidate-item input[type="radio"] {
    margin-top: 0.25rem;
}

.merge-candidate-item label {
    flex: 1;
    cursor: pointer;
}

.candidate-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.candidate-info strong {
    font-size: 0.95rem;
}

.candidate-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.merge-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: #856404;
}

.no-candidates {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.no-candidates p {
    margin: 0.5rem 0;
}

/* ========================================
   @Mention Styles
   ======================================== */

/* Mention tag styling in note content */
.mention {
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 500;
    cursor: default;
}

/* Mention in Quill editor */
.ql-editor .mention {
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Note card highlighted when you're mentioned */
.note-card.mentions-me {
    border-left: 4px solid #1565c0;
    background: linear-gradient(90deg, rgba(21, 101, 192, 0.08) 0%, transparent 30%);
}

.note-card.mentions-me .note-header {
    background: rgba(21, 101, 192, 0.05);
}

/* Mention autocomplete dropdown */
.mention-dropdown {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
    min-width: 180px;
}

.mention-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

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

.mention-item:hover,
.mention-item.selected {
    background: var(--bg-hover);
}

.mention-item.selected {
    background: var(--primary-color);
    color: white;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .mention {
        background-color: rgba(21, 101, 192, 0.3);
        color: #90caf9;
    }

    .ql-editor .mention {
        background-color: rgba(21, 101, 192, 0.3);
        color: #90caf9;
    }

    .note-card.mentions-me {
        border-left-color: #90caf9;
        background: linear-gradient(90deg, rgba(144, 202, 249, 0.1) 0%, transparent 30%);
    }

    .note-card.mentions-me .note-header {
        background: rgba(144, 202, 249, 0.08);
    }
}

/* ============================================================
   FORM BUILDER STYLES
   ============================================================ */

/* Forms List */
.forms-container {
    padding: 20px 0;
}

.forms-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.forms-filters select,
.forms-filters .search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.forms-filters .search-input {
    flex: 1;
    max-width: 300px;
}

/* Form Builder Modal - Full Width */
#form-builder-modal {
    max-width: 900px !important;
    width: 90vw !important;
    height: 95vh !important;
    max-height: 95vh !important;
}

#form-builder-modal .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#form-builder-modal .modal-body {
    flex: 1;
    overflow-y: auto;
}

/* Field/Action editor modals overlay on top of form builder */
#field-editor-modal,
#action-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

#field-editor-modal > .modal-content,
#action-editor-modal > .modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#field-editor-modal > .modal-content > .modal-body,
#action-editor-modal > .modal-content > .modal-body {
    overflow-y: auto;
}

#field-editor-modal.hidden,
#action-editor-modal.hidden {
    display: none !important;
}

.form-builder-tabs {
    display: flex;
    gap: 5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.form-builder-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.form-builder-tab:hover {
    color: var(--text-color);
}

.form-builder-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.form-builder-tab-content {
    min-height: 300px;
}

/* Fields List */
.fields-toolbar,
.actions-toolbar {
    margin-bottom: 15px;
}

.fields-list,
.actions-list {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 200px;
    padding: 10px;
    background: var(--bg-color);
}

.field-item,
.action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
}

.field-item:last-child,
.action-item:last-child {
    margin-bottom: 0;
}

.field-item.dragging {
    opacity: 0.5;
}

.field-item-drag {
    cursor: grab;
    color: var(--text-secondary);
    padding: 5px;
}

.field-item-info,
.action-item-info {
    flex: 1;
}

.field-item-actions,
.action-item-actions {
    display: flex;
    gap: 5px;
}

.field-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-color);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.required-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ffc107;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    margin-left: 5px;
}

/* Field Options */
.field-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-option-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.field-option-item input {
    flex: 1;
}

.field-option-item .btn-icon {
    padding: 5px 10px;
}

/* Form Preview */
.form-preview-container {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    background: white;
    max-width: 500px;
    margin: 0 auto;
}

.form-preview h2 {
    margin-bottom: 20px;
}

.form-preview .form-group {
    margin-bottom: 15px;
}

.form-preview label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-preview input,
.form-preview textarea,
.form-preview select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.form-preview .form-help {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-preview .radio-group,
.form-preview .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-preview .radio-label,
.form-preview .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.form-preview .radio-label input,
.form-preview .checkbox-label input {
    width: auto;
}

/* Form Status */
.form-status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge.status-draft {
    background: #6c757d;
    color: white;
}

.status-badge.status-published {
    background: #28a745;
    color: white;
}

.status-badge.status-archived {
    background: #dc3545;
    color: white;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .fields-list,
    .actions-list {
        background: var(--card-bg);
    }

    .field-item,
    .action-item {
        background: var(--bg-color);
        border-color: var(--border-color);
    }

    .form-preview-container {
        background: var(--card-bg);
    }
}

/* ============================================================
   PASSWORD VAULT, DOCUMENTATION, ASSETS, KNOWLEDGE BASE
   ============================================================ */

/* Vault/Docs/Assets sidebar + content layout */
.vault-layout {
    display: flex;
    gap: 1rem;
    min-height: 400px;
}

.vault-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding-right: 1rem;
}

.vault-sidebar hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.75rem 0;
}

.vault-folder-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vault-folder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.15s;
}

.vault-folder-item:hover {
    background: var(--hover-color, rgba(0,0,0,0.05));
}

.vault-folder-item.active {
    background: var(--primary-color, #3b82f6);
    color: #fff;
}

.vault-folder-item.active .badge {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.vault-folder-item .btn-icon {
    opacity: 0;
    transition: opacity 0.15s;
}

.vault-folder-item:hover .btn-icon {
    opacity: 1;
}

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

/* Masked/encrypted field display */
.masked-field {
    font-family: monospace;
    color: var(--text-muted, #6b7280);
    letter-spacing: 2px;
}

/* Copy/action inline */
.detail-value-copyable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-value-copyable code {
    font-family: monospace;
    background: var(--code-bg, #f3f4f6);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    word-break: break-all;
}

/* Revealed password details */
.revealed-password-details .detail-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.revealed-notes {
    white-space: pre-wrap;
    font-size: 0.9rem;
    margin: 0;
    padding: 0.5rem;
    background: var(--code-bg, #f3f4f6);
    border-radius: 4px;
}

/* Password input with action buttons */
.input-with-action {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.input-with-action input {
    flex: 1;
}

/* TOTP display */
.totp-display {
    text-align: center;
    padding: 1.5rem;
}

.totp-code {
    font-size: 2.5rem;
    font-family: monospace;
    font-weight: bold;
    letter-spacing: 6px;
    margin-bottom: 1rem;
    color: var(--primary-color, #3b82f6);
}

.totp-countdown {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.totp-countdown-ring {
    position: relative;
    width: 60px;
    height: 60px;
}

.totp-ring-svg {
    transform: rotate(-90deg);
}

.totp-ring-bg {
    fill: none;
    stroke: var(--border-color, #e5e7eb);
    stroke-width: 3;
}

.totp-ring-fg {
    fill: none;
    stroke: var(--primary-color, #3b82f6);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 1s linear;
}

.totp-seconds {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    font-weight: 600;
}

/* TOTP QR drop zone */
.totp-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.totp-input-group input[type="text"] {
    width: 100%;
}

.totp-qr-drop {
    border: 2px dashed var(--border-color, #d1d5db);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary, #f9fafb);
}

.totp-qr-drop:hover {
    border-color: var(--primary-color, #3b82f6);
    background: var(--bg-hover, #f0f4ff);
}

.totp-qr-drop.drag-over {
    border-color: var(--primary-color, #3b82f6);
    background: var(--bg-hover, #eff6ff);
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.totp-qr-drop-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary, #6b7280);
    font-size: 0.85rem;
}

.totp-qr-drop-content svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.totp-qr-browse {
    color: var(--primary-color, #3b82f6);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.totp-qr-browse:hover {
    text-decoration: none;
}

.totp-qr-status {
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
}

.totp-qr-status-loading {
    color: var(--text-secondary, #6b7280);
}

.totp-qr-status-success {
    color: #059669;
    background: #ecfdf5;
}

.totp-qr-status-error {
    color: #dc2626;
    background: #fef2f2;
}

/* Password type badges */
.badge-type-login { background: #3b82f6; color: #fff; }
.badge-type-api_key { background: #8b5cf6; color: #fff; }
.badge-type-ssh { background: #059669; color: #fff; }
.badge-type-certificate { background: #d97706; color: #fff; }
.badge-type-other { background: #6b7280; color: #fff; }

/* Tags */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--tag-bg, #e5e7eb);
    color: var(--tag-color, #374151);
}

/* KB / Document status badges (scoped to avoid overriding contracts/campaigns) */
#knowledge-base-page .badge-draft { background: #f59e0b; color: #fff; }
#knowledge-base-page .badge-published { background: #10b981; color: #fff; }
#knowledge-base-page .badge-archived { background: #6b7280; color: #fff; }

/* Visibility badges */
.badge-visibility-internal { background: #6366f1; color: #fff; }
.badge-visibility-portal { background: #06b6d4; color: #fff; }
.badge-visibility-specific_clients { background: #f59e0b; color: #fff; }

/* KB stats */
.kb-stats {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
}

/* Document viewer */
.document-viewer .document-meta {
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
}

.document-content-rendered {
    line-height: 1.7;
}

.document-content-rendered p {
    margin-bottom: 1em;
}

.document-content-rendered h1,
.document-content-rendered h2,
.document-content-rendered h3,
.document-content-rendered h4,
.document-content-rendered h5,
.document-content-rendered h6 {
    margin-top: 1.25em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.document-content-rendered h1 { font-size: 1.6em; }
.document-content-rendered h2 { font-size: 1.35em; }
.document-content-rendered h3 { font-size: 1.15em; }

.document-content-rendered ul,
.document-content-rendered ol {
    margin-bottom: 1em;
    padding-left: 1.75em;
}

.document-content-rendered li {
    margin-bottom: 0.35em;
}

.document-content-rendered blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--border-color);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 0 4px 4px 0;
}

.document-content-rendered pre {
    margin: 1em 0;
    padding: 0.75em 1em;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9em;
}

.document-content-rendered code {
    padding: 0.15em 0.35em;
    background: var(--bg-secondary);
    border-radius: 3px;
    font-size: 0.9em;
}

.document-content-rendered pre code {
    padding: 0;
    background: none;
}

.document-content-rendered table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.document-content-rendered th,
.document-content-rendered td {
    border: 1px solid var(--border-color);
    padding: 0.5em 0.75em;
    text-align: left;
}

.document-content-rendered th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.document-content-rendered hr {
    margin: 1.5em 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.document-content-rendered img {
    max-width: 100%;
    border-radius: 4px;
}

.document-content-rendered *:first-child {
    margin-top: 0;
}

.document-content-rendered *:last-child {
    margin-bottom: 0;
}

.doc-editor-textarea {
    min-height: 300px;
    font-family: inherit;
}

/* Asset detail view */
.asset-detail .detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.asset-detail .detail-label {
    width: 200px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    flex-shrink: 0;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
    .tag-badge {
        background: var(--tag-bg-dark, #374151);
        color: var(--tag-color-dark, #d1d5db);
    }

    .detail-value-copyable code {
        background: var(--code-bg-dark, #1f2937);
    }

    .revealed-notes {
        background: var(--code-bg-dark, #1f2937);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .vault-layout {
        flex-direction: column;
    }

    .vault-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 0.75rem;
    }

    .vault-folder-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ============ LINK SELECTORS (typeahead + chips) ============ */
.link-selector-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.link-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.link-chip-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.1rem;
}

.link-chip-remove:hover {
    color: var(--danger-color);
}

.link-selector-wrapper {
    position: relative;
}

.link-selector-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

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

.link-selector-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 180px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 1100;
    box-shadow: var(--shadow-lg);
}

.link-dropdown-item {
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.link-dropdown-item:hover {
    background: var(--primary-color);
    color: #fff;
}

.link-dropdown-more {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============ RELATED ITEM BADGES ============ */
.related-items-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-items-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.related-item-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    margin: 0.15rem 0.25rem 0.15rem 0;
    background: var(--bg-secondary, #f3f4f6);
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.related-item-badge:hover {
    background: var(--primary-light, #dbeafe);
    border-color: var(--primary-color, #3b82f6);
}

/* ============ Client Detail Design Improvements ============ */

/* Client Summary Header Card */
.client-summary-card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.client-summary-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.client-summary-info {
    flex: 1;
    min-width: 0;
}

.client-summary-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.client-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.625rem;
}

.client-summary-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.client-summary-meta-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

.client-summary-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-summary-created {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.client-summary-actions {
    flex-shrink: 0;
    align-self: flex-start;
}

/* Hours Progress Bar */
.hours-progress-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.hours-progress-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.hours-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Info Tab Two-Column Layout */
.client-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.client-info-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.client-info-card.full-width {
    grid-column: 1 / -1;
}

.client-info-card-heading {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.client-info-card .detail-row {
    padding: 0.5rem 0;
}

.client-info-card .detail-row:nth-child(even) {
    background: transparent;
}

/* Detail Row Polish */
.client-info-card .detail-label,
.client-info-section .detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    min-width: 120px;
}

.client-info-card .detail-row .detail-value,
.client-info-section .detail-row .detail-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* Notes card special styling */
.client-info-card.notes-card .notes-content {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.client-info-card.notes-card .notes-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Improved Empty States */
.empty-state-styled {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.empty-state-styled svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 1rem;
}

.empty-state-styled .empty-state-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.empty-state-styled .empty-state-subtext {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

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

/* Data Table Refinements in Client Detail */
.client-tab-content .data-table {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.client-tab-content .data-table th {
    background: var(--bg-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.75rem;
}

.client-tab-content .data-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.client-tab-content .data-table tbody tr {
    transition: background-color 0.15s ease;
}

.client-tab-content .data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.client-tab-content .data-table tbody tr.clickable:hover,
.client-tab-content .data-table tbody tr[onclick]:hover {
    background: var(--bg-secondary);
    cursor: pointer;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.client-tab-content .data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive: stack info grid on narrow */
@media (max-width: 768px) {
    .client-info-grid {
        grid-template-columns: 1fr;
    }

    .client-summary-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .client-summary-meta {
        justify-content: center;
    }

    .client-summary-badges {
        justify-content: center;
    }
}

/* ========================================
   Phase 1 — Micro-Animations
   ======================================== */

/* Modal entrance animations */
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay:not(.hidden) {
    animation: modalOverlayIn 0.2s ease-out;
}

.modal-overlay:not(.hidden) .modal {
    animation: modalIn 0.2s ease-out;
}

/* Page transition fade */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-page:not(.hidden) {
    animation: fadeInUp 0.25s ease-out;
}

/* Client/Ticket detail overlay entrance */
#client-detail-overlay:not(.hidden),
#ticket-detail-overlay:not(.hidden) {
    animation: modalOverlayIn 0.2s ease-out;
}

#client-detail-overlay:not(.hidden) > *:first-child,
#ticket-detail-overlay:not(.hidden) > *:first-child {
    animation: slideInRight 0.25s ease-out;
}

/* ===== FILE TRANSFER TAB ===== */
.filetransfer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.filetransfer-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.ft-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.ft-status.ft-connected {
    color: var(--success-color);
    font-weight: 600;
}

.filetransfer-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    min-height: 30px;
}

.ft-bc-item {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
}

.ft-bc-item:hover {
    text-decoration: underline;
}

.ft-bc-sep {
    color: var(--text-muted);
}

.filetransfer-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filetransfer-list {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 400px;
}

.ft-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ft-table th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

.ft-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.ft-dir-row {
    cursor: pointer;
}

.ft-dir-row:hover,
.ft-file-row:hover {
    background: var(--background);
}

.ft-name {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ft-size {
    white-space: nowrap;
    color: var(--text-secondary);
    width: 80px;
}

.ft-check-col {
    width: 28px;
    text-align: center;
}

.ft-check-col input[type="checkbox"] {
    cursor: pointer;
}

.ft-select-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ft-select-bar .btn {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
}

.ft-actions {
    white-space: nowrap;
    width: 140px;
}

.ft-actions .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    margin-left: 0.2rem;
}

.ft-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.ft-progress {
    padding: 0.5rem 0;
}

.ft-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.ft-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.ft-progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.2s;
    border-radius: 2px;
}

/* ===== TERMINAL TAB ===== */
.terminal-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.terminal-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.term-shell-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.term-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.term-status.term-connected {
    color: var(--success-color);
    font-weight: 600;
}

.term-xterm-container {
    flex: 1;
    min-height: 350px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.term-xterm-container .xterm {
    padding: 8px;
    height: 100%;
}

.term-xterm-container .xterm-helper-textarea {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: auto !important;
}

/* When terminal tab is active, expand to fill space */
#tab-terminal.active {
    display: flex !important;
    flex-direction: column;
}

#tab-terminal .terminal-container {
    flex: 1;
    min-height: 400px;
}
