*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --ink: #161516;
  --orange: #FF8F51;
  --orange-light: #fff3ec;
  --orange-dark: #e07030;
  --bg: #ffffff;
  --surface: #f8f8f8;
  --border: #e8e8e8;
  --muted: #888;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --sidebar-w: 220px;
  --topbar-h: 50px;
  --radius: 10px;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }

/* PIN */
#pin-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--surface); }
.pin-card { background: white; border-radius: 16px; padding: 48px 40px; box-shadow: 0 4px 40px rgba(0,0,0,.08); text-align: center; width: 400px; max-width: 95vw; }
.pin-logo { width: 56px; height: 56px; background: var(--orange); color: white; font-size: 28px; font-weight: 800; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.pin-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.pin-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.pin-inputs { margin-bottom: 16px; }
.pin-field { width: 100%; border: 2px solid var(--border); border-radius: 10px; padding: 14px 16px; font-size: 22px; text-align: center; letter-spacing: 4px; outline: none; transition: border-color .15s; font-family: monospace; }
.pin-field:focus { border-color: var(--orange); }
.pin-error { color: var(--red); font-size: 13px; margin-bottom: 12px; min-height: 18px; }

/* Buttons */
.btn-primary { background: var(--orange); color: white; border: none; border-radius: 8px; padding: 12px 24px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%; transition: background .15s; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost { background: none; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink); transition: border-color .15s, background .15s; }
.btn-ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn-ghost.btn-danger { border-color: #fca5a5; color: var(--red); }
.btn-ghost.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Layout */
#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
#sidebar { width: var(--sidebar-w); background: var(--ink); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 32px; height: 32px; background: var(--orange); color: white; font-size: 16px; font-weight: 800; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.sidebar-queue { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.queue-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.4); display: block; margin-bottom: 2px; }
.queue-count { font-size: 18px; font-weight: 700; color: var(--orange); }
.nav-list { list-style: none; padding: 8px 0; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-size: 14px; font-weight: 500; cursor: pointer; color: rgba(255,255,255,.6); transition: color .15s, background .15s; position: relative; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(255,143,81,.15); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange); border-radius: 0 2px 2px 0; }
.badge { background: var(--red); color: white; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 6px; margin-left: auto; }
.nav-logout { margin: auto 16px 16px; background: none; border: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.5); border-radius: 8px; padding: 9px; font-size: 13px; cursor: pointer; transition: all .15s; }
.nav-logout:hover { border-color: rgba(255,255,255,.4); color: white; }

/* Main content */
#content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Top bar */
#topbar { height: var(--topbar-h); padding: 0 20px; border-bottom: 1.5px solid var(--border); display: flex; align-items: center; gap: 16px; flex-shrink: 0; background: white; position: relative; }
.search-wrap { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; max-width: 440px; }
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-input { flex: 1; border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 12px 7px 8px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none; transition: border-color .15s; background: var(--surface); }
.search-input:focus { border-color: var(--orange); background: white; }
.search-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: white; border: 1.5px solid var(--border); border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.12); z-index: 200; overflow: hidden; }
.search-result { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface); }
.sr-biz { font-size: 14px; font-weight: 600; }
.sr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.daily-counter { font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }

/* Scrollable screens area */
#content > .screen, #screens { overflow-y: auto; overflow-x: auto; flex: 1; }
.screen { padding: 24px; max-width: 900px; }
#list-screen { max-width: none; }
#dialer-screen { max-width: none; }
.screen-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.screen-header h2 { font-size: 22px; font-weight: 700; }

/* DIALER */
.dialer-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.serving-badge { font-size: 14px; font-weight: 600; color: var(--muted); }
.dialer-actions-top { display: flex; gap: 8px; align-items: center; }
.lead-card { background: white; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.lead-card-empty { text-align: center; padding: 40px; color: var(--muted); }
.lead-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.lead-business { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.lead-meta span strong { color: var(--ink); font-weight: 600; }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.lead-field label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 4px; }
.lead-field .val { font-size: 17px; font-weight: 600; color: var(--ink); }
.lead-phone .val { font-size: 28px; font-weight: 800; letter-spacing: .5px; cursor: pointer; color: var(--orange); transition: opacity .15s; }
.lead-phone .val:hover { opacity: .75; }
.copy-flash { display: inline-block; background: var(--green); color: white; font-size: 12px; font-weight: 600; border-radius: 4px; padding: 1px 6px; margin-left: 8px; animation: fadeout .8s forwards; }
@keyframes fadeout { 0%{opacity:1} 80%{opacity:1} 100%{opacity:0} }
.dial-btn { display: inline-block; background: var(--orange); color: white; text-decoration: none; font-size: 16px; font-weight: 700; padding: 10px 28px; border-radius: 8px; margin-top: 12px; transition: background .15s; }
.dial-btn:hover { background: var(--orange-dark); }
.dial-link { color: var(--orange); text-decoration: none; font-size: 17px; vertical-align: middle; margin-left: 4px; }
.dial-link:hover { opacity: .75; }
.cal-link-sm { color: var(--muted); text-decoration: none; font-size: 16px; vertical-align: middle; }
.cal-link-sm:hover { opacity: .75; }
.lead-link a { color: var(--blue); text-decoration: none; font-size: 15px; font-weight: 500; }
.lead-link a:hover { text-decoration: underline; }

/* Time chip */
.time-chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.time-chip.green { background: #dcfce7; color: #15803d; }
.time-chip.red { background: #fee2e2; color: #b91c1c; }

/* Status chips */
.status-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-NEW { background: #eff6ff; color: #1d4ed8; }
.status-Voicemail { background: #f0fdf4; color: #166534; }
.status-Callback { background: #fef3c7; color: #92400e; }
.status-Gatekeeper { background: #f3f4f6; color: #374151; }
.status-Conversation { background: #dcfce7; color: #15803d; }
.status-Not-Interested { background: #f3f4f6; color: #6b7280; }
.status-DNC { background: #fee2e2; color: #b91c1c; }
.status-Dead-Number { background: #f3f4f6; color: #9ca3af; }
.status-Client { background: #dcfce7; color: #15803d; }
.status-Disqualified { background: #fef3c7; color: #92400e; }

/* Comments section */
.comments-section { margin-bottom: 20px; }
.comments-section > label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 10px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; max-height: 320px; overflow-y: auto; }
.comment-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.comment-time { font-size: 12px; color: var(--muted); }
.comment-delete { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; line-height: 1; transition: color .1s; }
.comment-delete:hover { color: var(--red); }
.comment-text { font-size: 14px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; }
.comment-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.comment-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--border); cursor: pointer; transition: opacity .15s; }
.comment-thumb:hover { opacity: .85; }
.no-comments { color: var(--muted); font-size: 13px; font-style: italic; }
.comment-input-area { display: flex; flex-direction: column; gap: 8px; }
.comment-textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 70px; color: var(--ink); outline: none; transition: border-color .15s; }
.comment-textarea:focus { border-color: var(--orange); }
.pending-images { display: flex; flex-wrap: wrap; gap: 8px; }
.pending-thumb { position: relative; display: inline-block; }
.pending-thumb img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--border); display: block; }
.pending-remove { position: absolute; top: -6px; right: -6px; background: var(--red); color: white; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 20px; text-align: center; padding: 0; }

/* Activities */
.activities-section label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 10px; }
.activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.activity-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex-shrink: 0; margin-top: 5px; }
.activity-dot.blue { background: var(--blue); }
.activity-time { color: var(--muted); white-space: nowrap; font-size: 12px; }
.activity-content { flex: 1; }
.activity-disp { font-weight: 600; }
.activity-note { color: var(--muted); }
.no-activities { color: var(--muted); font-size: 13px; font-style: italic; }

/* Disposition bar */
.disposition-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.disp-btn { min-width: 0; border: 1.5px solid var(--border); background: white; border-radius: 8px; padding: 10px 6px 9px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink); transition: all .12s; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.disp-btn:hover { border-color: var(--orange); background: var(--orange-light); color: var(--orange-dark); }
.disp-btn:active { transform: scale(.97); }
.disp-key { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border-radius: 4px; padding: 1px 5px; }
.disp-success { border-color: #86efac; }
.disp-success:hover { border-color: var(--green); background: #f0fdf4; color: #15803d; }
.disp-warning { border-color: #fcd34d; }
.disp-warning:hover { border-color: var(--amber); background: #fffbeb; color: #92400e; }
.disp-muted { border-color: #d1d5db; }
.disp-danger { border-color: #fca5a5; }
.disp-danger:hover { border-color: var(--red); background: #fef2f2; color: #b91c1c; }
.disp-won { border-color: #86efac; }
.disp-won:hover { border-color: var(--green); background: #f0fdf4; color: #15803d; }
.disp-disq { border-color: #fcd34d; }
.disp-disq:hover { border-color: var(--amber); background: #fffbeb; color: #92400e; }

/* Calendar banner */
.cal-banner { display: flex; align-items: center; gap: 10px; margin-top: 14px; background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 8px; padding: 10px 14px; }
.cal-banner-link { color: #15803d; font-size: 14px; font-weight: 600; text-decoration: none; flex: 1; }
.cal-banner-link:hover { text-decoration: underline; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: white; border-radius: 12px; padding: 28px; width: 360px; max-width: 95vw; }
.modal-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; margin-top: 14px; }
.form-input { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none; transition: border-color .15s; }
.form-input:focus { border-color: var(--orange); }
.form-textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none; resize: vertical; transition: border-color .15s; }
.form-textarea:focus { border-color: var(--orange); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Callbacks */
.callbacks-list { display: flex; flex-direction: column; gap: 10px; }
.callback-card { display: flex; align-items: center; gap: 12px; background: white; border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 18px; cursor: pointer; transition: border-color .15s; flex-wrap: wrap; }
.callback-card:hover { border-color: var(--orange); }
.callback-card.overdue { border-color: var(--red); background: #fef2f2; }
.callback-info { flex: 1; min-width: 160px; }
.callback-biz { font-size: 16px; font-weight: 700; }
.callback-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.callback-time-wrap { font-size: 13px; font-weight: 600; }
.callback-time { display: inline; }
.callback-time.overdue { color: var(--red); }
.cb-actions { display: flex; gap: 4px; align-items: center; }
.empty-state { text-align: center; padding: 60px; color: var(--muted); }
.empty-state p { font-size: 16px; }

/* Tier badges */
.tier-badge { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.tier-A { background: #fef3c7; color: #92400e; }
.tier-B { background: #dbeafe; color: #1e40af; }
.tier-C { background: #f3f4f6; color: #374151; }
.tier-D { background: #fce7f3; color: #9d174d; }

/* List */
.list-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-input-sm { border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; color: var(--ink); outline: none; width: 120px; }
.form-input-sm:focus { border-color: var(--orange); }
.form-select { border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; color: var(--ink); outline: none; background: white; cursor: pointer; }
.form-select:focus { border-color: var(--orange); }
.form-select-sm { width: auto; padding: 7px 10px; }
.table-wrap { overflow-x: auto; border: 1.5px solid var(--border); border-radius: 10px; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leads-table thead { background: var(--surface); }
.leads-table th { padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.leads-table th.sortable { cursor: pointer; }
.leads-table th.sortable:hover { color: var(--ink); }
.sort-asc::after { content: ' ↑'; }
.sort-desc::after { content: ' ↓'; }
.leads-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.leads-table tr:last-child td { border-bottom: none; }
.leads-table tbody tr { cursor: pointer; transition: background .1s; }
.leads-table tbody tr:hover { background: var(--surface); }
.table-count { font-size: 13px; color: var(--muted); margin-top: 10px; }
.inline-status { border: 1.5px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; font-family: inherit; background: white; cursor: pointer; }

/* Stats */
.stats-section { margin-bottom: 32px; }
.stats-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: white; border: 1.5px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--ink); }
.stat-value.orange { color: var(--orange); }
.chart-wrap { background: white; border: 1.5px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.chart-wrap canvas { max-height: 260px; }
.tier-table { width: 100%; border-collapse: collapse; font-size: 14px; background: white; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.tier-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
.tier-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tier-table tr:last-child td { border-bottom: none; }

/* Import */
.import-box { max-width: 600px; }
.import-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 48px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.import-drop.drag-over { border-color: var(--orange); background: var(--orange-light); }
.import-drop svg { margin-bottom: 16px; color: var(--muted); }
.import-drop p { font-size: 16px; color: var(--muted); margin-bottom: 8px; }
.import-browse { color: var(--orange); font-weight: 600; cursor: pointer; }
.import-browse:hover { text-decoration: underline; }
.import-cols { font-size: 12px; margin-top: 12px; line-height: 1.6; }
.import-result { background: white; border: 1.5px solid var(--border); border-radius: 10px; padding: 24px; margin-top: 20px; }
.import-result h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.import-result .import-nums { display: flex; gap: 24px; }
.import-result .import-num { font-size: 14px; }
.import-result .import-num strong { font-size: 24px; font-weight: 800; display: block; }
.import-result .import-num.green strong { color: var(--green); }
.import-result .import-num.muted strong { color: var(--muted); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 500; }
.lightbox img { max-width: 95vw; max-height: 92vh; border-radius: 6px; box-shadow: 0 8px 48px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 20px; right: 24px; background: rgba(255,255,255,.15); border: none; color: white; font-size: 22px; cursor: pointer; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-close:hover { background: rgba(255,255,255,.28); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: white; border-radius: 10px; padding: 12px 20px; font-size: 14px; font-weight: 500; z-index: 999; box-shadow: 0 4px 24px rgba(0,0,0,.2); animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

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

/* Manual Dial Pad */
.manual-dial-panel {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px 24px;
  margin-top: 14px;
  max-width: 320px;
}
.manual-dial-header { margin-bottom: 14px; }
.manual-dial-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); display: block; margin-bottom: 10px; }
.manual-dial-display { display: flex; align-items: center; gap: 8px; }
.manual-dial-input {
  flex: 1; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 12px; outline: none; letter-spacing: 0.04em; min-width: 0;
  color: var(--ink); background: var(--bg);
}
.manual-dial-input:focus { border-color: var(--orange); background: white; }
.manual-dial-input::placeholder { font-size: 15px; font-weight: 400; color: var(--muted); }
.manual-bksp {
  background: none; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 18px; cursor: pointer; color: var(--ink);
  transition: all .12s; flex-shrink: 0;
}
.manual-bksp:hover { border-color: var(--orange); color: var(--orange); }
.manual-dial-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.kp-btn {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 8px 10px; cursor: pointer; transition: all .1s;
  display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 2px;
}
.kp-btn:hover { background: var(--orange-light); border-color: var(--orange); }
.kp-btn:active { transform: scale(.95); }
.kp-num { font-size: 20px; font-weight: 700; color: var(--ink); }
.kp-sub { font-size: 8px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; min-height: 10px; }
.kp-call {
  grid-column: 1 / -1; background: var(--orange); border-color: var(--orange);
  color: white; font-size: 15px; font-weight: 700; padding: 14px;
  border-radius: 10px;
}
.kp-call:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.kp-call:active { transform: scale(.98); }
.btn-ghost.active { background: var(--orange-light); border-color: var(--orange); color: var(--orange-dark); }

/* Call Log */
.call-log-list { width: 100%; }
.call-log-header {
  display: grid;
  grid-template-columns: 160px 160px 70px 1fr 280px;
  gap: 12px; padding: 8px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 1.5px solid var(--border);
}
.call-log-row {
  display: grid;
  grid-template-columns: 160px 160px 70px 1fr 280px;
  gap: 12px; padding: 12px 16px; align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.call-log-row:hover { background: var(--bg); }
.call-log-dt  { font-size: 13px; color: var(--muted); white-space: nowrap; }
.call-log-num { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.call-log-dur { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.call-log-lead { font-size: 13px; }
.call-log-lead-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--orange); font-weight: 600; font-size: 13px; text-align: left;
}
.call-log-lead-btn:hover { text-decoration: underline; }
.call-log-audio { height: 32px; max-width: 260px; display: block; }

/* Transcript display */
.transcript-wrap { margin-top: 8px; }
.transcript-box {
  max-height: 110px; overflow-y: auto;
  font-size: 12px; line-height: 1.55; color: var(--ink);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; white-space: pre-wrap;
  font-style: italic; margin-bottom: 6px;
}
.transcript-unavailable { font-size: 11px; color: var(--muted); margin: 4px 0 0; font-style: italic; }
.btn-copy-transcript {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
  color: var(--ink); transition: all .1s;
}
.btn-copy-transcript:hover { border-color: var(--orange); color: var(--orange); }
.call-log-item { border-bottom: 1px solid var(--border); }
.call-log-item .call-log-row { border-bottom: none; }
.call-log-item-transcript { padding: 0 16px 12px; }
.call-log-item-transcript .transcript-box { max-height: 90px; }

/* Recording in activity history */
.activity-row-recording { align-items: flex-start; }
.activity-dot.recording { background: var(--orange); }
.recording-player { margin-top: 6px; }
.recording-player audio { height: 32px; max-width: 260px; }

/* Call status bar */
.call-status-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; border-radius: 10px; margin-bottom: 12px;
  font-size: 14px; font-weight: 600; border: 2px solid transparent;
  transition: background 0.2s;
}
.call-status-bar.connecting { background: #fef9c3; border-color: #fde047; color: #713f12; }
.call-status-bar.active     { background: #dcfce7; border-color: #4ade80; color: #14532d; }
.call-status-bar.ended      { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.call-status-icon { font-size: 18px; }
.call-status-text { flex: 1; }
.call-timer { font-variant-numeric: tabular-nums; letter-spacing: 0.05em; font-size: 15px; min-width: 48px; }
.btn-hangup {
  background: #ef4444; color: white; border: none; border-radius: 8px;
  padding: 6px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.btn-hangup:hover { background: #dc2626; }

/* Dial button in callbacks list */
.dial-link-btn {
  background: none; border: none; cursor: pointer; font-size: 18px;
  padding: 2px 4px; border-radius: 6px; line-height: 1;
  transition: background 0.15s;
}
.dial-link-btn:hover { background: #f1f5f9; }

/* Inline contact editing */
.contact-editable { cursor: pointer; border-bottom: 1px dashed var(--border); padding-bottom: 1px; }
.contact-editable:hover { border-bottom-color: var(--orange); }
.contact-placeholder { color: var(--muted); font-size: 13px; font-style: italic; }
.list-contact-cell { cursor: pointer; }
.list-contact-empty { color: var(--muted); font-size: 12px; font-style: italic; }
.list-contact-val { font-size: 13px; }

/* Backup */
.backup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.backup-card { background: white; border: 1.5px solid var(--border); border-radius: 12px; padding: 24px; }
.backup-card-danger { border-color: #fca5a5; background: #fff8f8; }
.backup-card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.backup-card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.backup-card-desc code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--ink); }
.backup-stats-list { display: flex; flex-direction: column; gap: 10px; }
.backup-stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.backup-stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.backup-stat-row span { color: var(--muted); }
.backup-stat-row strong { font-weight: 700; }
.backup-download-btn { display: block; text-align: center; text-decoration: none; padding: 12px 20px; background: var(--orange); color: white; border-radius: 8px; font-size: 15px; font-weight: 600; transition: background .15s; }
.backup-download-btn:hover { background: var(--orange-dark); }
.backup-warning { background: #fef3c7; border: 1.5px solid #fcd34d; border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #78350f; }
.backup-restore-btn { display: inline-block; padding: 11px 20px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; margin-top: 0; }
.backup-restore-btn:hover { border-color: var(--orange); background: var(--orange-light); }
.restore-progress { margin-top: 12px; font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.5; }

/* Two-column dialer layout */
.dialer-body {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}
.dialer-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.dialer-right {
  min-width: 0;
}
#lead-right .comments-list { max-height: 380px; }
#lead-right .activity-list { max-height: 500px; }
#lead-right .comments-section { margin-bottom: 24px; }
#lead-right .activities-section { padding-top: 4px; }

/* Lead card — compact in left column */
.lead-card { background: white; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 0; }

/* Editable field styles */
.field-editable {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 1px;
  transition: border-bottom-color .15s;
  display: inline-block;
}
.field-editable:hover { border-bottom-color: var(--orange); }
.field-placeholder { color: var(--muted); font-size: 13px; font-style: italic; }
.field-edit-input {
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  border: 1.5px solid var(--orange);
  border-radius: 6px;
  padding: 3px 8px;
  outline: none;
  max-width: 220px;
  color: var(--ink);
  background: white;
}

/* Secondary contact fields */
.secondary-field { margin-top: 5px; }

/* Manual dial modal */
.manual-dial-box {
  width: 340px;
  max-width: 95vw;
  padding: 20px 24px 24px;
}
.manual-dial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.manual-dial-title { font-size: 16px; font-weight: 700; }
.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color .1s, background .1s;
}
.modal-close-btn:hover { color: var(--ink); background: var(--surface); }

/* Responsive */
@media (max-width: 640px) {
  :root { --sidebar-w: 60px; }
  .brand-name, .queue-label, .queue-count { display: none; }
  .nav-item { justify-content: center; padding: 14px; }
  .nav-item svg { margin: 0; }
  .nav-item span:not(svg):not(.badge) { display: none; }
  .lead-business { font-size: 22px; }
  .lead-phone .val { font-size: 22px; }
  .lead-grid { grid-template-columns: 1fr; }
  .disp-btn { min-width: 80px; font-size: 12px; }
  .screen { padding: 16px; }
  #topbar { padding: 0 12px; }
  .daily-counter { display: none; }
  .dialer-body { grid-template-columns: 1fr; }
}
