/* Theme variables */
[data-theme="dark"] {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1b26;
    --bg-tertiary: #24253a;
    --bg-input: #1a1b26;
    --text-primary: #e1e2e8;
    --text-secondary: #a0a9b8;
    --text-muted: #6b7084;
    --border: #2a2b3d;
    --accent-green: #4ade80;
    --accent-blue: #60a5fa;
    --accent-red: #f87171;
    --accent-orange: #fb923c;
    --btn-start-bg: #22c55e;
    --btn-start-hover: #16a34a;
    --btn-hangup-bg: #374151;
    --btn-hangup-hover: #4b5563;
    --summary-bg: #1e293b;
    --summary-border: #3b82f6;
    --history-active: #1e293b;
    --history-hover: #1a1b26;
    --modal-bg: #1a1b26;
    --shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --bg-input: #ffffff;
    --text-primary: #1a1b26;
    --text-secondary: #495057;
    --text-muted: #868e96;
    --border: #dee2e6;
    --accent-green: #16a34a;
    --accent-blue: #2563eb;
    --accent-red: #dc2626;
    --accent-orange: #ea580c;
    --btn-start-bg: #16a34a;
    --btn-start-hover: #15803d;
    --btn-hangup-bg: #d1d5db;
    --btn-hangup-hover: #9ca3af;
    --summary-bg: #eff6ff;
    --summary-border: #3b82f6;
    --history-active: #eff6ff;
    --history-hover: #f1f3f5;
    --modal-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

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

.status-dot.active {
    background: var(--accent-green);
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.user-balance {
    font-size: 13px;
    font-weight: 700;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    padding: 4px 10px;
    border-radius: 14px;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-auth {
    font-size: 13px;
    color: var(--accent-blue);
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid var(--accent-blue);
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-auth:hover {
    background: rgba(96, 165, 250, 0.1);
}

.ui-lang-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.ui-lang-select:hover {
    border-color: var(--text-muted);
}

.btn-settings {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-settings:hover {
    color: var(--text-primary);
    background: var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Main layout */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Resize handles */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.15s;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: var(--accent-blue);
}

/* Left panel */
.panel-left {
    width: 420px;
    min-width: 280px;
    max-width: 60vw;
    padding: 16px;
    background: var(--bg-secondary);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.tab {
    flex: 1;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab:hover {
    color: var(--text-primary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 1px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.cost-hint {
    font-size: 11px;
    color: var(--accent-orange);
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.task-input-wrap {
    position: relative;
}

.task-input-wrap textarea {
    width: 100%;
    padding-right: 36px;
}

.btn-voice-input {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 2px;
}

.btn-voice-input:hover {
    opacity: 1;
}

.btn-voice-input.recording {
    opacity: 1;
    color: var(--accent-red);
    animation: pulse 1s infinite;
}

.template-bar {
    display: flex;
    gap: 8px;
}

.template-bar select {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.btn-template {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-template:hover {
    background: var(--border);
}

.btn-template-delete:hover {
    color: var(--accent-red);
}

.btn-template-confirm:hover {
    color: var(--accent);
}

.btn-template-cancel:hover {
    color: var(--accent-red);
}

.template-name-input {
    display: flex;
    gap: 6px;
    animation: fadeIn 0.15s ease;
}

.template-name-input input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
}

.template-name-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.btn-template-delete.armed {
    color: var(--accent-red);
    border-color: var(--accent-red);
    animation: pulse-red 0.6s ease infinite alternate;
}

@keyframes pulse-red {
    from { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    to { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

#phoneGroup {
    position: relative;
}

.phone-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.phone-input-row input[type="tel"] {
    flex: 1;
    min-width: 0;
}

.btn-contacts {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-contacts:hover {
    background: var(--border);
    color: var(--text-primary);
}

.contacts-dropdown {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    max-height: 260px;
    display: flex;
    flex-direction: column;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.contacts-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.contact-item:hover {
    background: var(--bg-tertiary);
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.contact-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-phone {
    font-size: 11px;
    color: var(--text-muted);
    direction: ltr;
}

.contact-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.contact-item:hover .contact-delete {
    opacity: 1;
}

.contact-delete:hover {
    color: var(--accent-red);
}

.contacts-add {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border);
}

.contacts-add input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    height: 32px;
}

.contacts-add .btn-sm {
    font-size: 12px;
    white-space: nowrap;
}

.btn-start {
    width: 100%;
    padding: 12px;
    min-height: 44px;
    background: var(--btn-start-bg);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.2);
}

.btn-start:hover:not(:disabled) {
    background: var(--btn-start-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35), 0 0 20px rgba(34, 197, 94, 0.1);
}

.btn-start:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.2);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-hangup {
    width: 100%;
    padding: 12px;
    min-height: 44px;
    background: rgba(183, 77, 77, 0.12);
    color: #e57373;
    border: 1px solid rgba(183, 77, 77, 0.25);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease, border-color 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-hangup:hover:not(:disabled) {
    background: rgba(183, 77, 77, 0.2);
    border-color: rgba(183, 77, 77, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(183, 77, 77, 0.15);
}

.btn-hangup:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-hangup:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-action {
    width: 100%;
    padding: 10px;
    min-height: 40px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-action:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-listen {
    width: 100%;
    padding: 12px;
    min-height: 44px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-listen:hover:not(:disabled) {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-listen:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-listen:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-listen.muted {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Transcript panel */
.transcript-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.transcript-header h2 {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.transcript-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.translate-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.translate-toggle input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.translate-label.translating::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

.message-translation {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    padding-left: 142px;
    margin-top: -6px;
    animation: fadeIn 0.3s ease;
}

.call-duration {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 13px;
    color: var(--accent-green);
    font-weight: 600;
}

.call-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 600;
}

.call-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.call-status.live::before {
    background: var(--accent-green);
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.call-status.ended::before {
    background: var(--accent-blue);
}

.transcript-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 12px;
    line-height: 1.5;
    animation: slideIn 0.2s ease;
}

.message-time {
    color: var(--text-muted);
    font-size: 12px;
    font-family: "SF Mono", "Fira Code", monospace;
    white-space: nowrap;
    padding-top: 1px;
    min-width: 60px;
}

.message-speaker {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    padding-top: 1px;
    min-width: 70px;
}

.message-speaker.agent_a,
.message-speaker.caller {
    color: var(--accent-green);
}

.message-speaker.agent_b,
.message-speaker.receiver,
.message-speaker.phone {
    color: var(--accent-blue);
}

.message-speaker.you {
    color: var(--accent-orange);
}

.message-speaker.system {
    color: var(--text-muted);
    font-style: italic;
}

.message-text {
    color: var(--text-primary);
    font-size: 14px;
}

/* === Call Review Player === */
.call-player {
    margin: 2px 0 0;
    padding: 5px 10px 6px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Timeline — dominant element */
.cp-timeline-wrap { padding: 2px 0 1px; }
.cp-timeline-track {
    position: relative; height: 8px; background: rgba(255,255,255,0.12);
    border-radius: 4px; cursor: pointer; user-select: none;
    transition: height 0.1s;
}
.cp-timeline-track:hover { height: 10px; margin-top: -1px; margin-bottom: -1px; }
.cp-timeline-fill {
    position: absolute; left: 0; top: 0; height: 100%; width: 0;
    background: var(--accent-blue, #60a5fa); border-radius: 4px;
    pointer-events: none; transition: width 0.05s linear;
}
.cp-timeline-handle {
    position: absolute; top: 50%; left: 0; width: 14px; height: 14px;
    background: #fff; border: 2px solid var(--accent-blue, #60a5fa); border-radius: 50%;
    transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.12s;
    pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.cp-timeline-track:hover .cp-timeline-handle { opacity: 1; }

/* Timeline markers */
.cp-marker {
    position: absolute; top: -3px; width: 2px; height: calc(100% + 6px);
    background: rgba(255,255,255,0.3); border-radius: 1px;
    pointer-events: none; z-index: 1;
}

/* Controls row — tight, purpose-built */
.cp-controls {
    display: flex; align-items: center; gap: 4px; margin-top: 3px;
}
.cp-primary { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }

/* Buttons base */
.cp-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 2px; border-radius: 4px; line-height: 1;
    transition: color 0.1s, background 0.1s;
}
.cp-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.cp-btn:active { color: #fff; background: rgba(255,255,255,0.12); }

/* Play/Pause — visually dominant */
.cp-btn-play {
    font-size: 15px; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; background: var(--accent-blue, #60a5fa);
    border-radius: 50%; transition: background 0.12s, transform 0.1s;
}
.cp-btn-play:hover { background: #7cb8ff; transform: scale(1.05); color: #fff; }
.cp-btn-play:active { background: #4a9aea; transform: scale(0.97); }

/* Skip — secondary, understated */
.cp-btn-skip { font-size: 11px; opacity: 0.5; padding: 2px 3px; }
.cp-btn-skip:hover { opacity: 1; }

/* Utility cluster */
.cp-utility {
    display: flex; align-items: center; gap: 2px; flex-shrink: 0;
    margin-left: auto;
    padding-left: 6px; border-left: 1px solid rgba(255,255,255,0.06);
}

/* Speed — compact tertiary */
.cp-btn-speed {
    font-size: 13px; font-weight: 700; font-family: 'SF Mono','Fira Code',monospace;
    padding: 3px 8px; min-width: 32px; text-align: center;
    border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
    color: var(--text-muted);
}
.cp-btn-speed:hover { border-color: rgba(255,255,255,0.25); color: var(--text-primary); }

/* Icon buttons — visible utility */
.cp-btn-icon { font-size: 18px; opacity: 0.5; padding: 4px 6px; }
.cp-btn-icon:hover { opacity: 1; }

/* Time display — clear, connected to timeline */
.cp-time {
    font-size: 11px; font-family: 'SF Mono','Fira Code',monospace;
    color: var(--text-secondary); white-space: nowrap; flex: 1;
    text-align: center; min-width: 65px;
}

/* Karaoke-style transcript sync */
.message.msg-playing {
    background: rgba(96,165,250,0.1);
    border-radius: 4px; padding: 2px 6px; margin: -2px -6px;
    transition: background 0.15s ease;
}
.message.msg-playing .message-text {
    color: var(--accent-blue, #60a5fa); font-weight: 600;
}
.message[data-ts] { transition: background 0.12s ease; border-radius: 4px; }
.message[data-ts]:hover { background: rgba(255,255,255,0.03); cursor: pointer; }

/* Compact mode */
@media (max-width: 500px) {
    .cp-controls { gap: 3px; }
    .cp-btn-skip { display: none; }
    .cp-time { font-size: 10px; min-width: 50px; }
    .cp-btn-speed { font-size: 9px; min-width: 20px; }
    .cp-utility { gap: 1px; padding-left: 4px; }
    .cp-btn-icon { font-size: 10px; }
}

/* User analytics charts */
.overview-charts { margin-top: 16px; }
.overview-range { display: flex; gap: 4px; margin-bottom: 10px; }
.range-btn-sm {
    padding: 3px 10px; font-size: 11px; border-radius: 4px;
    background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid transparent; cursor: pointer;
}
.range-btn-sm.active { background: var(--accent-blue, #60a5fa); color: #fff; }
.overview-chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.overview-chart-card {
    background: var(--bg-tertiary); border-radius: 8px; padding: 10px;
}
.overview-chart-card h4 { font-size: 11px; color: var(--text-muted); margin: 0 0 6px; font-weight: 600; }
.overview-chart-card canvas { height: 130px !important; }
@media (max-width: 600px) {
    .overview-chart-row { grid-template-columns: 1fr; }
}

.message-text[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

/* Summary box */
/* Horizontal resize handle between transcript and summary */
.resize-handle-h {
    height: 5px;
    cursor: row-resize;
    background: var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.15s;
}

.resize-handle-h:hover,
.resize-handle-h.dragging {
    background: var(--accent-blue);
}

.summary-box {
    min-height: 60px;
    height: 180px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 14px 16px;
    margin: 0;
    background: var(--summary-bg);
    border-left: 3px solid var(--summary-border);
    border-radius: 0;
    animation: fadeIn 0.4s ease;
}

.summary-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--summary-border);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    background: var(--summary-bg);
    padding-bottom: 4px;
}

.summary-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* SMS fallback */
.sms-fallback {
    padding: 8px 0;
    animation: fadeIn 0.3s ease;
}

/* Chat input bar */
.chat-input-bar {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    animation: fadeIn 0.3s ease;
}

.chat-input-bar input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-bar input:focus {
    border-color: var(--accent-blue);
}

.btn-chat-send {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-width: 60px;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-chat-send:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Right panel - history */
.panel-right {
    width: 280px;
    min-width: 180px;
    max-width: 40vw;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-right h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.history-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    padding: 0 12px;
    flex-wrap: wrap;
}

.history-filter-btn {
    font-size: 13px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.history-filter-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.history-filter-btn.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--accent-blue, #60a5fa);
    box-shadow: 0 0 0 1px var(--accent-blue, #60a5fa);
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, border-left-color 0.15s;
    border-left: 3px solid transparent;
}

.history-item:hover {
    background: var(--history-hover);
    border-left-color: var(--accent-blue);
}

.history-item.active {
    background: var(--history-active);
    border-left-color: var(--accent-green);
}

.history-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.copy-phone-btn {
    cursor: pointer; font-size: 12px; opacity: 0.4; transition: opacity 0.15s;
}
.copy-phone-btn:hover { opacity: 1; }

.history-item-meta {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.badge-live {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--accent-green);
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    width: 360px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 20px 40px var(--shadow);
    animation: scaleIn 0.2s ease;
}

.modal-content .auth-form {
    gap: 14px;
}

.modal-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Wide modal variant */
.modal-wide {
    width: 480px;
}

/* Modal sections */
.modal-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.modal-section-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

/* Modal tabs (profile) */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.modal-tab {
    flex: 1;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.modal-tab:hover {
    color: var(--text-primary);
}

/* Profile tab content panels */
.prof-tab-content {
    display: none;
    flex-direction: column;
    gap: 14px;
    animation: fadeIn 0.2s ease;
}

.prof-tab-content.active {
    display: flex;
}

/* Overview info rows */
.overview-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.overview-row:last-child {
    border-bottom: none;
}

.overview-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.overview-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Modal action buttons */
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.modal-actions .btn-start {
    flex: 1;
}

.btn-secondary {
    flex: 1;
    padding: 10px;
    min-height: 40px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.btn-secondary:hover {
    background: var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Danger section */
.danger-section {
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.04);
}

.danger-header {
    color: var(--accent-red);
}

.danger-warning {
    font-size: 12px;
    color: var(--accent-red);
    opacity: 0.8;
    line-height: 1.4;
    margin-bottom: 4px;
}

.btn-danger {
    width: 100%;
    padding: 10px;
    min-height: 40px;
    background: rgba(248, 113, 113, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.5);
}

/* Account Summary in Profile */
.account-summary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.account-stat {
    text-align: center;
}

.account-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: "SF Mono", "Fira Code", monospace;
}

.account-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Section separator — between task fields and personal info */
.form-section-break {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* Form sections */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.section-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}

.required-mark {
    color: var(--accent-red);
    margin-left: 2px;
    font-weight: 700;
}

/* Advanced section (collapsed) */
.advanced-section {
    padding: 0;
    background: transparent;
    border: 1px dashed var(--border);
}

.advanced-section > summary {
    cursor: pointer;
    padding: 10px 12px;
    border-bottom: none;
    margin-bottom: 0;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.advanced-section > summary::before {
    content: "\25B6";
    font-size: 9px;
    transition: transform 0.2s;
}

.advanced-section[open] > summary::before {
    transform: rotate(90deg);
}

.advanced-section > summary::-webkit-details-marker {
    display: none;
}

.advanced-section[open] {
    padding: 0 12px 12px;
    background: var(--bg-tertiary);
    border-style: solid;
}

.advanced-section > .form-group {
    margin-top: 8px;
}

/* Call Progress Rail */
.progress-rail {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 10px 4px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.progress-step::before {
    content: "";
    position: absolute;
    top: 6px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.progress-step:first-child::before {
    display: none;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--bg-tertiary);
    position: relative;
    z-index: 1;
    transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}

.step-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color 0.3s;
}

.progress-step.done .step-dot {
    background: var(--accent-green);
}

.progress-step.done .step-label {
    color: var(--accent-green);
}

.progress-step.done::before {
    background: var(--accent-green);
}

.progress-step.active .step-dot {
    background: var(--accent-blue);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
    animation: pulse 1.5s infinite;
    transform: scale(1.2);
}

.progress-step.active .step-label {
    color: var(--accent-blue);
    font-weight: 700;
}

.progress-step.active::before {
    background: var(--accent-green);
}

.progress-step.error .step-dot {
    background: var(--accent-red);
}

.progress-step.error .step-label {
    color: var(--accent-red);
}

/* State-driven panel emphasis */
.panel-left.in-call .form-section {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.panel-left.in-call .progress-rail {
    opacity: 1;
    pointer-events: auto;
}

.panel-left.in-call .btn-hangup,
.panel-left.in-call .listen-link {
    opacity: 1;
    pointer-events: auto;
}

.panel-left.in-call .btn-start {
    display: none;
}

/* Activity badges on transcript */
.activity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

.activity-badge.speaking {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent-green);
}

.activity-badge.waiting {
    background: rgba(251, 146, 60, 0.15);
    color: var(--accent-orange);
}

.activity-badge.ivr {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    .resize-handle {
        display: none;
    }
    .panel-right {
        display: none;
    }
    .transcript-panel {
        display: none;
    }
    .main-content {
        flex-direction: column;
    }
    .panel-left {
        width: 100%;
        min-width: unset;
        max-width: 100%;
    }
}

/* ── Mobile header burger menu ── */
.header-burger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    line-height: 0;
}
.header-burger:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}
.header-mobile-menu {
    width: 100%;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
}
.mobile-menu-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.mobile-menu-items .user-name {
    width: 100%;
    font-size: 13px;
    color: var(--text-secondary);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    body {
        font-size: 14px;
    }
    .panel-left {
        width: 100%;
        min-width: unset;
        padding: 12px;
    }
    .transcript-panel {
        display: none;
    }
    header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    header h1 {
        font-size: 16px;
    }
    /* Hide individual action items, show burger */
    .header-burger {
        display: flex;
    }
    .header-right .user-name,
    .header-right .btn-profile-text,
    .header-right .btn-admin-text,
    .header-right .btn-logout-text,
    .header-right .ui-lang-select,
    .header-right .btn-settings {
        display: none !important;
    }
    /* Balance stays visible in header */
    .header-right .user-balance {
        font-size: 12px;
        padding: 3px 8px;
    }
    .tab-bar {
        flex-wrap: wrap;
        gap: 4px;
    }
    .tab-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    .form-group label {
        font-size: 12px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 14px;
        min-height: 44px;
    }
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    .btn-start,
    .btn-hangup {
        padding: 14px;
        font-size: 14px;
        min-height: 44px;
    }
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        padding: 16px;
    }
    .history-item {
        padding: 8px;
        font-size: 12px;
    }
    .user-menu,
    .guest-menu {
        font-size: 12px;
    }
    .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    /* Stack form rows on mobile */
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    /* Show call rating on mobile */
    .rating-stars {
        font-size: 24px;
    }
}

/* Responsive - Small mobile */
@media (max-width: 380px) {
    header h1 {
        font-size: 14px;
    }
    .tab-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Call rating stars */
.rating-stars {
    display: flex;
    gap: 4px;
    font-size: 28px;
    cursor: pointer;
}
.rating-stars span {
    color: var(--text-muted);
    transition: color 0.2s;
}
.rating-stars span.active,
.rating-stars span:hover {
    color: #fbbf24;
}

/* Share button */
.btn-share {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
}
.btn-share:hover {
    opacity: 0.8;
}

/* Logout text button — destructive tier */
.btn-logout-text {
    background: rgba(183, 77, 77, 0.08);
    border: 1px solid rgba(183, 77, 77, 0.25);
    color: #e57373;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-logout-text:hover {
    color: #ef9a9a;
    background: rgba(183, 77, 77, 0.14);
    border-color: rgba(183, 77, 77, 0.4);
    box-shadow: 0 2px 4px rgba(183, 77, 77, 0.1);
}

/* Profile button — secondary tier */
.btn-profile-text {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-profile-text:hover {
    color: var(--text-primary);
    background: var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Admin link button — elevated secondary with blue accent */
.btn-admin-text {
    background: rgba(96, 165, 250, 0.06);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-admin-text:hover {
    background: rgba(96, 165, 250, 0.14);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 2px 6px rgba(96, 165, 250, 0.12);
}

/* RTL support */
[dir="rtl"] main {
    direction: rtl;
}
[dir="rtl"] .panel-left,
[dir="rtl"] .panel-right {
    direction: rtl;
}
[dir="rtl"] .transcript-messages {
    direction: rtl;
}
[dir="rtl"] .msg-agent {
    text-align: right;
}
[dir="rtl"] .msg-user {
    text-align: left;
}
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
    text-align: right;
}
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="date"],
[dir="rtl"] input[type="datetime-local"] {
    text-align: left;
    direction: ltr;
}
[dir="rtl"] .header-left {
    flex-direction: row-reverse;
}
[dir="rtl"] .header-right {
    flex-direction: row-reverse;
}
[dir="rtl"] .user-menu {
    flex-direction: row-reverse;
}
[dir="rtl"] .template-bar {
    direction: rtl;
}
[dir="rtl"] .task-input-wrap {
    direction: rtl;
}
[dir="rtl"] .btn-voice-input {
    right: auto;
    left: 8px;
}
[dir="rtl"] .transcript-header {
    flex-direction: row-reverse;
}
[dir="rtl"] .summary-box {
    direction: rtl;
    text-align: right;
}
[dir="rtl"] .history-item {
    direction: rtl;
    text-align: right;
}
[dir="rtl"] .chat-input-bar {
    direction: rtl;
}
[dir="rtl"] .form-group label {
    text-align: right;
}
[dir="rtl"] .auth-card {
    direction: rtl;
    text-align: right;
}
[dir="rtl"] .auth-header .ui-lang-select {
    right: auto;
    left: 40px;
}
[dir="rtl"] .code-footer {
    direction: rtl;
}

/* Story 7: Transcript speaker styling & fact chips */
.msg-agent_a, .msg-caller { border-left: 3px solid rgba(74, 222, 128, 0.3); padding-left: 10px; }
.msg-agent_b, .msg-receiver, .msg-phone { border-left: 3px solid rgba(96, 165, 250, 0.3); padding-left: 10px; }
.msg-you { border-left: 3px solid rgba(251, 146, 60, 0.3); padding-left: 10px; }
.msg-system { border-left: 3px solid rgba(156, 163, 175, 0.3); padding-left: 10px; font-style: italic; }
.msg-continuation .message-time, .msg-continuation .message-speaker { visibility: hidden; }
.msg-continuation { padding-top: 2px; }
.fact-chip { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 10px; margin: 1px 2px; font-weight: 600; vertical-align: middle; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact-chip-price { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.fact-chip-hours { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.fact-chip-address { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.fact-chip-callback { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.fact-chip-goal { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.fact-chip-info { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.fact-chip-default { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }
.fact-chip-more { background: rgba(148, 163, 184, 0.08); color: var(--text-muted); cursor: pointer; font-size: 10px; }
.goal-badge { font-size: 10px; padding: 1px 5px; border-radius: 3px; font-weight: 600; margin-left: 4px; }
.goal-yes { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.goal-no { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.history-facts { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }

/* Story 8: Sticky call actions */
.call-actions-sticky {
    position: sticky;
    bottom: 0;
    padding: 12px 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    z-index: 10;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Story 9: History enhancements */
.history-summary { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history-retry-hint { font-size: 11px; color: #3b82f6; font-weight: 600; margin-top: 3px; cursor: pointer; }
.history-retry-hint:hover { color: #60a5fa; text-decoration: underline; }
.retry-armed { animation: pulse-retry 1s ease-in-out infinite alternate; }
@keyframes pulse-retry { from { box-shadow: 0 0 0 rgba(59, 130, 246, 0); } to { box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); } }
.history-facts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }

/* Onboarding modal */
.onboarding-step { display: none; text-align: center; padding: 20px 10px; }
.onboarding-step.active { display: block; }
.onboarding-icon { font-size: 48px; margin-bottom: 12px; }
.onboarding-step h2 { font-size: 20px; color: var(--text-primary); margin-bottom: 8px; }
.onboarding-step p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.onboarding-fields { text-align: left; margin-top: 12px; }
.onboarding-field { padding: 8px 12px; background: var(--bg-tertiary); border-radius: 6px; margin-bottom: 6px; border-left: 3px solid var(--accent-blue, #60a5fa); }
.onboarding-field strong { display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 2px; }
.onboarding-field span { font-size: 12px; color: var(--text-muted); }
.onboarding-dots { display: flex; justify-content: center; gap: 6px; margin: 16px 0 12px; }
.onboarding-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background 0.2s; }
.onboarding-dots .dot.active { background: var(--accent-blue, #60a5fa); }
.onboarding-actions { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 10px; }
.onboarding-actions .btn-secondary { padding: 10px 24px; font-size: 14px; min-width: 100px; }
.onboarding-actions .btn-start { padding: 10px 32px; font-size: 15px; min-width: 140px; }

/* Cost estimate */
.cost-local { color: #22c55e; font-weight: 600; }
.cost-intl { color: #eab308; font-weight: 600; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-sub { font-size: 13px; }

/* Call coaching cards */
.coaching-container { padding: 0 12px; }
.coaching-card {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; margin-bottom: 6px; border-radius: 8px;
    background: rgba(245, 158, 11, 0.1); border-left: 3px solid #f59e0b;
    cursor: pointer; animation: coaching-slide-in 0.2s ease-out;
}
.coaching-card:hover { background: rgba(245, 158, 11, 0.18); }
.coaching-icon { font-size: 16px; flex-shrink: 0; }
.coaching-text { flex: 1; font-size: 13px; color: var(--text-primary); }
.coaching-dismiss { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.coaching-card.fact_detected { border-left-color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.coaching-card.fact_detected:hover { background: rgba(34, 197, 94, 0.18); }
@keyframes coaching-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Inline transcript translation */
.message-translation.inline-translation {
    font-size: 0.85em; opacity: 0.7; font-style: italic;
    margin-top: 2px; padding-left: 4px;
    border-left: 2px solid var(--accent-blue, #60a5fa);
}

/* Personality blend chips */
.chip-btn {
    padding: 4px 10px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--bg-secondary);
    color: var(--text-primary); font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.chip-btn:hover { border-color: var(--accent-blue, #60a5fa); }
.chip-btn.active { background: var(--accent-blue, #60a5fa); color: white; border-color: var(--accent-blue, #60a5fa); }
#personalityBlend { font-size: 13px; resize: vertical; min-height: 36px; }

/* Profile preferences — setting rows and toggle switches */
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-label { font-size: 14px; color: var(--text-primary); display: block; }
.setting-desc { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.toggle-switch {
    position: relative; display: inline-block;
    width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--bg-tertiary, #2a2a3e);
    border: 1px solid var(--border, #3a3a4e);
    border-radius: 24px; transition: background 0.25s, border-color 0.25s;
}
.toggle-slider::before {
    content: ""; position: absolute;
    height: 18px; width: 18px; left: 2px; bottom: 2px;
    background: var(--text-muted, #8a8a9e);
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), background 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-blue, #60a5fa);
    border-color: var(--accent-blue, #60a5fa);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px); background: #fff;
}

/* Accent button (admin pipeline actions) */
.btn-accent { background: var(--accent-blue, #60a5fa); color: #fff; border-color: var(--accent-blue, #60a5fa); }
.btn-accent:hover:not(:disabled) { background: #3b82f6; border-color: #3b82f6; }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

/* Call quality badge */
.quality-badge { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 700; margin-left: 4px; }
.quality-good { background: rgba(34,197,94,0.15); color: #22c55e; }
.quality-ok { background: rgba(234,179,8,0.15); color: #eab308; }
.quality-poor { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Share button in history */
.share-btn { cursor: pointer; font-size: 13px; opacity: 0.5; margin-left: 4px; }
.share-btn:hover { opacity: 1; }
