/**
 * @fileoverview DVA Referral Dashboard v2.45 Styles
 * 
 * @description
 * All CSS styles for the DVA Referral Management Dashboard.
 * Separated from index.html for better maintainability.
 * 
 * @version 2.45
 * @lastModified 2026-01-22
 */

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; background: #f5f5f5; color: #202124; }

/* ===== HEADER ===== */
.header { background: linear-gradient(135deg, #1565c0 0%, #0d47a1 50%, #002171 100%); color: white; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; }
.header-left h1 { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.header-left .subtitle { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-right .user-info { display: flex; flex-direction: column; align-items: flex-end; }
.header-right .user-name { font-size: 14px; font-weight: 500; }
.header-right .user-role { font-size: 11px; opacity: 0.8; }
.header-right .user-role.owner { color: #ffd54f; font-weight: 600; }
.header-right .version { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 12px; font-size: 11px; }
.header-btn { padding: 8px 16px; background: rgba(255,255,255,0.2); color: white; border: none; border-radius: 8px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.header-btn:hover { background: rgba(255,255,255,0.3); }

/* ===== LOADING & ERROR ===== */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.9); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; }
.loading-overlay.hidden { display: none; }
.spinner { width: 48px; height: 48px; border: 4px solid #e0e0e0; border-top-color: #1565c0; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 16px; color: #5f6368; font-size: 14px; }
.error-banner { background: #ffebee; color: #c62828; padding: 12px 24px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.error-banner.hidden { display: none; }
.error-banner button { padding: 6px 12px; background: #c62828; color: white; border: none; border-radius: 4px; cursor: pointer; }

/* ===== STATS BAR ===== */
.stats-bar { display: flex; gap: 16px; padding: 20px 24px; background: white; border-bottom: 1px solid #e8eaed; flex-wrap: wrap; }
.stat-card { background: white; border-radius: 12px; padding: 16px 20px; min-width: 140px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 4px solid; flex: 1; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.stat-card.urgent { border-left-color: #ea4335; }
.stat-card.warning { border-left-color: #fbbc04; }
.stat-card.fyi { border-left-color: #34a853; }
.stat-card.active { border-left-color: #1a73e8; }
.stat-card .stat-header { font-size: 11px; color: #5f6368; font-weight: 500; margin-bottom: 4px; }
.stat-card .stat-number { font-size: 32px; font-weight: 600; }
.stat-card .stat-number.loading { color: #9e9e9e; }
.stat-card.urgent .stat-number { color: #ea4335; }
.stat-card.warning .stat-number { color: #f9ab00; }
.stat-card.fyi .stat-number { color: #34a853; }
.stat-card.active .stat-number { color: #1a73e8; }
.stat-card .stat-label { font-size: 12px; color: #80868b; margin-top: 2px; }

/* ===== MAIN TABS ===== */
.main-tabs { display: flex; background: white; border-bottom: 2px solid #e0e0e0; padding: 0 24px; }
.main-tab { padding: 16px 24px; font-size: 15px; font-weight: 500; cursor: pointer; border: none; background: transparent; color: #5f6368; border-bottom: 3px solid transparent; margin-bottom: -2px; display: flex; align-items: center; gap: 8px; }
.main-tab:hover { color: #1565c0; }
.main-tab.active { color: #1565c0; border-bottom-color: #1565c0; }
.main-tab .count { background: #e8eaed; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.main-tab.active .count { background: #e3f2fd; color: #1565c0; }
.main-tab.owner-only { color: #7b1fa2; }
.main-tab.owner-only.active { color: #7b1fa2; border-bottom-color: #7b1fa2; }

/* ===== DROPDOWN TAB STYLES ===== */
.tab-dropdown { position: relative; }
.tab-dropdown-btn { padding: 16px 24px; font-size: 15px; font-weight: 500; cursor: pointer; border: none; background: transparent; color: #5f6368; border-bottom: 3px solid transparent; margin-bottom: -2px; display: flex; align-items: center; gap: 8px; }
.tab-dropdown-btn:hover { color: #1565c0; }
.tab-dropdown-btn.active { color: #1565c0; border-bottom-color: #1565c0; }
.tab-dropdown-btn .arrow { font-size: 10px; transition: transform 0.2s; }
.tab-dropdown.open .arrow { transform: rotate(180deg); }
.tab-dropdown-menu { position: absolute; top: 100%; left: 0; background: white; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); min-width: 200px; z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s; }
.tab-dropdown.open .tab-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.tab-dropdown-item { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 14px; color: #202124; border-bottom: 1px solid #f1f3f4; }
.tab-dropdown-item:last-child { border-bottom: none; }
.tab-dropdown-item:hover { background: #f8f9fa; }
.tab-dropdown-item.active { background: #e3f2fd; color: #1565c0; font-weight: 500; }
.tab-dropdown-item .icon { font-size: 16px; }
.tab-dropdown-item .item-count { margin-left: auto; background: #e8eaed; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tab-dropdown-item.active .item-count { background: #bbdefb; color: #1565c0; }
.tab-dropdown-item.owner-only { color: #7b1fa2; }
.tab-dropdown-item.owner-only.active { background: #f3e5f5; }

/* ===== STAFF TABLE STYLES ===== */
.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th { padding: 12px; text-align: left; font-size: 11px; color: #5f6368; text-transform: uppercase; background: #fafafa; border-bottom: 1px solid #e8eaed; }
.staff-table td { padding: 12px; border-bottom: 1px solid #f1f3f4; vertical-align: middle; }
.staff-table tr:hover { background: #f8f9fa; }
.staff-name { font-weight: 500; color: #202124; }
.staff-email { font-size: 12px; color: #5f6368; }
.role-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.role-badge.owner { background: #f3e5f5; color: #7b1fa2; }
.role-badge.manager { background: #e3f2fd; color: #1565c0; }
.role-badge.team_leader { background: #e0f7fa; color: #00838f; }
.role-badge.practitioner { background: #e8f5e9; color: #2e7d32; }
.role-badge.administration { background: #fafafa; color: #5f6368; }
.role-badge.pending { background: #fff3e0; color: #e65100; }
.role-badge.revoked { background: #ffebee; color: #c62828; }
.access-toggle { padding: 6px 12px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.access-toggle.revoke { background: #ffebee; color: #c62828; }
.access-toggle.revoke:hover { background: #ffcdd2; }
.access-toggle.restore { background: #e8f5e9; color: #2e7d32; }
.access-toggle.restore:hover { background: #c8e6c9; }

/* ===== TAB CONTENT ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 12px; padding: 16px 24px; background: white; border-bottom: 1px solid #e8eaed; align-items: flex-end; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: #5f6368; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select, .filter-group input[type="text"] { padding: 8px 12px; border: 1px solid #dadce0; border-radius: 8px; font-size: 14px; background: white; }
.filter-group select { min-width: 100px; cursor: pointer; }
.filter-group input[type="text"] { min-width: 160px; }
.result-count { margin-left: auto; font-size: 13px; color: #5f6368; padding-bottom: 8px; }

/* ===== PAGINATION ===== */
.pagination-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: white; border-top: 1px solid #e8eaed; margin: 0 24px 24px 24px; border-radius: 0 0 12px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.pagination-info { font-size: 13px; color: #5f6368; }
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-btn { padding: 8px 12px; border: 1px solid #dadce0; background: white; border-radius: 6px; font-size: 13px; cursor: pointer; color: #5f6368; min-width: 40px; text-align: center; }
.page-btn:hover:not(:disabled) { background: #f5f5f5; border-color: #1565c0; color: #1565c0; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: #1565c0; color: white; border-color: #1565c0; }
.page-btn.nav { padding: 8px 14px; font-weight: 500; }
.page-ellipsis { color: #9e9e9e; padding: 0 8px; }

/* ===== TABLE STYLES ===== */
.table-container { padding: 16px 24px 0 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px 12px 0 0; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); min-width: 1050px; table-layout: fixed; }
th { text-align: left; padding: 14px 12px; background: #fafafa; font-size: 11px; font-weight: 600; color: #5f6368; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #e8eaed; cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { background: #f0f0f0; }
th.sortable { position: relative; padding-right: 20px; }
th.sortable::after { content: '⇅'; position: absolute; right: 4px; opacity: 0.3; font-size: 10px; }
th.sortable.asc::after { content: '↑'; opacity: 1; color: #1565c0; }
th.sortable.desc::after { content: '↓'; opacity: 1; color: #1565c0; }
td { padding: 12px; border-bottom: 1px solid #f1f3f4; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: none; }
tr.client-row { cursor: pointer; transition: background 0.15s; }
tr.client-row:hover { background: #f8f9fa; }
tr.client-row.expanded { background: #e3f2fd; }
tr.expanded-row { display: none; }
tr.expanded-row.show { display: table-row; }
tr.expanded-row td { background: #fafafa; padding: 0; }
.empty-state { text-align: center; padding: 60px 24px; color: #5f6368; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: #202124; }

/* ===== EXPANDED ROW ===== */
.expanded-content { padding: 20px; border-top: 2px solid #1565c0; }
.expanded-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.expanded-section { background: white; padding: 16px; border-radius: 8px; border: 1px solid #e8eaed; }
.expanded-section h4 { font-size: 12px; font-weight: 600; color: #5f6368; margin-bottom: 12px; text-transform: uppercase; }
.expanded-section .detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f3f4; font-size: 13px; }
.expanded-section .detail-row:last-child { border-bottom: none; }
.expanded-section .detail-label { color: #5f6368; }
.expanded-section .detail-value { font-weight: 500; color: #202124; }
.expanded-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid #e8eaed; }

/* ===== URGENCY & STATUS INDICATORS ===== */
.urgency-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.urgency-dot.urgent { background: #ea4335; }
.urgency-dot.warning { background: #f9ab00; }
.urgency-dot.fyi { background: #34a853; }
.urgency-dot.info { background: #1a73e8; }

/* ===== CLIENT DISPLAY ===== */
.client-name { font-weight: 500; color: #202124; font-size: 14px; }
.client-id { font-size: 11px; color: #9e9e9e; font-family: monospace; }
.referral-received { font-size: 11px; color: #2e7d32; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* ===== BADGES ===== */
.type-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-right: 4px; }
.type-badge.dva { background: #e8f5e9; color: #2e7d32; }
.type-badge.tpi { background: #fff3e0; color: #e65100; }
.type-badge.ar { background: #fce4ec; color: #c2185b; cursor: help; }
.type-badge.inactive { background: #e0e0e0; color: #757575; }

/* ===== PRACTITIONERS ===== */
.practitioners-list { display: flex; flex-direction: column; gap: 2px; }
.practitioner-name { font-size: 12px; color: #5f6368; white-space: nowrap; }
.practitioner-name.primary { font-weight: 600; color: #1565c0; }

/* ===== PROFESSION BADGES ===== */
.profession-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.profession-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.profession-badge.ep { background: #e3f2fd; color: #1565c0; }
.profession-badge.ep.urgent { background: #ffcdd2; color: #c62828; }
.profession-badge.physio { background: #f3e5f5; color: #7b1fa2; }
.profession-badge.physio.urgent { background: #f8bbd0; color: #880e4f; }
.profession-badge.hc { background: #fff8e1; color: #f57f17; }
.profession-badge.hc.urgent { background: #ffe0b2; color: #e65100; }
.profession-badge.dt { background: #e0f7fa; color: #00838f; }
.profession-badge.dt.urgent { background: #80deea; color: #006064; }
.profession-badge.pod { background: #fce4ec; color: #ad1457; }
.profession-badge.pod.urgent { background: #f48fb1; color: #880e4f; }

/* ===== ACTION BUTTONS ===== */
.action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; white-space: nowrap; transition: all 0.15s; }
.action-btn.primary { background: #1a73e8; color: white; }
.action-btn.primary:hover { background: #1557b0; }
.action-btn.urgent { background: #ea4335; color: white; }
.action-btn.urgent:hover { background: #c62828; }
.action-btn.success { background: #34a853; color: white; }
.action-btn.success:hover { background: #2e7d32; }
.action-btn.warning { background: #f9ab00; color: white; }
.action-btn.warning:hover { background: #e09900; }
.action-btn.outline { background: white; color: #5f6368; border: 1px solid #dadce0; }
.action-btn.outline:hover { background: #f5f5f5; }
.action-btn.small { padding: 6px 12px; font-size: 11px; }
.action-btn.sms { background: #00bcd4; color: white; }
.action-btn.sms:hover { background: #00acc1; }
.action-btn.pending { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; cursor: default; }
.action-btn.pending:hover { background: #ffe0b2; }
.action-btn.confirmed { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; cursor: default; font-weight: 600; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }

/* ===== TOOLTIPS ===== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #323232; color: white; padding: 4px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap; z-index: 100; margin-bottom: 4px; }

/* ===== MODALS ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.2s; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: 16px; max-width: 500px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 48px rgba(0,0,0,0.2); transform: translateY(20px); transition: transform 0.2s; }
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #e8eaed; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; font-weight: 600; color: #202124; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #5f6368; padding: 4px; line-height: 1; }
.modal-close:hover { color: #202124; }
.modal-body { padding: 0; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e8eaed; display: flex; justify-content: flex-end; gap: 12px; }

/* ===== REFERRAL MODAL ===== */
.modal-section { padding: 20px 24px; border-bottom: 1px solid #e8eaed; }
.modal-section:last-child { border-bottom: none; }
.modal-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-section-header .icon { font-size: 20px; }
.modal-section-header h4 { font-size: 14px; font-weight: 600; color: #202124; margin: 0; }
.modal-section-header .count { background: #e8eaed; padding: 2px 8px; border-radius: 10px; font-size: 11px; color: #5f6368; }

/* ===== REFERRAL OPTION CARDS ===== */
.referral-option { display: flex; align-items: center; padding: 14px 16px; border: 2px solid #e8eaed; border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: all 0.15s; }
.referral-option:last-child { margin-bottom: 0; }
.referral-option:hover { border-color: #1a73e8; background: #f8fbff; }
.referral-option.selected { border-color: #1a73e8; background: #e3f2fd; }
.referral-option .option-icon { font-size: 24px; margin-right: 14px; flex-shrink: 0; }
.referral-option .option-content { flex: 1; }
.referral-option .option-title { font-size: 14px; font-weight: 600; color: #202124; display: flex; align-items: center; gap: 8px; }
.referral-option .option-desc { font-size: 12px; color: #5f6368; margin-top: 2px; }
.referral-option .option-badge { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.referral-option .option-badge.recommended { background: #e8f5e9; color: #2e7d32; }
.referral-option .option-badge.cost { background: #f1f3f4; color: #5f6368; }
.referral-option .option-badge.warning { background: #fce4ec; color: #c62828; }
.referral-option.disabled { opacity: 0.5; cursor: not-allowed; background: #f5f5f5; border-color: #e0e0e0; }
.referral-option.disabled:hover { border-color: #e0e0e0; background: #f5f5f5; }
.referral-option.apex { border-color: #ffcdd2; background: #fff5f5; }
.referral-option.apex:hover { border-color: #ef9a9a; background: #ffebee; }

/* ===== APEX REASON SELECTION ===== */
.apex-reason-section { display: none; padding: 16px; background: #fff5f5; border-radius: 8px; margin-top: 12px; }
.apex-reason-section.show { display: block; }
.apex-reason-section h5 { font-size: 13px; font-weight: 600; color: #c62828; margin-bottom: 12px; }
.apex-reason-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.apex-reason-item input[type="radio"] { width: 16px; height: 16px; cursor: pointer; }
.apex-reason-item label { font-size: 13px; color: #202124; cursor: pointer; flex: 1; }
.apex-other-input { width: 100%; padding: 10px 12px; border: 1px solid #dadce0; border-radius: 6px; font-size: 13px; margin-top: 8px; display: none; }
.apex-other-input.show { display: block; }
.apex-char-count { font-size: 11px; color: #9e9e9e; text-align: right; margin-top: 4px; }

/* ===== REPORT CARDS ===== */
.report-card { display: flex; align-items: center; padding: 12px 16px; background: #fafafa; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; border: 2px solid transparent; }
.report-card:hover { background: #f0f0f0; border-color: #dadce0; }
.report-card .report-code { font-size: 15px; font-weight: 700; color: #202124; min-width: 60px; }
.report-card .report-prof { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: #e8eaed; color: #5f6368; margin-right: 12px; }
.report-card .report-desc { font-size: 12px; color: #5f6368; flex: 1; }
.report-card .report-value { font-size: 13px; font-weight: 600; color: #2e7d32; }

/* ===== PRACTITIONER MODAL ===== */
.practitioner-checkbox-list { max-height: 300px; overflow-y: auto; }
.practitioner-checkbox-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid #f1f3f4; }
.practitioner-checkbox-item:last-child { border-bottom: none; }
.practitioner-checkbox-item input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.practitioner-checkbox-item label { flex: 1; cursor: pointer; }
.practitioner-checkbox-item .prac-name { font-weight: 500; color: #202124; }
.practitioner-checkbox-item .prac-info { font-size: 12px; color: #5f6368; }

/* ===== SMS MODAL ===== */
.sms-modal-body { padding: 24px; }
.sms-modal-body textarea { width: 100%; min-height: 120px; padding: 12px; border: 1px solid #dadce0; border-radius: 8px; font-size: 14px; resize: vertical; font-family: inherit; }
.sms-modal-body .char-count { text-align: right; font-size: 12px; color: #5f6368; margin-top: 8px; }
.sms-templates { margin-bottom: 16px; }
.sms-template-btn { padding: 8px 12px; border: 1px solid #dadce0; background: white; border-radius: 6px; font-size: 12px; cursor: pointer; margin-right: 8px; margin-bottom: 8px; }
.sms-template-btn:hover { background: #f5f5f5; border-color: #1565c0; }

/* ===== TUTORIAL ===== */
.tutorial-modal { max-width: 700px; }
.tutorial-slide { display: none; padding: 24px; }
.tutorial-slide.active { display: block; }
.tutorial-slide h4 { font-size: 18px; font-weight: 600; color: #202124; margin-bottom: 12px; }
.tutorial-slide p { font-size: 14px; color: #5f6368; line-height: 1.6; margin-bottom: 8px; }
.tutorial-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid #e8eaed; }
.tutorial-dots { display: flex; gap: 8px; }
.tutorial-dot { width: 8px; height: 8px; border-radius: 50%; background: #dadce0; cursor: pointer; }
.tutorial-dot.active { background: #1a73e8; }
.tutorial-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #5f6368; padding: 0 24px 16px; }
.tutorial-checkbox input { width: 16px; height: 16px; }

/* ===== SMS HISTORY & OWNER PORTAL ===== */
.sms-history, .owner-portal { padding: 24px; }
.sms-list { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.sms-item { padding: 16px; border-bottom: 1px solid #f1f3f4; display: flex; gap: 16px; }
.sms-item:last-child { border-bottom: none; }
.sms-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sms-icon.inbound { background: #e8f5e9; }
.sms-icon.outbound { background: #e3f2fd; }
.sms-content { flex: 1; }
.sms-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.sms-client { font-weight: 500; color: #202124; }
.sms-time { font-size: 12px; color: #9e9e9e; }
.sms-body { font-size: 13px; color: #5f6368; }
.sms-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-left: 8px; }
.sms-badge.delivered { background: #e8f5e9; color: #2e7d32; }
.sms-badge.failed { background: #ffebee; color: #c62828; }
.portal-title { font-size: 24px; font-weight: 600; color: #202124; display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.portal-title .icon { color: #7b1fa2; }

/* ===== ACTION LOG ===== */
.action-log-list { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.action-log-item { padding: 16px 20px; border-bottom: 1px solid #f1f3f4; display: flex; gap: 16px; align-items: flex-start; }
.action-log-item:last-child { border-bottom: none; }
.action-log-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.action-log-icon.report { background: #fff3e0; }
.action-log-icon.undo { background: #e3f2fd; }
.action-log-icon.referral { background: #e8f5e9; }
.action-log-content { flex: 1; }
.action-log-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.action-log-title { font-weight: 500; color: #202124; font-size: 14px; }
.action-log-time { font-size: 12px; color: #9e9e9e; white-space: nowrap; }
.action-log-details { font-size: 13px; color: #5f6368; }
.action-log-user { font-size: 12px; color: #9e9e9e; margin-top: 4px; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #323232; color: white; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 10000; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ===== AUTH SCREEN ===== */
.auth-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1565c0 0%, #0d47a1 50%, #002171 100%); }
.auth-container.hidden { display: none; }
.auth-card { background: white; border-radius: 16px; padding: 48px; text-align: center; box-shadow: 0 24px 48px rgba(0,0,0,0.3); max-width: 400px; width: 90%; }
.auth-card h1 { font-size: 24px; color: #202124; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.auth-card .subtitle { color: #5f6368; margin-bottom: 32px; }
.auth-btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px 24px; border: 1px solid #dadce0; border-radius: 8px; background: white; font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.auth-btn-google:hover { background: #f8f9fa; border-color: #1565c0; }
.auth-btn-google img { width: 20px; height: 20px; }
.auth-error { color: #c62828; font-size: 14px; margin-top: 16px; padding: 12px; background: #ffebee; border-radius: 8px; display: none; }
.auth-error.show { display: block; }
.main-content { display: none; }
.main-content.show { display: block; }

/* ===== CHART TIME RANGE BUTTONS ===== */
.time-range-btn { padding: 6px 12px; border: 1px solid #dadce0; background: white; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; color: #5f6368; transition: all 0.15s; }
.time-range-btn:hover { background: #f5f5f5; border-color: #1565c0; color: #1565c0; }
.time-range-btn.active { background: #1565c0; color: white; border-color: #1565c0; }

/* ===== CHART SUMMARY CARDS ===== */
.chart-summary-card { background: #f8f9fa; border-radius: 8px; padding: 12px; text-align: center; }
.chart-summary-card .clinic-name { font-size: 11px; color: #5f6368; margin-bottom: 4px; }
.chart-summary-card .client-count { font-size: 20px; font-weight: 600; }
.chart-summary-card .change-indicator { font-size: 11px; margin-top: 4px; }
.chart-summary-card .change-indicator.positive { color: #2e7d32; }
.chart-summary-card .change-indicator.negative { color: #c62828; }
.chart-summary-card .change-indicator.neutral { color: #5f6368; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .expanded-grid { grid-template-columns: 1fr; }
  .pagination-bar { flex-direction: column; gap: 12px; }
  .filter-bar { gap: 8px; }
}

/* ===== NEW REFERRAL TICK ON BADGES ===== */
.new-ref-tick {
  color: #2e7d32;
  font-weight: 700;
  margin-left: 2px;
  font-size: 11px;
}

/* ===== REFERRAL EXPIRY WARNING (v2.44) ===== */
.expiry-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #e65100;
  margin-top: 4px;
  padding: 2px 6px;
  background: #fff3e0;
  border-radius: 4px;
  border: 1px solid #ffcc80;
}

.expiry-warning.critical {
  color: #c62828;
  background: #ffebee;
  border-color: #ef9a9a;
}

.expiry-badge-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e65100;
  margin-left: 4px;
  animation: pulse-expiry 2s infinite;
}

.expiry-badge-indicator.critical {
  background: #c62828;
}

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

.profession-badge.expiring {
  position: relative;
  border: 1px dashed #e65100;
}

.profession-badge.expiring.critical {
  border-color: #c62828;
  animation: border-flash 2s infinite;
}

@keyframes border-flash {
  0%, 100% { border-color: #c62828; }
  50% { border-color: #ffcdd2; }
}

.expiry-detail-section {
  background: #fff8e1;
  border: 1px solid #ffcc80;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 12px;
}

.expiry-detail-section.critical {
  background: #ffebee;
  border-color: #ef9a9a;
}

.expiry-detail-section h5 {
  font-size: 12px;
  font-weight: 600;
  color: #e65100;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.expiry-detail-section.critical h5 {
  color: #c62828;
}

.expiry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(230, 81, 0, 0.2);
  font-size: 13px;
}

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

.expiry-item .profession {
  font-weight: 500;
  color: #202124;
}

.expiry-item .days {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff3e0;
  color: #e65100;
}

.expiry-item .days.critical {
  background: #ffcdd2;
  color: #c62828;
}

/* =============================================================================
   REFRESH BUTTON (v2.45)
   Per-client refresh button - subtle, unobtrusive design
   ============================================================================= */

.refresh-cell {
  padding: 4px !important;
  text-align: center;
  vertical-align: middle;
}

.refresh-client-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  opacity: 0.6;
  color: #34a853;
}

.refresh-client-btn::before {
  content: '\21bb';
  font-family: 'Apple Symbols', 'Segoe UI Symbol', Arial, sans-serif;
}

.refresh-client-btn:hover {
  background: #e8f5e9;
  opacity: 1;
  color: #2e7d32;
  transform: rotate(90deg);
}

.refresh-client-btn:active {
  transform: rotate(180deg);
}

.client-row:hover .refresh-client-btn {
  opacity: 0.85;
}

/* Halaxy button - small text button v2.73 */
.halaxy-btn-small {
  display: block;
  width: 100%;
  padding: 2px 4px;
  font-size: 9px;
  font-weight: 600;
  border: 1px solid #1565c0;
  background: white;
  color: #1565c0;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
  text-align: center;
  transition: all 0.15s ease;
  opacity: 0.7;
}

.halaxy-btn-small:hover {
  background: #e3f2fd;
  opacity: 1;
}

.client-row:hover .halaxy-btn-small {
  opacity: 0.9;
}

/* =============================================================================
   APEX DESIGN 3: COPY CHIPS (v2.48)
   Compact clickable chips for copying client data
   ============================================================================= */

.apex-copy-chip {
  padding: 6px 10px;
  border: 1px solid #e8eaed;
  border-radius: 16px;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  color: #202124;
}

.apex-copy-chip:hover {
  background: #e8eaed;
  border-color: #dadce0;
}

.apex-copy-chip:active {
  background: #c8e6c9;
  border-color: #81c784;
}

/* =============================================================================
   TUTORIAL MODAL (v2.49)
   Enhanced tutorial with slide dots and owner-only content
   ============================================================================= */

.tutorial-modal {
  max-width: 520px;
}

.tutorial-modal .modal-body {
  padding: 24px;
  min-height: 280px;
}

.tutorial-slide h4 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #202124;
}

.tutorial-slide p {
  font-size: 14px;
  line-height: 1.6;
  color: #3c4043;
  margin-bottom: 12px;
}

.tutorial-slide ul {
  line-height: 1.6;
}

.tutorial-checkbox {
  padding: 12px 24px;
  border-top: 1px solid #e8eaed;
  font-size: 13px;
  color: #5f6368;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tutorial-checkbox input {
  cursor: pointer;
}

.tutorial-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid #e8eaed;
}

#tutorialDots {
  display: flex;
  gap: 8px;
}

.tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dadce0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tutorial-dot:hover {
  background: #9aa0a6;
}

.tutorial-dot.active {
  background: #1a73e8;
  transform: scale(1.2);
}

.tutorial-dot.owner-dot {
  background: #f9ab00;
}

.tutorial-dot.owner-dot.active {
  background: #e65100;
}

/* =============================================================================
   REFRESH BUTTON SPINNING ANIMATION (v2.51)
============================================================================= */
.refresh-client-btn.spinning {
  animation: spin 1s linear infinite;
  opacity: 0.6;
  cursor: wait;
}

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

/* =============================================================================
   SPECIAL STATUS TOGGLES (TPI / AT-RISK) v2.54
   ============================================================================= */

.special-status-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f3f4;
}

.special-status-toggle:last-of-type {
  border-bottom: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #dadce0;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #1a73e8;
}

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

/* TPI toggle - purple theme */
#tpi-toggle-checkbox:checked + .toggle-slider,
input[id^="tpi-toggle-"]:checked + .toggle-slider {
  background-color: #7c3aed;
}

/* At-Risk toggle - orange theme */
#atrisk-toggle-checkbox:checked + .toggle-slider,
input[id^="atrisk-toggle-"]:checked + .toggle-slider {
  background-color: #f9ab00;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
}

.toggle-desc {
  font-size: 11px;
  color: #5f6368;
}

.special-status-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #1a73e8;
}

.special-status-info .status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.special-status-info .status-badge.tpi {
  background: #ede9fe;
  color: #7c3aed;
}

.special-status-info .status-badge.ar {
  background: #fef3c7;
  color: #d97706;
}

.special-status-info .status-meta {
  font-size: 11px;
  color: #5f6368;
}

.special-status-info .status-expiry {
  font-size: 12px;
  font-weight: 500;
  color: #1a73e8;
}

.special-status-note {
  margin-top: 12px;
  font-size: 11px;
  color: #9aa0a6;
  font-style: italic;
}

/* =============================================================================
   TWO COLUMN EXPANDED ROW LAYOUT (v2.59)
   More compact layout with referral preference dropdown
============================================================================= */

.expanded-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 16px 20px;
}

.expanded-col-left,
.expanded-col-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.expanded-col-right {
  border-left: 1px solid #e8eaed;
  padding-left: 20px;
}

/* Contact row - inline items */
.expanded-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #5f6368;
}

.expanded-contact-row .contact-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Actions box */
.expanded-actions-box {
  background: #fffbf0;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #ffeeba;
}

.expanded-actions-box .actions-box-header {
  font-size: 11px;
  font-weight: 700;
  color: #856404;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.expanded-actions-box .no-actions {
  color: #2e7d32;
  font-size: 13px;
  margin: 0;
}

.expanded-actions-box .actions-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-tag-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  border: 2px solid #ffc107;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-tag-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-tag-btn.urgent {
  background: #ffebee;
  border-color: #c62828;
  color: #c62828;
}

.action-tag-btn.urgent:hover {
  background: #ffcdd2;
}

.action-tag-btn.warning {
  background: #fff8e1;
  border-color: #f9ab00;
  color: #e65100;
}

.action-tag-btn.warning:hover {
  background: #ffecb3;
}

.action-tag-btn.pending {
  background: #fff3e0;
  border-color: #ffcc80;
  color: #e65100;
  cursor: default;
}

.action-tag-btn.confirmed {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
  cursor: default;
}

/* Status row - compact toggles */
.expanded-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expanded-status-row .status-label {
  font-size: 11px;
  font-weight: 700;
  color: #5f6368;
  letter-spacing: 0.5px;
  min-width: 70px;
}

.status-toggles {
  display: flex;
  gap: 8px;
}

.status-toggle-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px dashed #d8d8d8;
  background: transparent;
  color: #c0c0c0;
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.7;
}

.status-toggle-btn:hover {
  border-color: #999;
  border-style: solid;
  background: #f5f5f5;
  color: #666;
  opacity: 1;
}

/* Both TPI and At-Risk use green when active */
.status-toggle-btn.active {
  border: 2px solid #2e7d32;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 600;
  opacity: 1;
}

/* Referral preference row */
.expanded-pref-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.expanded-pref-row .pref-label {
  font-size: 11px;
  font-weight: 700;
  color: #5f6368;
  letter-spacing: 0.5px;
  min-width: 70px;
}

.pref-select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #dadce0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-width: 160px;
  transition: all 0.15s ease;
}

/* Preference select color coding */
.pref-select.pref-own_gp {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #2e7d32;
}

.pref-select.pref-internal_gp {
  border-color: #1565c0;
  background: #e3f2fd;
  color: #1565c0;
}

.pref-select.pref-apex {
  border-color: #e65100;
  background: #fff3e0;
  color: #e65100;
}

.pref-select.pref-not_discussed {
  border-color: #9e9e9e;
  background: #f5f5f5;
  color: #616161;
}

.pref-meta {
  font-size: 11px;
  color: #9aa0a6;
  font-style: italic;
}

/* Expanded actions footer - adjust spacing */
.expanded-two-col + .expanded-actions {
  border-top: 1px solid #e8eaed;
  margin-top: 0;
  padding-top: 12px;
}

/* Responsive - stack on smaller screens */
@media (max-width: 900px) {
  .expanded-two-col {
    grid-template-columns: 1fr;
  }
  
  .expanded-col-right {
    border-left: none;
    border-top: 1px solid #e8eaed;
    padding-left: 0;
    padding-top: 12px;
  }
}

/* ========================================
   CHART NAVIGATION SIDEBAR (v2.79)
   ======================================== */

.chart-nav-item:not(.chart-nav-disabled):not(.chart-nav-active):hover {
  background: #f5f5f5 !important;
  border-color: #e0e0e0 !important;
}

.chart-nav-item.chart-nav-active {
  background: #e8eaf6 !important;
  border-color: #c5cae9 !important;
}

.chart-cat-pill:not(.chart-cat-active):hover {
  background: #f5f5f5 !important;
  border-color: #bdbdbd !important;
}

.chart-cat-pill.chart-cat-active {
  background: #e3f2fd !important;
  border-color: #1565c0 !important;
  color: #1565c0 !important;
}

@keyframes chartFadeIn {
  from { opacity: 0.6; transform: translateY(4px); }
  to   { opacity: 1;   transform: translateY(0); }
}

/* Responsive: stack sidebar below on narrow screens */
@media (max-width: 1100px) {
  #ownerPage_overview > div:nth-child(2) {
    flex-direction: column !important;
  }
  #ownerPage_overview > div:nth-child(2) > div:first-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  #ownerPage_overview > div:nth-child(2) .chart-nav-label {
    display: none !important;
  }
  #ownerPage_overview > div:nth-child(2) .chart-nav-item {
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
  }
  #ownerPage_overview > div:nth-child(2) .chart-cat-pill {
    display: none !important;
  }
}
