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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0; padding: 0; background: #f0f2f5; color: #1a1a2e;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; -webkit-font-smoothing: antialiased;
}
.caller-container {
    display: flex; flex-direction: column; width: 100%; max-width: 480px;
    min-height: 100vh; background: #fff; box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

header { background: #1a1a2e; color: #fff; flex-shrink: 0; position: sticky; top: 0; z-index: 10; }
.header-top { padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
header h1 { margin: 0; font-size: 0.95rem; font-weight: 700; flex: 1; }
.header-icon-btn { appearance: none; background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 4px 8px; font-size: 0.85rem; cursor: pointer; line-height: 1; }

/* Clock */
#clock-area { position: relative; }
#clock-btn { appearance: none; background: none; border: none; cursor: pointer; text-align: center; color: #93C5FD; padding: 2px 4px; line-height: 1.2; }
#clock-time { display: block; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#clock-tz { display: block; font-size: 0.55rem; color: #9CA3AF; }
.tz-dropdown { position: absolute; top: 100%; right: 0; margin-top: 4px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); width: 200px; max-height: 220px; overflow-y: auto; z-index: 20; }
.tz-dropdown input { width: 100%; padding: 8px 10px; border: none; border-bottom: 1px solid #e2e8f0; font-size: 0.78rem; outline: none; }
.tz-item { padding: 8px 12px; font-size: 0.76rem; cursor: pointer; color: #1a1a2e; }
.tz-item:hover { background: #F3F4F6; }

/* Search bar */
.search-bar { display: flex; padding: 6px 12px 8px; gap: 6px; background: #1a1a2e; border-top: 1px solid rgba(255,255,255,0.1); }
.search-bar input { flex: 1; padding: 6px 10px; font-size: 0.82rem; border: none; border-radius: 8px; outline: none; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff; max-height: 360px;
    overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 20;
}
.sr-card { padding: 8px 14px; border-bottom: 1px solid #f0f2f5; display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; color: #1a1a2e; }
.sr-card:hover { background: #F9FAFB; }
.sr-company { font-size: 0.82rem; font-weight: 700; flex: 1; min-width: 0; }
.sr-phone { font-size: 0.76rem; color: #6B7280; }
.sr-status { font-size: 0.6rem !important; }
.sr-source { font-size: 0.68rem; color: #9CA3AF; width: 100%; }
.sr-empty { padding: 16px; text-align: center; color: #9CA3AF; font-size: 0.82rem; }
.sr-more { padding: 8px 14px; text-align: center; color: #6B7280; font-size: 0.72rem; font-style: italic; }

main { flex: 1; overflow-y: auto; padding: 10px 14px 80px; }

/* List Switcher */
.list-switcher { display: flex; align-items: center; gap: 8px; padding: 8px 0 12px; position: relative; }
.list-name { font-size: 0.85rem; font-weight: 700; color: #374151; flex: 1; }
.switch-list-btn { appearance: none; background: #F3F4F6; color: #374151; border: 1px solid #D1D5DB; border-radius: 6px; padding: 4px 10px; font-size: 0.7rem; font-weight: 600; cursor: pointer; }
.list-dropdown { position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); width: 240px; max-height: 240px; overflow-y: auto; z-index: 15; }
.list-dropdown-item { padding: 8px 12px; font-size: 0.78rem; cursor: pointer; color: #1a1a2e; }
.list-dropdown-item:hover { background: #F3F4F6; }
.list-dropdown-item:first-child { font-weight: 700; border-bottom: 1px solid #e2e8f0; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 0 4px; }
.page-btn { appearance: none; background: #F3F4F6; color: #374151; border: 1px solid #D1D5DB; border-radius: 6px; padding: 6px 14px; font-size: 0.72rem; font-weight: 600; cursor: pointer; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-btn:not(:disabled):active { background: #E5E7EB; }
.page-info { font-size: 0.72rem; color: #6B7280; font-weight: 600; }

/* Tags filter */
.tags-filter-select { width: 100%; padding: 8px 12px; font-size: 0.82rem; font-weight: 600; border: 2px solid #2563EB; border-radius: 10px; background: #fff; color: #1E40AF; outline: none; cursor: pointer; }

/* View */
.view-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 10px; gap: 8px; }
.view-header span { font-size: 0.76rem; font-weight: 700; color: #718096; text-transform: uppercase; letter-spacing: 0.5px; }
#prospect-search { flex: 1; max-width: 160px; padding: 5px 8px; font-size: 0.78rem; border: 1.5px solid #e2e8f0; border-radius: 8px; outline: none; }
#prospect-search:focus { border-color: #2563EB; }

/* Cards */
.prospect-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; margin-bottom: 6px; cursor: pointer; transition: border-color 0.12s; -webkit-tap-highlight-color: transparent; }
.prospect-card:active { border-color: #2563EB; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-avatar { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.card-head { flex: 1; min-width: 0; }
.card-company { font-size: 0.9rem; font-weight: 700; color: #1a1a2e; }
.card-person { font-size: 0.72rem; color: #718096; }
.badge { display: inline-block; font-size: 0.6rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-green { background: #DCFCE7; color: #166534; }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-gray { background: #F3F4F6; color: #4B5563; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.card-phone-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-phone { font-size: 0.9rem; font-weight: 600; color: #1E40AF; }
.card-call-btn { appearance: none; background: #2563EB; color: #fff; border: none; border-radius: 8px; padding: 7px 16px; font-size: 0.78rem; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.card-call-btn:active { background: #1D4ED8; }
.card-meta { display: flex; gap: 10px; font-size: 0.68rem; color: #9CA3AF; margin-bottom: 2px; }
.card-note-snippet { font-size: 0.72rem; color: #6B7280; padding: 3px 6px; background: #F9FAFB; border-radius: 4px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-cb-date { font-size: 0.68rem; color: #D97706; font-weight: 600; margin-top: 2px; }
.card-move { margin-top: 6px; }
.move-select { width: 100%; padding: 5px 8px; font-size: 0.72rem; border: 1px solid #e2e8f0; border-radius: 6px; outline: none; background: #fff; }

/* Tags */
.tag-section { margin-bottom: 14px; }
.tag-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #F9FAFB; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 4px; }
.tag-name { font-size: 0.8rem; font-weight: 700; color: #374151; }
.tag-count { font-size: 0.72rem; font-weight: 700; color: #6B7280; background: #E5E7EB; padding: 1px 8px; border-radius: 10px; }

/* Files */
.file-upload-area { margin-bottom: 12px; }
#file-upload-btn { width: 100%; appearance: none; background: #F3F4F6; color: #374151; border: 2px dashed #D1D5DB; border-radius: 10px; padding: 16px; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
#file-upload-btn:active { background: #E5E7EB; }
.file-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; margin-bottom: 6px; }
.file-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.file-card-name { flex: 1; }
.file-rename-input { width: 100%; padding: 4px 6px; font-size: 0.78rem; font-weight: 700; border: 1px solid transparent; border-radius: 4px; outline: none; background: transparent; }
.file-rename-input:focus { border-color: #2563EB; background: #fff; }
.file-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.file-action { appearance: none; border: none; border-radius: 6px; padding: 4px 10px; font-size: 0.68rem; font-weight: 700; cursor: pointer; }
.file-dl { background: #DBEAFE; color: #1E40AF; }
.file-dl:active { background: #BFDBFE; }
.file-del { background: #FEE2E2; color: #991B1B; }
.file-del:active { background: #FECACA; }
.file-card-meta { font-size: 0.68rem; color: #9CA3AF; margin-top: 4px; }

.empty-state { text-align: center; padding: 40px 20px; color: #9CA3AF; }
.empty-state p { margin: 4px 0; font-size: 0.85rem; }

.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; border-top: 1px solid #e2e8f0; display: flex; padding: 3px 0 env(safe-area-inset-bottom, 0); z-index: 10; }
.nav-tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 4px 0; background: none; border: none; color: #9CA3AF; cursor: pointer; min-width: 0; }
.nav-tab.active { color: #2563EB; }
.nav-icon { font-size: 1.1rem; line-height: 1; }
.nav-label { font-size: 0.55rem; font-weight: 600; margin-top: 1px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-sheet { background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 480px; padding: 20px 16px 30px; max-height: 85vh; overflow-y: auto; }
.modal-title { font-size: 1rem; font-weight: 700; color: #1a1a2e; margin-bottom: 14px; text-align: center; }
.outcome-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.oc-btn { flex: 1 1 calc(33.333% - 4px); min-width: 0; min-height: 48px; appearance: none; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 8px 4px; font-size: 0.74rem; font-weight: 700; cursor: pointer; background: #fff; color: #374151; -webkit-tap-highlight-color: transparent; }
.oc-btn:active { transform: scale(0.97); }
.oc-green:active { background: #DCFCE7; border-color: #16A34A; color: #166534; }
.oc-blue:active { background: #DBEAFE; border-color: #2563EB; color: #1E40AF; }
.oc-amber:active { background: #FEF3C7; border-color: #D97706; color: #92400E; }
.oc-gray:active { background: #F3F4F6; border-color: #9CA3AF; color: #4B5563; }
.oc-red:active { background: #FEE2E2; border-color: #DC2626; color: #991B1B; }
.oc-dnc:active { background: #FEE2E2; border-color: #991B1B; color: #7F1D1D; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.chip { appearance: none; background: #F3F4F6; color: #4B5563; border: none; border-radius: 20px; padding: 5px 10px; font-size: 0.7rem; font-weight: 600; cursor: pointer; }
.chip:active { background: #E5E7EB; }
#modal-note { width: 100%; padding: 8px 10px; font-size: 0.82rem; font-family: inherit; border: 1.5px solid #e2e8f0; border-radius: 10px; resize: none; margin-bottom: 12px; outline: none; box-sizing: border-box; }
#modal-note:focus { border-color: #2563EB; }
#save-next { display: block; width: 100%; appearance: none; background: #2563EB; color: #fff; border: none; border-radius: 12px; padding: 12px 24px; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
#save-next:active { background: #1D4ED8; }
.error-message { color: #DC2626; font-size: 0.74rem; padding: 4px 0; }

.update-banner {
    position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 20px); max-width: 460px; background: #1E40AF; color: #fff;
    border-radius: 12px; padding: 12px 16px; display: flex; align-items: center;
    justify-content: space-between; box-shadow: 0 4px 20px rgba(0,0,0,0.2); z-index: 50; gap: 10px;
}
.update-banner span { font-size: 0.82rem; font-weight: 600; }
#update-now-btn {
    appearance: none; background: #fff; color: #1E40AF; border: none;
    border-radius: 8px; padding: 6px 14px; font-size: 0.76rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
}
#update-now-btn:active { background: #DBEAFE; }

@media (min-width: 768px) {
    body { padding: 20px 0; }
    .caller-container { border-radius: 16px; min-height: auto; }
    .modal-overlay { align-items: center; }
    .modal-sheet { border-radius: 20px; max-height: 90vh; }
}
