:root {
    --bg: #ffffff;
    --text: #111;
    --muted: #6b7280;
    --blue: #2563eb;
    --green: #22c55e;
    --line: #e5e7eb;
    --surface: #f9fafb;
    --accent-hover: rgba(37, 99, 235, 0.08);
    --accent-press: rgba(37, 99, 235, 0.12);
    --accent-border: rgba(37, 99, 235, 0.15);
    --accent-soft: rgba(37, 99, 235, 0.1);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Roboto, system-ui, sans-serif;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

body, select, textarea, input, button {
    font-size: 14px;
}

h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

.android-dialer {
    width: 340px;
    height: 740px;
    background: var(--bg);
    border-radius: 34px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.screen-stack {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
    padding-bottom: 100px;
    transition: opacity 0.25s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.inline-panel {
    padding: 20px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    max-width: 100%;
}

.inline-panel__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inline-panel__header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.panel-back {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.panel-back:hover {
    background: var(--accent-hover);
    color: var(--blue);
}

.panel-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.transfer-dialer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.panel-keypad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    justify-content: center;
    gap: 10px;
}

.panel-keypad button {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.panel-keypad button small {
    font-size: 9px;
    color: var(--muted);
}

.panel-keypad button:active {
    background: var(--accent-hover);
    border-color: var(--blue);
}

.transfer-keypad-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.transfer-keypad-actions .modal-btn {
    padding: 8px 14px;
    min-width: 0;
}

.transfer-number {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: 500;
    height: 28px;
    letter-spacing: 0.5px;
    padding: 6px 0 4px;
    color: var(--text);
    max-width: 220px;
    margin: 0 auto;
}

.transfer-number:focus {
    outline: none;
}

/* Header */
.dial-header {
    text-align: center;
    padding: 20px 0 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.dial-header span {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Keypad */

.keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    padding: 10px 36px 22px;
    justify-items: center;
}

.keys button {
    width: 64px;
    height: 64px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 26px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.keys button:active {
    background: rgba(0, 0, 0, 0.08);
}

.keys small {
    font-size: 9px;
    color: var(--muted);
    margin-top: 2px;
}

.controls {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0 0;
    padding: 0 36px;
    height: 90px;
}

.call-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--green);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.clear-btn {
    position: absolute;
    right: 36px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.clear-btn:active {
    color: var(--text);
    background: rgba(0, 0, 0, 0.08);
}

.return-call {
    position: absolute;
    left: 36px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.return-call:hover {
    background: var(--accent-hover);
    color: var(--blue);
}

.status-bar {
    position: sticky;
    z-index: 30;
    margin-bottom: 8px;
}

.status-bar-inner {
    max-width: 280px;
    width: 100%;
    margin: 0 auto;
}

.status-bar.hidden {
    display: none;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
}

.status-dot.status-available { background: var(--green); }
.status-dot.status-break { background: #fbbf24; }
.status-dot.status-busy { background: #ef4444; }
.status-dot.status-aftercall { background: #6366f1; }
.status-dot.status-logged-out { background: #6b7280; }

.status-toggle {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
}


.status-label {
    font-weight: 600;
    font-size: 13px;
}

.status-duration {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 11px;
}

.status-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 6px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 20;
    width: 100%;
}

.status-menu button {
    border: none;
    background: #fff;
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.status-menu button:hover {
    background: var(--accent-hover);
    color: var(--blue);
}

.status-menu button.active {
    background: var(--accent-press);
    color: var(--blue);
    font-weight: 600;
}

/* ===== Campaign Bar ===== */
.campaign-bar {
  position: sticky;
  z-index: 40;
  margin-bottom: 8px;
}

.campaign-bar-inner {
  max-width: 280px;
  width: 100%;
  margin: 0 auto;
}

.campaign-toggle {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.campaign-toggle:hover {
  background: var(--accent-hover);
  color: var(--blue);
}

.campaign-label {
  font-weight: 600;
  font-size: 13px;
}

.campaign-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  width: 100%;
}

.campaign-menu button {
  border: none;
  background: #fff;
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.campaign-menu button:hover {
  background: var(--accent-hover);
  color: var(--blue);
}

.campaign-menu button.active {
  background: var(--accent-press);
  color: var(--blue);
  font-weight: 600;
}

/* Recents */
.recents-list {
    padding: 10px 16px;
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
}

.log-entry {
    background: var(--surface);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--line);
}

.log-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-call {
    color: var(--blue);
    font-size: 18px;
}

/* .icon-missed currently has no references; keeping the style commented for future missed-call state. */
/* .icon-missed {
    color: #dc2626;
    font-size: 18px;
} */

.log-text {
    display: flex;
    flex-direction: column;
}

.log-notes {
    font-size: 11px;
    color: var(--muted);
}

.log-name {
    font-size: 15px;
    color: var(--text);
}

.log-time {
    font-size: 12px;
    color: var(--muted);
}

.log-right {
    color: var(--muted);
    font-size: 13px;
}

/* Bottom nav */
.bottom-nav {
    position: sticky;
    bottom: 0;
    z-index: 40;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 10px 0;
}

.tab {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.tab span {
    font-size: 20px;
    margin-bottom: 2px;
}

.tab.active {
    color: var(--blue);
    font-weight: 600;
}

/* Active Call Screen */
.dark-call {
    background: linear-gradient(to bottom, #fafafa 0%, #fff 70%);
    color: var(--text);
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    padding: 28px 0 20px;
}

.call-badges {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.call-badge {
    background: var(--accent-hover);
    color: var(--blue);
    font-weight: 600;
    font-size: 9.5px;
    border-radius: 8px;
    padding: 3px 7px;
    text-transform: uppercase;
    animation: none;
}

.call-line-grid {
    width: 90%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 4px;
}

.call-line-grid--1 {
    grid-template-columns: 1fr;
    width: 70%;
}

.call-line-grid__status,
.call-line-grid__number {
    text-align: center;
}

.call-line-grid__status {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.call-line__label {
    font-weight: 700;
    color: var(--text);
}

.call-line__status {
    font-weight: 600;
    color: var(--blue);
}

.call-line-grid__number {
    font-size: 11px;
    color: var(--muted);
    word-break: break-word;
}

.call-line-grid__status.call-line--hold .call-line__status {
    color: #b45309;
}

.call-line-grid__status.call-line--active .call-line__status {
    color: var(--green);
}

.call-line-grid__status.call-line--ringing .call-line__status {
    color: #2563eb;
}

.call-top {
    margin-bottom: 6px;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}
.call-top h4 {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.call-top h2 {
    margin: 4px 0;
    font-size: 20px;
    font-weight: 600;
}

.call-top p {
    margin: 0;
    color: #555;
    font-size: 13px;
}

#callTimer {
    font-size: 22px;
    font-weight: 600;
    margin: 8px 0 6px;
    color: var(--text);
}

.call-timer--hidden {
    visibility: hidden;
}

.call-actions-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    padding: 16px 10px 16px 10px;
    width: 90%;
    margin: 0 auto;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.04);
}

.call-actions-panel .row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
    gap: 10px;
}

.call-action {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.call-action:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: var(--accent-border);
}

.call-icon {
    font-size: 22px;
}

.call-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.call-action:active {
    background: var(--accent-press);
}

.call-action.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.call-action.active .call-label,
.call-action.active .call-icon {
    color: rgba(255, 255, 255, 0.95);
}

.call-action.swap-active {
    border-color: var(--blue);
    background: var(--accent-soft);
}

.call-action.swap-active .call-icon,
.call-action.swap-active .call-label {
    color: var(--blue);
}

.call-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f1f5f9;
    border-color: var(--line);
    color: var(--muted);
}

.call-action:disabled .call-label,
.call-action:disabled .call-icon {
    color: var(--muted);
}

.end-area {
    display: flex;
    justify-content: center;
    margin-top: 14px;
    margin-bottom: 0;
}

.end-call {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #ef4444;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.dial-input {
    width: calc(100% - 64px);
    margin: 0 auto;
    display: block;
    border: none;
    outline: none;
    text-align: center;
    font-size: 26px;
    font-weight: 500;
    padding: 14px 0;
    background: var(--bg);
    color: var(--text);
}

.dial-input:focus {
    outline: none;
}

.hidden {
    display: none !important;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    border: 1px solid #CCC;
}

.modal-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.modal-btn {
    border: none;
    background: var(--surface);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
}

.modal-btn.primary {
    background: var(--blue);
    color: #fff;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 30px);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 10px 24px;
    border-radius: 999px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.status-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--blue);
    animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

#dispositionPanel select,
#dispositionPanel textarea {
    width: 100%;
    margin-bottom: 10px;
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.agent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.agent-info small {
    color: var(--muted);
    font-size: 12px;
}

.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
}

.agent-dot.available {
    background: #22c55e;
}

.agent-dot.busy {
    background: #ef4444;
}

.agent-dot.break {
    background: #f59e0b;
}

.agent-dot.after-call {
    background: #6366f1;
}

.agent-transfer {
    border: none;
    background: var(--blue);
    color: #fff;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
}

.requeue-summary {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--muted);
}

#transferPanel,
#requeuePanel,
#dispositionPanel {
    padding-top: 8px;
    padding-bottom: 32px;
}
