/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: #1d1d1f; background: #fff; -webkit-font-smoothing: antialiased; }

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: #f5f5f7; }
.login-card { background: #fff; border-radius: 18px; padding: 48px 40px; width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); text-align: center; }
.login-logo { margin-bottom: 16px; }
.login-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 28px; color: #1d1d1f; }
.form-group { margin-bottom: 14px; }
.form-group input, .select-input { width: 100%; padding: 12px 16px; border: 1px solid #d2d2d7; border-radius: 10px; font-size: 15px; background: #f5f5f7; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .select-input:focus { border-color: #007AFF; background: #fff; }
.form-error { color: #ff3b30; font-size: 13px; margin-bottom: 12px; }
.btn-primary { width: 100%; padding: 12px; border: none; border-radius: 10px; background: #007AFF; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: #0066d6; }
.btn-primary:disabled { background: #a0a0a5; cursor: not-allowed; }
.btn-small { padding: 6px 14px; border: none; border-radius: 8px; background: #007AFF; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }

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

/* ── Nav Rail ── */
.nav-rail { width: 68px; min-width: 68px; background: #f5f5f7; border-right: 1px solid #e5e5ea; display: flex; flex-direction: column; align-items: center; padding: 12px 0; }
.nav-rail-top { margin-bottom: 8px; }
.nav-rail-tabs { flex: 1; display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 6px; }
.nav-rail-bottom { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 6px; }
.nav-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border: none; background: transparent; color: #86868b; cursor: pointer; border-radius: 10px; transition: all 0.15s; font-size: 10px; width: 100%; }
.nav-tab svg { stroke-width: 1.8; }
.nav-tab:hover { background: #e8e8ed; color: #1d1d1f; }
.nav-tab.active { background: #007AFF; color: #fff; }
.nav-tab.active svg { stroke: #fff; }

/* ── Main Views ── */
.main-view { flex: 1; display: flex; overflow: hidden; }

/* ── Contact List Pane ── */
.contact-list-pane { width: 300px; min-width: 300px; background: #fafafa; border-right: 1px solid #e5e5ea; display: flex; flex-direction: column; }
.contact-list-header { padding: 16px; border-bottom: 1px solid #e5e5ea; }
.contact-list-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.search-input { width: 100%; padding: 8px 12px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 13px; background: #fff; outline: none; }
.search-input:focus { border-color: #007AFF; }
.contact-list { flex: 1; overflow-y: auto; }
.contact-item { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.1s; gap: 10px; }
.contact-item:hover { background: #eef1f5; }
.contact-item.active { background: #007AFF; color: #fff; }
.contact-item.active .contact-time, .contact-item.active .contact-subtitle { color: rgba(255,255,255,0.8); }
.contact-unread { width: 8px; height: 8px; border-radius: 50%; background: #007AFF; flex-shrink: 0; }
.contact-unread.hidden { visibility: hidden; }
.contact-item.active .contact-unread { background: #fff; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-subtitle { font-size: 11px; color: #86868b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list-pager { display: flex; justify-content: center; gap: 8px; padding: 8px; border-top: 1px solid #e5e5ea; }
.list-pager button { padding: 4px 12px; border: 1px solid #d2d2d7; border-radius: 6px; background: #fff; font-size: 12px; cursor: pointer; }
.list-pager button.active { background: #007AFF; color: #fff; border-color: #007AFF; }
.list-pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Message Pane ── */
.message-pane { flex: 1; display: flex; flex-direction: column; background: #fff; min-width: 0; }
.message-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #e5e5ea; background: #fafafa; min-height: 56px; }
.message-header h3 { font-size: 16px; font-weight: 600; }
.message-list { flex: 1; overflow-y: auto; padding: 16px 20px; background: #fff; }
.empty-state { display: flex; align-items: center; justify-content: center; height: 100%; color: #86868b; font-size: 15px; }

/* iMessage bubbles */
.msg-bubble-row { display: flex; margin-bottom: 4px; }
.msg-bubble-row.outbound { justify-content: flex-end; }
.msg-bubble-row.inbound { justify-content: flex-start; }
.msg-bubble-row > div { max-width: 70%; }
.msg-bubble { padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.msg-bubble.sms.outbound { background: #007AFF; color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.sms.inbound { background: #e9e9eb; color: #1d1d1f; border-bottom-left-radius: 4px; }
.msg-bubble.email.outbound { background: #34c759; color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.email.inbound { background: #f0f0f0; color: #1d1d1f; border-bottom-left-radius: 4px; }
.msg-channel-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; opacity: 0.7; }
.msg-time { font-size: 10px; color: #86868b; margin-top: 2px; text-align: right; }
.msg-bubble-row.inbound .msg-time { text-align: left; }
.msg-date-divider { text-align: center; color: #86868b; font-size: 12px; margin: 16px 0 8px; }

/* Compose */
.message-compose { padding: 12px 16px; border-top: 1px solid #e5e5ea; background: #fafafa; }
.compose-toggle { display: flex; gap: 0; margin-bottom: 8px; border-radius: 8px; overflow: hidden; border: 1px solid #d2d2d7; width: fit-content; }
.compose-channel { padding: 6px 16px; border: none; background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; color: #86868b; transition: all 0.15s; }
.compose-channel.active { background: #007AFF; color: #fff; }
.email-subject-row { margin-bottom: 8px; }
.subject-input { width: 100%; padding: 8px 12px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 13px; outline: none; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea { flex: 1; padding: 10px 14px; border: 1px solid #d2d2d7; border-radius: 18px; font-size: 14px; resize: none; outline: none; max-height: 120px; font-family: inherit; line-height: 1.4; }
.compose-row textarea:focus { border-color: #007AFF; }
.btn-send { width: 38px; height: 38px; border-radius: 50%; border: none; background: #007AFF; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.btn-send:hover { background: #0066d6; }

/* ── Detail Pane ── */
.detail-pane { width: 340px; min-width: 340px; background: #fafafa; border-left: 1px solid #e5e5ea; overflow-y: auto; padding: 20px; }
.detail-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: #86868b; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: #86868b; margin-bottom: 8px; font-weight: 600; }
.detail-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.detail-field { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.detail-field .label { color: #86868b; }
.detail-field .value { font-weight: 500; text-align: right; max-width: 60%; word-break: break-all; }
.detail-field .value a { color: #007AFF; text-decoration: none; }
.note-item { padding: 10px; background: #fff; border-radius: 10px; margin-bottom: 8px; border: 1px solid #e5e5ea; }
.note-item .note-body { font-size: 13px; line-height: 1.4; white-space: pre-wrap; }
.note-item .note-date { font-size: 11px; color: #86868b; margin-top: 4px; }
.opp-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.opp-badge.open { background: #e8f5e9; color: #2e7d32; }
.opp-badge.won { background: #e3f2fd; color: #1565c0; }
.opp-badge.lost { background: #fce4ec; color: #c62828; }
.opp-badge.abandoned { background: #f5f5f5; color: #757575; }
.outcome-history-item { padding: 10px; background: #fff; border-radius: 10px; margin-bottom: 8px; border: 1px solid #e5e5ea; }
.outcome-status-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.outcome-status-badge.APPROVED { background: #d4edda; color: #155724; }
.outcome-status-badge.REJECTED { background: #f8d7da; color: #721c24; }
.outcome-status-badge.OPT-OUT { background: #fff3cd; color: #856404; }
.outcome-status-badge.HOLD { background: #cce5ff; color: #004085; }
.outcome-status-badge.INCOMPLETE { background: #e2e3e5; color: #383d41; }
.outcome-status-badge.NO-SHOW { background: #f5c6cb; color: #721c24; }
.rating-stars-display { color: #ff9500; font-size: 13px; letter-spacing: 1px; }

/* ── Next Steps Dropdown ── */
.next-steps-wrapper { position: relative; }
.btn-next-steps { padding: 8px 16px; border: 1px solid #007AFF; border-radius: 8px; background: #fff; color: #007AFF; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-next-steps:hover { background: #007AFF; color: #fff; }
.next-steps-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); overflow: hidden; z-index: 100; min-width: 180px; }
.next-steps-dropdown.open { display: block; }
.next-steps-dropdown button { display: block; width: 100%; padding: 10px 16px; border: none; background: transparent; text-align: left; font-size: 14px; cursor: pointer; transition: background 0.1s; }
.next-steps-dropdown button:hover { background: #f5f5f7; }

/* ── Outcome Modal ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #fff; border-radius: 16px; max-width: 520px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,0.16); }
.modal-content.modal-outcome { max-width: 560px; }
.modal-content.modal-small { max-width: 400px; padding: 24px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 12px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; border: none; background: #e8e8ed; color: #86868b; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #d2d2d7; }

/* Outcome steps */
.outcome-step { padding: 0 24px 24px; }
.outcome-step .modal-header { padding: 20px 0 12px; }
.outcome-choice { display: flex; gap: 12px; margin-top: 12px; }
.btn-choice { flex: 1; padding: 16px; border: 2px solid #e5e5ea; border-radius: 12px; background: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-showed:hover { border-color: #34c759; background: #f0faf3; }
.btn-noshow:hover { border-color: #ff3b30; background: #fff5f5; }

/* Rating form */
.rating-form { margin-top: 8px; }
.rating-category { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.rating-category:last-of-type { border-bottom: none; }
.rating-cat-header h4 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.rating-desc { font-size: 12px; color: #86868b; margin-bottom: 8px; }
.star-picker { display: flex; gap: 4px; }
.star-picker .star { width: 32px; height: 32px; cursor: pointer; font-size: 24px; color: #d2d2d7; transition: color 0.1s; user-select: none; }
.star-picker .star.filled { color: #ff9500; }
.star-picker .star:hover { color: #ffb340; }
.rating-comment { margin-top: 8px; }
.rating-comment textarea { width: 100%; padding: 10px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 13px; resize: vertical; min-height: 60px; font-family: inherit; outline: none; }
.rating-comment textarea:focus { border-color: #007AFF; }
.char-count { font-size: 11px; color: #86868b; float: right; margin-top: 4px; }

/* Confirm form */
.confirm-form { padding: 0 0 4px; }
.confirm-status { padding: 12px; background: #f5f5f7; border-radius: 10px; margin-bottom: 16px; font-size: 14px; text-align: center; }
.confirm-form textarea { width: 100%; padding: 10px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 13px; resize: vertical; font-family: inherit; outline: none; margin-bottom: 16px; }

/* ── Calendar ── */
.calendar-container { flex: 1; padding: 24px; overflow-y: auto; }
.calendar-header { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 20px; }
.calendar-header h2 { font-size: 22px; font-weight: 700; min-width: 200px; text-align: center; }
.cal-nav-btn { padding: 8px 16px; border: 1px solid #d2d2d7; border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer; transition: all 0.15s; }
.cal-nav-btn:hover { background: #f5f5f7; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e5e5ea; border-radius: 12px; overflow: hidden; }
.cal-dow { padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: #86868b; background: #fafafa; text-transform: uppercase; }
.cal-day { background: #fff; min-height: 90px; padding: 8px; cursor: pointer; transition: background 0.1s; position: relative; }
.cal-day:hover { background: #f5f5f7; }
.cal-day.empty { background: #fafafa; cursor: default; }
.cal-day.empty:hover { background: #fafafa; }
.cal-day .day-num { font-size: 13px; font-weight: 600; color: #1d1d1f; }
.cal-day.today .day-num { color: #007AFF; }
.cal-day .day-count { position: absolute; top: 8px; right: 8px; background: #007AFF; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 10px; }
.cal-day .day-events { margin-top: 4px; display: grid; grid-template-columns: repeat(8, 6px); gap: 1px; overflow-y: auto; max-height: 48px; }
.cal-event-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #007AFF; margin: 1px; }
.cal-event-dot.canceled { background: #ff3b30; }

/* Calendar modal */
.cal-event-item { padding: 10px; border-bottom: 1px solid #f0f0f0; }
.cal-event-item:last-child { border-bottom: none; }
.cal-event-name { font-weight: 600; font-size: 14px; }
.cal-event-time { font-size: 12px; color: #86868b; margin-top: 2px; }
.cal-event-type { font-size: 11px; color: #007AFF; }
.cal-event-status { font-size: 11px; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top: 4px; }
.cal-event-status.canceled { background: #fce4ec; color: #c62828; }
.cal-event-status.noshow { background: #fff3cd; color: #856404; }

/* ── Admin ── */
.admin-container { flex: 1; padding: 24px; overflow-y: auto; max-width: 900px; margin: 0 auto; }
.admin-tabs { display: flex; gap: 0; margin-bottom: 24px; border-radius: 10px; overflow: hidden; border: 1px solid #d2d2d7; width: fit-content; }
.admin-tab { padding: 10px 20px; border: none; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: #86868b; transition: all 0.15s; }
.admin-tab.active { background: #007AFF; color: #fff; }
.admin-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-panel-header h3 { font-size: 18px; font-weight: 700; }

/* User cards */
.user-card { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #fff; border: 1px solid #e5e5ea; border-radius: 12px; margin-bottom: 8px; }
.user-card-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #007AFF; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-card-name { font-weight: 600; font-size: 14px; }
.user-card-meta { font-size: 12px; color: #86868b; }
.user-card-actions { display: flex; gap: 8px; }
.user-card-actions button { padding: 6px 12px; border: 1px solid #d2d2d7; border-radius: 6px; background: #fff; font-size: 12px; cursor: pointer; }
.user-card-actions button:hover { background: #f5f5f7; }
.user-card-actions .btn-view-as { border-color: #007AFF; color: #007AFF; }

/* Logs */
.log-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.log-time { color: #86868b; white-space: nowrap; flex-shrink: 0; }
.log-user { font-weight: 600; flex-shrink: 0; }
.log-action { flex: 1; }
.log-action-type { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #e8e8ed; margin-right: 4px; }

/* Assign form */
.assign-form { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.assign-form .search-input { width: 250px; }
.assign-form .select-input { width: 200px; }
.assign-result-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #fff; border: 1px solid #e5e5ea; border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.assign-result-item:hover { background: #f5f5f7; }

/* View-as banner */
.view-as-banner { position: fixed; top: 0; left: 68px; right: 0; background: #ff9500; color: #fff; padding: 8px 20px; display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 13px; font-weight: 600; z-index: 500; }
.view-as-banner .btn-small { background: rgba(255,255,255,0.25); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7c7cc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a5; }

/* ── Spinner ── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #e5e5ea; border-top-color: #007AFF; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ── Message View Tabs ── */
.msg-view-tabs { display: flex; gap: 0; border-radius: 8px; overflow: hidden; border: 1px solid #d2d2d7; }
.msg-view-tab { padding: 5px 14px; border: none; background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; color: #86868b; transition: all 0.15s; }
.msg-view-tab.active { background: #007AFF; color: #fff; }

/* ── Email Thread View ── */
.email-thread-list { padding: 12px; }
.email-thread-item { background: #fff; border: 1px solid #e5e5ea; border-radius: 12px; margin-bottom: 8px; overflow: hidden; cursor: pointer; transition: box-shadow 0.15s; }
.email-thread-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.email-thread-item.expanded { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.email-thread-header { display: flex; align-items: center; padding: 12px 14px; gap: 10px; }
.email-thread-indicator { width: 4px; height: 32px; border-radius: 2px; background: #007AFF; flex-shrink: 0; }
.email-thread-indicator.inbound { background: #34c759; }
.email-thread-info { flex: 1; min-width: 0; }
.email-thread-subject { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-thread-preview { font-size: 12px; color: #86868b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.email-thread-meta { text-align: right; flex-shrink: 0; }
.email-thread-date { font-size: 11px; color: #86868b; }
.email-thread-count { font-size: 10px; background: #e8e8ed; color: #636366; padding: 1px 6px; border-radius: 8px; margin-top: 2px; display: inline-block; }
.email-thread-body { border-top: 1px solid #f0f0f0; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.email-thread-item.expanded .email-thread-body { max-height: 2000px; }
.email-msg { padding: 14px; border-bottom: 1px solid #f5f5f7; }
.email-msg:last-child { border-bottom: none; }
.email-msg-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.email-msg-dir { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.email-msg-dir.outbound { background: #007AFF; color: #fff; }
.email-msg-dir.inbound { background: #e8f5e9; color: #2e7d32; }
.email-msg-time { font-size: 11px; color: #86868b; }
.email-msg-content { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: #333; }
.email-reply-bar { padding: 12px 14px; border-top: 1px solid #e5e5ea; background: #fafafa; }
.email-reply-bar textarea { width: 100%; padding: 10px; border: 1px solid #d2d2d7; border-radius: 8px; font-size: 13px; resize: vertical; min-height: 60px; font-family: inherit; outline: none; }
.email-reply-bar textarea:focus { border-color: #007AFF; }
.email-reply-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.email-reply-actions button { padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-reply { border: none; background: #007AFF; color: #fff; }
.btn-reply:hover { background: #0066d6; }
.btn-reply:disabled { background: #a0a0a5; }

/* Admin panel header */
.admin-panel-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.admin-panel-header h3 { margin:0; font-size:16px; font-weight:600; }

/* Modal small variant */
.modal-small { max-width:380px; padding:24px; }

/* App Switcher */
.app-switcher-wrap { position: relative; }
.app-switcher-dropdown {
    display: none; position: absolute; top: 44px; left: 0;
    background: #fff; border: 1px solid #e5e5ea; border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12); min-width: 180px; z-index: 9999;
    padding: 6px 0; overflow: hidden;
}
.app-switcher-dropdown.open { display: block; }
.app-switcher-title {
    font-size: 11px; font-weight: 600; color: #86868b; text-transform: uppercase;
    letter-spacing: .5px; padding: 8px 14px 4px;
}
.app-switcher-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px;
    font-size: 14px; color: #1d1d1f; text-decoration: none; transition: background .15s;
}
.app-switcher-item:hover { background: #f5f5f7; }
.app-switcher-item.active { font-weight: 600; color: #007AFF; }
.app-switcher-icon { font-size: 16px; width: 22px; text-align: center; }

/* Contact Filters */
.contact-filters { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.filter-chip {
    padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 500;
    border: 1px solid #d2d2d7; background: #fff; color: #86868b; cursor: pointer;
    transition: all .15s; white-space: nowrap;
}
.filter-chip:hover { border-color: #007AFF; color: #007AFF; }
.filter-chip.active { background: #007AFF; color: #fff; border-color: #007AFF; }

.contact-done-tag {
    display: inline-block; margin-left: 6px; font-size: 10px; color: #34c759;
    background: rgba(52,199,89,.1); border-radius: 4px; padding: 1px 4px; font-weight: 600;
}

/* Template Picker Button */
.compose-template-btn {
    padding: 4px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
    border: 1px solid #d2d2d7; background: #fff; color: #007AFF; cursor: pointer;
    transition: all .15s; margin-left: auto;
}
.compose-template-btn:hover { background: #007AFF; color: #fff; }

/* Template Picker Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal-card { background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.18); width: 90%; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #e5e5ea; }
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #86868b; padding: 0 4px; }
.modal-close:hover { color: #1d1d1f; }

/* Template list items */
.tpl-pick-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid #f0f0f2; cursor: pointer; transition: background .1s;
}
.tpl-pick-item:hover { background: #f5f5f7; margin: 0 -16px; padding: 10px 16px; }
.tpl-pick-item:last-child { border-bottom: none; }
.tpl-pick-badge {
    display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 6px;
    border-radius: 4px; color: #fff; flex-shrink: 0; margin-top: 2px;
}
.tpl-pick-badge.sms { background: #34c759; }
.tpl-pick-badge.email { background: #5856d6; }
.tpl-pick-name { font-size: 14px; font-weight: 500; color: #1d1d1f; }
.tpl-pick-preview { font-size: 12px; color: #86868b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

/* Email reply button in all-messages view */
.msg-reply-btn {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
    font-size: 11px; color: #007AFF; background: none; border: 1px solid #007AFF;
    border-radius: 6px; padding: 3px 10px; cursor: pointer; transition: all .15s;
}
.msg-reply-btn:hover { background: #007AFF; color: #fff; }

/* Confirmation blobs */
.confirm-blob {
    display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px;
    border-radius: 10px; color: #fff; line-height: 1.3;
}
.confirm-blob.confirmed { background: #34c759; }
.confirm-blob.canceled { background: #ff3b30; }
.confirm-blob.rescheduled { background: #ff9500; }
.confirm-blob.no-response { background: #8e8e93; }
.confirm-blob.awaiting { background: #007AFF; }
.confirm-blob.pending { background: #d2d2d7; color: #636366; }
.contact-blob-row { margin-bottom: 2px; }

/* Time moved to bottom */
.contact-time-bottom { font-size: 10px; color: #aeaeb2; margin-top: 3px; }
.contact-item.active .contact-time-bottom { color: rgba(255,255,255,0.7); }
.contact-item.active .confirm-blob { opacity: 0.9; }
.confirm-blob.skipped { background: #c7c7cc; color: #48484a; }
.confirm-blob.error { background: #ff453a; }
.confirm-blob.no-booking { background: #e5e5ea; color: #8e8e93; }


/* DND & Blacklist badges */
.dnd-badge { display:inline-block; font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; background:#ff3b30; color:#fff; margin-left:6px; vertical-align:middle; }
.blacklist-badge { display:inline-block; font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; background:#1c1c1e; color:#fff; margin-left:6px; vertical-align:middle; }

/* Tag chips */
.tag-chip { display:inline-flex; align-items:center; gap:2px; font-size:11px; background:#e5e5ea; color:#1c1c1e; padding:2px 8px; border-radius:12px; margin:2px 4px 2px 0; white-space:nowrap; }
.tag-remove { border:none; background:none; color:#86868b; cursor:pointer; font-size:10px; padding:0 0 0 2px; line-height:1; }
.tag-remove:hover { color:#ff3b30; }
.detail-tags-row .value { display:flex; flex-wrap:wrap; align-items:center; }
.tag-add-wrap { display:inline-flex; align-items:center; gap:2px; margin:2px 0; }
.tag-add-input { width:90px; padding:3px 6px; border:1px solid #d2d2d7; border-radius:8px; font-size:11px; outline:none; }
.tag-add-input:focus { border-color:#007AFF; }
.tag-add-btn { border:none; background:#007AFF; color:#fff; width:20px; height:20px; border-radius:50%; font-size:14px; line-height:20px; text-align:center; cursor:pointer; padding:0; }
.tag-add-btn:hover { background:#005ecb; }

/* Blacklist button */
.blacklist-btn { border:none; background:#ff3b30; color:#fff; font-size:11px; font-weight:600; padding:4px 10px; border-radius:6px; cursor:pointer; }
.blacklist-btn:hover { background:#d63029; }

/* Tag dropdown select */
.tag-add-select { padding:3px 6px; border:1px solid #d2d2d7; border-radius:8px; font-size:11px; outline:none; background:#fff; color:#1c1c1e; cursor:pointer; max-width:140px; }
.tag-add-select:focus { border-color:#007AFF; }
