/* === IPBXIT Client - Main Styles === */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    background: var(--bg-app);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === APP LAYOUT === */
.app-layout {
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-rows: 1fr auto;
    height: 100vh;
    overflow: hidden;
}

.app-layout.has-call {
    grid-template-rows: 1fr 56px;
}

.app-layout.panel-open {
    grid-template-columns: 56px 1fr 320px;
}

/* === RAIL (Sidebar) === */
.rail {
    grid-row: 1 / -1;
    background: var(--bg-rail);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 8px;
    gap: 2px;
    z-index: 20;
    width: 200px;
    overflow: hidden;
    overflow-y: auto;
}

.rail-item {
    width: 100%;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
    font-size: 15px;
    border: none;
    background: none;
    text-align: left;
}

.rail-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.rail-item.active {
    background: var(--bg-rail-active);
    color: var(--primary);
    font-weight: 600;
}

.rail-item .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.rail-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.rail-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 10px;
}

.rail-brand svg {
    width: 32px;
    height: 32px;
}

.rail-brand-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rail-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
    line-height: 1.1;
}

.rail-clock {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.rail-spacer { flex: 1; }

.rail-separator {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* User avatar in rail */
.rail-avatar {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    position: relative;
    margin-top: 4px;
    border: none;
    background: none;
    text-align: left;
    color: var(--text-primary);
}

.rail-avatar:hover {
    background: var(--bg-surface-hover);
}

.rail-avatar .avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.rail-avatar .avatar-name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.rail-avatar .avatar-status-text {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rail-avatar .presence-dot-avatar {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-rail);
}

/* Status selector dropdown */
.status-selector {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 100;
    margin-bottom: 8px;
}

.status-selector-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 4px 8px 8px;
    letter-spacing: 0.5px;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    transition: background 0.1s;
}

.status-option:hover {
    background: var(--bg-surface-hover);
}

.status-option.active {
    background: var(--bg-rail-active);
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.available { background: #4CAF50; }
.status-dot.busy { background: #F44336; }
.status-dot.dnd { background: #9C27B0; }
.status-dot.away { background: #FF9800; }
.status-dot.offline { background: #9E9E9E; }

.status-custom-input {
    display: flex;
    gap: 6px;
    padding: 6px 10px 2px;
}

.status-custom-input input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
}

.status-custom-input input:focus {
    border-color: var(--primary);
}

.status-custom-input button {
    padding: 4px 10px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.rail-avatar .presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-rail);
}

/* === MAIN CONTENT === */
.main-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
}

/* Top bar */
.top-bar {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.top-bar h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-global {
    flex: 1;
    max-width: 400px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    padding: 0 12px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.search-global:focus {
    border-color: var(--primary);
}

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

/* View container */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* === CONTEXT PANEL (right) === */
.context-panel {
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    display: none;
}

.app-layout.panel-open .context-panel {
    display: block;
}

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

.panel-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-close:hover { background: var(--bg-surface-hover); }

.panel-body { padding: 16px; }

/* === CALL PANEL (Right Side Slide-in) === */
.call-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 80;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.call-panel.open {
    transform: translateX(0);
}

/* Header */
.call-panel-header {
    padding: 28px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.call-panel-header.ringing {
    animation: call-panel-pulse 1.5s ease-in-out infinite;
}

@keyframes call-panel-pulse {
    0%, 100% { background: transparent; }
    50% { background: rgba(76, 175, 80, 0.08); }
}

.call-panel-ring-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--success);
    margin-bottom: 4px;
}

.call-panel-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.call-panel.ringing .call-panel-avatar {
    animation: avatar-ring 1s ease-in-out infinite;
    box-shadow: 0 0 0 4px rgba(76,175,80,0.3);
}

@keyframes avatar-ring {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(76,175,80,0.3); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(76,175,80,0.15); }
}

.call-panel-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.call-panel-number {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.call-panel-timer {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--success);
    letter-spacing: 1px;
    margin-top: 4px;
}

.call-panel-hold-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--warning);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

/* Actions */
.call-panel-actions {
    padding: 0 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.call-panel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: white;
}

.call-panel-btn.answer {
    background: var(--success);
}

.call-panel-btn.answer:hover {
    background: #43A047;
    transform: scale(1.02);
}

.call-panel-btn.hangup {
    background: var(--danger, #F44336);
}

.call-panel-btn.hangup:hover {
    background: #D32F2F;
    transform: scale(1.02);
}

/* Small action buttons grid (3 cols) */
.call-panel-btn-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.call-panel-btn-sm {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.call-panel-btn-sm:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.call-panel-btn-sm.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.call-panel-btn-sm.recording {
    background: var(--danger, #F44336);
    color: white;
    border-color: var(--danger, #F44336);
    animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Sections (DTMF, Transfer) */
.call-panel-section {
    padding: 0 24px 16px;
}

.call-panel-section .call-dtmf-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.call-panel-section .dtmf-key {
    height: 44px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
}

.call-panel-section .dtmf-key:hover {
    background: var(--bg-surface-hover);
}

.call-panel-section .dtmf-key:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
}

/* Drag hint */
.call-panel-hint {
    padding: 10px 24px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Transfer panel inside call panel */
.call-panel-section .transfer-panel {
    max-height: 250px;
}

.call-panel-section .transfer-list {
    max-height: 200px;
    overflow-y: auto;
}

.call-panel-section .transfer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

.call-panel-section .transfer-item:hover {
    background: var(--bg-surface-hover);
}

.call-panel-section .transfer-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.call-panel-section .transfer-ext {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* === FAB (Floating Action Button) === */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    transition: all 0.2s;
}

.fab:hover { transform: scale(1.08); }
.fab:active { transform: scale(0.95); }
.fab svg { width: 24px; height: 24px; }


/* === PRESENCE DOT === */
.presence-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-surface);
}

.presence-dot.available { background: #4CAF50; box-shadow: 0 0 0 2px var(--bg-surface), 0 0 6px rgba(76,175,80,0.4); }
.presence-dot.busy { background: #F44336; box-shadow: 0 0 0 2px var(--bg-surface), 0 0 6px rgba(244,67,54,0.4); }
.presence-dot.ringing { background: #2196F3; animation: pulse-dot 1s infinite; }
.presence-dot.dnd { background: #9C27B0; box-shadow: 0 0 0 2px var(--bg-surface), 0 0 6px rgba(156,39,176,0.3); }
.presence-dot.away { background: #FF9800; box-shadow: 0 0 0 2px var(--bg-surface), 0 0 6px rgba(255,152,0,0.3); }
.presence-dot.offline { background: #9E9E9E; }
.presence-dot.hold { background: #FF9800; animation: pulse-dot 1.5s infinite; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px var(--bg-surface), 0 0 4px rgba(33,150,243,0.3); }
    50% { opacity: 0.7; transform: scale(1.2); box-shadow: 0 0 0 2px var(--bg-surface), 0 0 12px rgba(33,150,243,0.6); }
}

/* === CARDS === */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.15s;
}

.card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

.card-clickable { cursor: pointer; }
.card-clickable:hover { background: var(--bg-surface-hover); }

/* === STATUS BOARD (colleagues grouped by status rows) === */
.status-board {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-row {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    transition: all 0.2s;
}

.status-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 4px;
}

.status-row-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-row-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.status-row-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.status-row-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-row-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 12px;
}

/* === COLLEAGUE TILE (square card) === */
.colleague-tile {
    width: 160px;
    min-height: 140px;
    border-radius: 14px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 8px 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.colleague-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: transparent;
}

/* Top accent bar */
.tile-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

/* Favorite star */
.tile-star {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 12px;
    color: #FFC107;
    z-index: 2;
}

/* Unread chat badge */
.tile-chat-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(229,57,53,0.4);
    animation: badge-pop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.tile-chat-badge:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(229,57,53,0.6);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Attachment badge (file/photo) */
.tile-attach-badge {
    position: absolute;
    bottom: 8px;
    left: 6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #2196F3;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(33,150,243,0.4);
    animation: badge-pop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.tile-attach-badge:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(33,150,243,0.6);
}

.tile-attach-badge svg {
    width: 10px;
    height: 10px;
}

/* Avatar */
.tile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 700;
    transition: transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: relative;
}

.colleague-tile:hover .tile-avatar {
    transform: scale(1.06);
}

/* Presence dot inside tile */
.tile-presence-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-app);
    z-index: 2;
    box-shadow: 0 0 6px currentColor;
}

/* Ringing dot pulses */
.colleague-tile.ringing .tile-presence-dot {
    animation: dot-pulse 1s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 4px currentColor; }
    50% { transform: scale(1.2); box-shadow: 0 0 10px currentColor; }
}

.tile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    max-width: 144px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.tile-ext {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.tile-incall {
    font-size: 10px;
    color: #FF9800;
    font-weight: 600;
    max-width: 144px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action buttons on hover */
.tile-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 2px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
}

.colleague-tile:hover .tile-actions { opacity: 1; }

.tile-action {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tile-action.call:hover { color: #4CAF50; background: rgba(76,175,80,0.1); }
.tile-action.chat:hover { color: #2196F3; background: rgba(33,150,243,0.1); }
.tile-action.fav:hover { color: #FFC107; background: rgba(255,193,7,0.1); }

/* Drag-and-drop transfer */
.colleague-tile.transfer-ready {
    cursor: copy;
}

.colleague-tile.drop-target {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.3), 0 8px 24px rgba(76,175,80,0.2) !important;
    transform: scale(1.05) !important;
}

.tile-drop-overlay {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: rgba(76,175,80,0.9);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 10;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: drop-pulse 0.8s ease-in-out infinite;
}

@keyframes drop-pulse {
    0%, 100% { background: rgba(76,175,80,0.85); }
    50% { background: rgba(76,175,80,0.95); }
}


/* Ringing tile animation */
.status-row .colleague-tile.ringing {
    animation: tile-ring 1.5s ease-in-out infinite;
}

@keyframes tile-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,0); }
    50% { box-shadow: 0 0 0 4px rgba(255,152,0,0.3); }
}

/* === SECTION HEADERS === */
.section-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-surface-active); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }

/* === DIALPAD === */
.dialpad-display {
    font-size: 28px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    text-align: center;
    padding: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.dialpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 280px;
    margin: 0 auto;
}

.dialpad-key {
    aspect-ratio: 1.2;
    border: none;
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    user-select: none;
}

.dialpad-key:hover { background: var(--bg-surface-hover); }
.dialpad-key:active { background: var(--bg-surface-active); transform: scale(0.95); }

.dialpad-key small {
    font-size: 9px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 2px;
}

.dialpad-call-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto 0;
    transition: all 0.15s;
}

.dialpad-call-btn:hover { transform: scale(1.08); }
.dialpad-call-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* === HISTORY LIST === */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

.history-item:hover { background: var(--bg-surface-hover); }

.history-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-icon.incoming { background: rgba(76,175,80,0.15); color: var(--success); }
.history-icon.outgoing { background: rgba(33,150,243,0.15); color: var(--info); }
.history-icon.missed { background: rgba(244,67,54,0.15); color: var(--danger); }

.history-info { flex: 1; min-width: 0; }
.history-name { font-weight: 500; }
.history-number { font-size: 12px; color: var(--text-secondary); }

.history-meta { text-align: right; flex-shrink: 0; }
.history-time { font-size: 12px; color: var(--text-muted); }
.history-duration { font-size: 11px; color: var(--text-secondary); }

/* === CHAT === */
.chat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

.chat-list-item:hover { background: var(--bg-surface-hover); }
.chat-list-item.unread .chat-preview { font-weight: 600; color: var(--text-primary); }

.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* chat-bubble sizing handled in section below (line ~3412) */

.chat-timestamp {
    font-size: 10px;
    color: var(--text-muted);
    padding: 0 4px;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

.chat-input {
    flex: 1;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0 14px;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

.chat-input:focus { border-color: var(--primary); }

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === CONTACTS === */
.contact-letter-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    padding: 8px 12px 4px;
    position: sticky;
    top: 0;
    background: var(--bg-app);
    z-index: 5;
}

/* === TAGS === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    gap: 4px;
}

.tag-primary { background: rgba(229,57,53,0.1); color: var(--primary); }
.tag-success { background: rgba(76,175,80,0.1); color: var(--success); }
.tag-warning { background: rgba(255,152,0,0.1); color: var(--warning); }
.tag-info { background: rgba(33,150,243,0.1); color: var(--info); }

/* === LOGIN SCREEN === */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);
}

.login-card {
    width: 360px;
    padding: 40px 32px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    color: white;
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.login-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    height: 42px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: white;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.login-field input:focus {
    border-color: var(--primary);
}

.login-field input::placeholder {
    color: rgba(255,255,255,0.3);
}

.login-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
}

.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-error {
    background: rgba(244,67,54,0.15);
    border: 1px solid rgba(244,67,54,0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #FF8A80;
    margin-bottom: 16px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

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

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* === RESPONSIVE: MOBILE === */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 48px 1fr auto 56px;
    }

    .app-layout.has-call {
        grid-template-rows: 48px 1fr 56px 56px;
    }

    .app-layout.panel-open {
        grid-template-columns: 1fr;
    }

    .rail {
        grid-row: 4;
        grid-column: 1;
        flex-direction: row;
        width: 100%;
        height: 56px;
        border-right: none;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        padding: 0;
    }

    .rail-spacer, .rail-separator, .rail-avatar { display: none; }

    .rail-item {
        width: 48px;
        height: 48px;
    }

    .context-panel {
        position: fixed;
        inset: 0;
        z-index: 90;
        display: none;
    }

    .app-layout.panel-open .context-panel {
        display: block;
    }

    .fab {
        bottom: 72px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .colleague-actions { opacity: 1; }
}

/* === APP SHELL (Preact) === */
.app-shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    overflow: hidden;
}

.app-shell.has-call .fab {
    display: none;
}

/* === TOP BAR (search + compose + status + settings) === */
.top-bar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.top-bar-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    height: 36px;
    max-width: 360px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.top-bar-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.08);
}

.top-bar-search svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.top-bar-search input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.top-bar-search input::placeholder {
    color: var(--text-muted);
}

.top-bar-compose {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    height: 36px;
    width: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.top-bar-compose:focus-within {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.08);
}

.top-bar-compose svg {
    flex-shrink: 0;
    color: var(--success);
}

.top-bar-compose input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.top-bar-compose input::placeholder {
    color: var(--text-muted);
}

.top-bar-call-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--text-muted);
    cursor: default;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s, color 0.2s;
}
.top-bar-call-btn.active {
    background: var(--success);
    color: white;
    cursor: pointer;
}
.top-bar-call-btn.active:hover {
    background: #43a047;
    transform: scale(1.1);
}

.top-bar-device-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    min-width: 260px;
    max-height: 340px;
    overflow-y: auto;
    z-index: 999;
    padding: 6px 0;
}

.device-section-label {
    padding: 6px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.device-option:hover {
    background: var(--bg-hover);
}
.device-option.active {
    color: var(--success);
    font-weight: 600;
}
.device-option svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}
.device-option.active svg {
    color: var(--success);
}
.device-check {
    margin-left: auto;
    color: var(--success);
    font-weight: bold;
}
.device-empty {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.top-bar-spacer {
    flex: 1;
}

/* SMS Button */
.top-bar-sms-wrap {
    flex-shrink: 0;
}

.top-bar-sms-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.top-bar-sms-btn:hover,
.top-bar-sms-btn.active {
    background: var(--bg-surface-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.top-bar-sms-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: 14px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sms-dropdown-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sms-input {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}

.sms-input:focus {
    border-color: var(--primary);
}

.sms-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    resize: none;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.sms-textarea:focus {
    border-color: var(--primary);
}

.sms-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sms-char-count {
    font-size: 11px;
    color: var(--text-muted);
}

.sms-result {
    font-size: 11px;
    flex: 1;
}

.sms-result.ok {
    color: var(--success, #4CAF50);
}

.sms-result.err {
    color: var(--danger, #F44336);
}

.sms-send-btn {
    margin-left: auto;
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.sms-send-btn:hover:not(:disabled) {
    opacity: 0.9;
}

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

.top-bar-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    user-select: none;
    flex-shrink: 0;
}

.top-bar-time {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    line-height: 1.1;
}

.top-bar-date {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
    line-height: 1.2;
}

/* User avatar in top bar */
.top-bar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
    flex-shrink: 0;
}

.top-bar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
}

.top-bar-avatar .presence-dot-avatar {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.top-bar-user-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.top-bar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.top-bar-user-ext {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.top-bar-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    background: var(--bg-surface-hover);
    position: relative;
    user-select: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}

.top-bar-status:hover {
    background: var(--bg-hover);
}

.top-bar-status .presence-dot {
    width: 10px;
    height: 10px;
    box-shadow: none;
}

.top-bar-status-label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.top-bar-status-arrow {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 2px;
}

.top-bar-status-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 200;
    min-width: 200px;
}

.top-bar-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.top-bar-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.top-bar-btn.active {
    color: var(--primary);
    background: var(--bg-rail-active);
}

.main-content {
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* === VIEW CONTENT === */
.view-content {
    max-width: 1200px;
    padding: 24px;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    gap: 4px;
}

/* === SEARCH BOX === */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 10px 16px;
    flex: 1;
    max-width: 400px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* === FILTER TABS === */
.filter-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
}

.filter-tab {
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    transition: all 0.15s;
    margin-bottom: -2px;
}

.filter-tab:hover { color: var(--text-primary); background: var(--bg-surface-hover); border-radius: 8px 8px 0 0; }
.filter-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* === ACTION BUTTON (inline icon) === */
.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

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

.action-btn.active {
    color: var(--primary);
}

/* === BTN VARIANTS === */
.btn-primary, .btn-secondary, .btn-danger, .btn-outline, .btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; box-shadow: 0 3px 12px rgba(229,57,53,0.3); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(229,57,53,0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary { background: var(--bg-surface-hover); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-surface-active); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; box-shadow: 0 3px 12px rgba(244,67,54,0.3); }
.btn-danger:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-surface-hover); border-color: var(--primary); color: var(--primary); }

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* (duplicate colleague styles removed - see tile grid above) */

/* === AVATAR === */
.avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 26px;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.avatar .presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 22px;
    height: 22px;
    border: 3px solid var(--bg-surface);
}

.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 11px;
    position: relative;
    flex-shrink: 0;
}

.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 28px;
    margin: 0 auto 12px;
}

.avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* === PRESENCE DOT (positioned) === */
.presence-dot-positioned {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid var(--bg-surface);
    position: absolute;
    bottom: -1px;
    right: -1px;
}

.presence-dot-mini {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
    border: 2px solid var(--bg-surface);
}

.presence-dot-positioned.available, .presence-dot-mini.available { background: #4CAF50; }
.presence-dot-positioned.busy, .presence-dot-mini.busy { background: #F44336; }
.presence-dot-positioned.ringing, .presence-dot-mini.ringing { background: #2196F3; animation: pulse 1s infinite; }
.presence-dot-positioned.dnd, .presence-dot-mini.dnd { background: #9C27B0; }
.presence-dot-positioned.away, .presence-dot-mini.away { background: #FF9800; }
.presence-dot-positioned.offline, .presence-dot-mini.offline { background: #9E9E9E; }
.presence-dot-positioned.hold, .presence-dot-mini.hold { background: #FF9800; }

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

/* (duplicate favorites styles removed - see favorites above) */

/* === PANEL (context detail) === */
.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

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

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.panel-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 44px;
    margin: 12px auto 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    letter-spacing: 1px;
}

.panel-status {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.panel-status .presence-dot {
    position: static;
    border: none;
    width: 16px;
    height: 16px;
}

.panel-peer {
    text-align: center;
    font-size: 16px;
    color: #F44336;
    font-weight: 500;
    margin-bottom: 16px;
}

.panel-extension {
    text-align: center;
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 2px;
}

.panel-device {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.panel-section {
    margin: 16px 0;
}

.panel-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.panel-supervision {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 16px;
}

.panel-supervision h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.panel-phone-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}

.phone-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 50px;
}

.phone-number { flex: 1; }

.panel-email-row {
    font-size: 13px;
    padding: 4px 0;
    color: var(--primary);
}

.panel-notes {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.panel-company {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

.panel-job {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* === DIALER PRO === */
.dialer-pro {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
    max-width: 420px;
    margin: 0 auto;
    padding: 8px 16px !important;
}

/* Speed dial bar */
.speed-dial-bar {
    margin-bottom: 12px;
}

.speed-dial-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.speed-dial-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.speed-dial-scroll::-webkit-scrollbar { height: 3px; }
.speed-dial-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.speed-dial-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}

.speed-dial-chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(76,175,80,0.15);
    transform: translateY(-2px);
}

.speed-dial-chip:active { transform: scale(0.97); }

.speed-dial-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 700;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.speed-dial-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.speed-dial-info {
    display: flex;
    flex-direction: column;
}

.speed-dial-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.speed-dial-num {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.speed-dial-star {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 10px;
    color: #FFC107;
}

/* Display area */
.dialer-display-area {
    position: relative;
    margin-bottom: 8px;
}

.dialer-pro-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--border);
    background: none;
    color: var(--text-primary);
    font-size: 32px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    text-align: center;
    outline: none;
    padding: 12px 40px 12px 12px;
    letter-spacing: 3px;
    transition: border-color 0.2s;
}

.dialer-pro-input:focus {
    border-bottom-color: var(--primary);
}

.dialer-pro-input::placeholder {
    color: var(--text-muted);
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0;
}

.dialer-pro-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.dialer-pro-clear:hover { background: var(--danger); color: white; }

/* Results */
.dialer-results-pro {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dialer-result-pro {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.dialer-result-pro:hover {
    background: var(--bg-surface-hover);
    transform: translateX(3px);
}

.result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.result-body { flex: 1; min-width: 0; }

.result-name-pro {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta-pro {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1px;
}

.result-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 6px;
}

.result-tag.colleague {
    background: rgba(76,175,80,0.12);
    color: #4CAF50;
}

.result-company {
    font-style: italic;
    color: var(--text-muted);
}

.result-call-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(76,175,80,0.12);
    color: #4CAF50;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.result-call-btn:hover {
    background: #4CAF50;
    color: white;
    transform: scale(1.1);
}

/* Keypad pro */
.keypad-pro {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 12px 8px;
    flex: 1;
    align-content: center;
    max-width: 320px;
    margin: 0 auto;
    width: 100%;
}

.key-pro {
    position: relative;
    aspect-ratio: 1.2;
    border: none;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    user-select: none;
    overflow: hidden;
    transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

.key-pro:hover {
    background: var(--bg-surface-hover);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: scale(1.05);
}

.key-pro:active, .key-pro.pressed {
    transform: scale(0.92);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(229,57,53,0.2);
}

.key-pro.pressed .key-pro-letters {
    color: rgba(255,255,255,0.7);
}

.key-pro-digit {
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.5px;
}

.key-pro-letters {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 2.5px;
    margin-top: 3px;
    transition: color 0.12s;
}

/* Ripple effect placeholder */
.key-pro-ripple {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
}

/* Bottom bar */
.dialer-pro-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 12px 0 8px;
}

.dialer-pro-action {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.dialer-pro-action:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.dialer-pro-action:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.dialer-pro-call {
    width: 68px;
    height: 68px;
    border: none;
    border-radius: 50%;
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dialer-pro-call.active {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(76,175,80,0.4);
    animation: call-btn-glow 2s ease-in-out infinite;
}

.dialer-pro-call.active:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(76,175,80,0.5);
}

.dialer-pro-call:disabled { opacity: 0.4; }

@keyframes call-btn-glow {
    0%, 100% { box-shadow: 0 6px 24px rgba(76,175,80,0.4); }
    50% { box-shadow: 0 6px 24px rgba(76,175,80,0.6), 0 0 0 6px rgba(76,175,80,0.1); }
}

/* Legacy compat */
.call-btn { color: var(--success) !important; }

/* === HISTORY === */
.history-list {
    display: flex;
    flex-direction: column;
}

.history-date-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 12px 12px 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-height: 80px;
}

.history-item:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border);
    transform: translateX(3px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}
.history-item.selected {
    background: var(--bg-surface-active);
    border-color: var(--primary);
}

.history-direction {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--bg-surface-hover);
}

.history-item.incoming .history-direction { color: #4CAF50; background: rgba(76,175,80,0.1); }
.history-item.outgoing .history-direction { color: var(--primary); background: rgba(229,57,53,0.08); }
.history-item.missed .history-direction { color: #F44336; background: rgba(244,67,54,0.1); }

.history-info { flex: 1; min-width: 0; }
.history-name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-number { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }
.history-meta { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.history-right { text-align: right; flex-shrink: 0; }
.history-time { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.history-duration { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.load-more-btn {
    display: block;
    margin: 12px auto;
    padding: 8px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.load-more-btn:hover { background: var(--bg-surface-hover); }

/* === AFTER-CALL WORK === */
.after-call-work {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.after-call-work h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.acw-notes {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
    outline: none;
}

.acw-notes:focus { border-color: var(--primary); }

.acw-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: rgba(229,57,53,0.1);
    color: var(--primary);
}

.tag button {
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    display: flex;
}

.acw-tag-input {
    display: flex;
    gap: 4px;
}

.acw-tag-input input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
}

.call-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-surface-hover);
    margin-bottom: 12px;
}

.call-detail-header.incoming { color: var(--success); }
.call-detail-header.outgoing { color: var(--primary); }
.call-detail-header.missed { color: var(--danger); }

.call-detail-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.call-detail-number { font-size: 12px; color: var(--text-muted); }

.call-detail-meta {
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

/* === CONTACTS - TILES === */
.contact-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.contact-tile {
    width: 160px;
    min-height: 160px;
    border-radius: 14px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 10px 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.contact-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: transparent;
}

.contact-tile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

.contact-tile:hover .contact-tile-avatar { transform: scale(1.06); }

.contact-tile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    max-width: 144px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

.contact-tile-company {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
    max-width: 144px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-tile-phone {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.contact-tile-job {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
    max-width: 144px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reuse tile-actions and tile-star from colleague tiles */

/* === CONTACTS - LIST VIEW === */
.contact-list-view {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.contact-list-item:hover {
    background: var(--bg-surface-hover);
    transform: translateX(2px);
}

.contact-list-info { flex: 1; min-width: 0; }

.contact-list-name {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.contact-list-star {
    color: #FFC107;
    font-size: 12px;
}

.contact-list-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

.contact-list-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.contact-list-item:hover .contact-list-actions { opacity: 1; }

/* === CONTACTS - GROUPS === */
.contact-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-group {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
}

.contact-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.contact-group-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.contact-letter-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

/* === CONTACTS - SORT BUTTONS === */
.contact-sort-btn {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.contact-sort-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.contact-sort-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* === CONTACTS - FAVORITES STRIP === */
.contact-favs-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.contact-favs-label {
    font-size: 12px;
    font-weight: 700;
    color: #FFC107;
    white-space: nowrap;
    flex-shrink: 0;
}

.contact-favs-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex: 1;
}

.contact-favs-scroll::-webkit-scrollbar { height: 3px; }
.contact-favs-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.contact-fav-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}

.contact-fav-chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.contact-fav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.contact-fav-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.contact-fav-call {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(76,175,80,0.15);
    color: #4CAF50;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.contact-fav-call:hover {
    background: #4CAF50;
    color: white;
}

/* Legacy compat */
.contact-list { display: flex; flex-direction: column; }

.contact-letter-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    padding: 8px 12px 4px;
    position: sticky;
    top: 0;
    background: var(--bg-app);
    z-index: 5;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}

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

.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 13px; font-weight: 500; }
.contact-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; }

/* === CHAT === */
.chat-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.chat-header-name { font-size: 15px; font-weight: 600; }
.chat-header-meta { font-size: 11px; color: var(--text-muted); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.chat-bubble-row {
    display: flex;
    gap: 8px;
    max-width: 85%;
    width: fit-content;
    align-self: flex-start;
}

.chat-bubble-row.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    align-self: flex-end;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.chat-avatar-spacer { width: 44px; flex-shrink: 0; }

.chat-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-width: 80px;
    max-width: 100%;
    flex: 1 1 auto;
    white-space: normal;
    word-wrap: break-word;
}

.chat-bubble.sent {
    background: linear-gradient(135deg, var(--primary), #C62828);
    color: white;
    border-bottom-right-radius: 8px;
}

.chat-bubble.received {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 8px;
}

.chat-bubble.pending { opacity: 0.6; }

.chat-sender {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.chat-text { word-break: break-word; }

.chat-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
    text-align: right;
}

.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 120px;
}

.chat-input:focus { border-color: var(--primary); }

.chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* === CONVERSATION LIST === */
.conversation-list { display: flex; flex-direction: column; gap: 4px; }

.conversation-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-height: 90px;
}

.conversation-item:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateX(3px);
}
.conversation-item.unread {
    font-weight: 600;
    background: rgba(229,57,53,0.04);
    border-color: rgba(229,57,53,0.15);
}
.conversation-item.active {
    background: var(--bg-surface-active);
    border-color: var(--primary);
}

.conv-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last-msg { font-size: 15px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.conv-right { text-align: right; flex-shrink: 0; }
.conv-time { font-size: 13px; color: var(--text-muted); }

.conv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 700;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(229,57,53,0.35);
}

.new-chat-list {
    max-height: 400px;
    overflow-y: auto;
}

.new-chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 60px;
}

.new-chat-item:hover { background: var(--bg-surface-hover); transform: translateX(2px); }
.new-chat-item.selected { background: rgba(229,57,53,0.1); border: 1px solid rgba(229,57,53,0.3); }
.new-chat-ext { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* === MODAL (Preact) === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 12px;
    width: 480px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* === FORMS === */
.form-field {
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--primary);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-field { flex: 1; }

.form-inline {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.form-inline input, .form-inline select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
}

.form-inline select { width: 90px; }
.form-inline input { flex: 1; }

.form-section {
    margin-bottom: 16px;
}

.form-section label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* === IMPORT === */
.import-preview {
    margin-top: 12px;
}

.import-preview h4 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.import-table {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.import-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.import-table th {
    background: var(--bg-surface-hover);
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.import-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
}

.import-result {
    margin-top: 12px;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
}

.import-result.success { background: rgba(76,175,80,0.1); color: var(--success); }
.import-result.error { background: rgba(244,67,54,0.1); color: var(--danger); }

/* === SETTINGS === */
.settings-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child { border-bottom: none; }

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.settings-avatar-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.settings-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-label {
    cursor: pointer;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.settings-label { font-size: 13px; color: var(--text-secondary); }
.settings-value { font-size: 13px; font-weight: 500; }

.settings-logo-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.company-logo-preview {
    max-width: 200px;
    max-height: 60px;
    object-fit: contain;
    border-radius: 4px;
}

.company-logo-placeholder {
    width: 200px;
    height: 60px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
}

.theme-selector {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.theme-option:hover { border-color: var(--text-muted); }
.theme-option.active { border-color: var(--primary); color: var(--primary); }

/* Language selector */
.language-selector {
    display: flex;
    gap: 8px;
}

.language-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.language-option:hover { border-color: var(--text-muted); }
.language-option.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }

.language-flag {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--text-muted);
    border-radius: 22px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.settings-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Call behavior settings */
.call-behavior-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.call-behavior-card {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.call-behavior-card:hover {
    border-color: var(--text-muted);
}

.call-behavior-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-surface-hover);
    font-size: 13px;
    font-weight: 600;
}

.call-behavior-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.call-behavior-title {
    flex: 1;
}

.call-behavior-body {
    padding: 10px 14px;
}

.call-behavior-body select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

.call-behavior-body select:focus {
    border-color: var(--primary);
}

.call-behavior-body input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
}

.call-behavior-body input:focus {
    border-color: var(--primary);
}

/* === TRANSFER MODAL === */
.transfer-modal {
    width: 440px;
}

.transfer-summary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.transfer-from, .transfer-to {
    flex: 1;
}

.transfer-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.transfer-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border);
}

.transfer-card-name {
    font-size: 14px;
    font-weight: 600;
}

.transfer-card-num {
    font-size: 11px;
    color: var(--text-muted);
}

.transfer-hold-badge {
    font-size: 10px;
    font-weight: 700;
    color: #FF9800;
    background: rgba(255,152,0,0.1);
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: auto;
    white-space: nowrap;
    animation: hold-blink 1.5s ease-in-out infinite;
}

@keyframes hold-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.transfer-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 28px;
    color: var(--success);
    flex-shrink: 0;
}

.transfer-context {
    margin-bottom: 8px;
}

.transfer-context label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.transfer-message {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    background: var(--bg-app);
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.transfer-message:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}

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

.transfer-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Transfer type bar */
.transfer-type-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}

.transfer-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.transfer-type-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.transfer-type-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(229,57,53,0.25);
}

.transfer-type-btn.whisper-btn.active {
    background: #9C27B0;
    box-shadow: 0 2px 6px rgba(156,39,176,0.25);
}

/* Transfer quick tags */
.transfer-tags {
    margin-bottom: 12px;
}

.transfer-tags-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.transfer-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.transfer-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid var(--border);
    border-radius: 16px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.transfer-tag:hover {
    border-color: var(--text-muted);
    transform: scale(1.03);
}

.transfer-tag.active {
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Transfer card busy state */
.transfer-card.busy {
    border-color: #F44336;
    background: rgba(244,67,54,0.04);
}

.transfer-busy-badge {
    font-size: 10px;
    font-weight: 700;
    color: #F44336;
    background: rgba(244,67,54,0.1);
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: auto;
    white-space: nowrap;
}

/* Queue info */
.transfer-queue-info {
    background: rgba(33,150,243,0.05);
    border: 1px solid rgba(33,150,243,0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.queue-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.queue-status strong {
    color: #2196F3;
    font-size: 16px;
}

.queue-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.queue-btn {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.callback-confirm {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #4CAF50;
    font-weight: 600;
    padding: 8px 10px;
    background: rgba(76,175,80,0.08);
    border-radius: 8px;
    animation: fadeIn 0.3s;
}

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

/* Whisper indicator */
.whisper-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(156,39,176,0.06);
    border: 1px solid rgba(156,39,176,0.2);
    border-radius: 10px;
    font-size: 12px;
    color: #9C27B0;
    font-weight: 500;
    margin-top: 8px;
}

.whisper-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9C27B0;
    animation: whisper-pulse 1.2s ease-in-out infinite;
}

@keyframes whisper-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(156,39,176,0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(156,39,176,0); }
}

/* Missed calls badge in sidebar */
.rail-missed-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(244,67,54,0.05);
    border: 1px solid rgba(244,67,54,0.15);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 4px;
}

.rail-missed-tile:hover {
    background: rgba(244,67,54,0.1);
    transform: translateX(2px);
}

.rail-missed-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(244,67,54,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #F44336;
    flex-shrink: 0;
}

.rail-missed-info {
    flex: 1;
    min-width: 0;
}

.rail-missed-count {
    font-size: 14px;
    font-weight: 700;
    color: #F44336;
}

.rail-missed-label {
    font-size: 9px;
    color: var(--text-muted);
}

/* === SCHEDULE (Manager) === */
.schedule-day {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.schedule-day:last-child { border-bottom: none; }

.schedule-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.schedule-times {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    margin-left: 50px;
    font-size: 12px;
    color: var(--text-secondary);
}

.schedule-times input[type="time"] {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 12px;
    background: var(--bg-app);
    color: var(--text-primary);
}

/* === LOADING === */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* === RAIL STYLES (for Preact nav) === */
.rail-top {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.rail-sections {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
    margin: 4px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.rail-sections::-webkit-scrollbar { width: 3px; }
.rail-sections::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.rail-section {
    padding: 6px 4px;
}

.rail-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 0 6px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rail-section-badge {
    font-size: 10px;
    font-weight: 700;
    background: var(--primary);
    color: white;
    padding: 0 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
}

/* Function buttons grid */
.rail-func-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.rail-func-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 52px;
}

.rail-func-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-muted);
    transform: scale(1.02);
}

.rail-func-btn.active {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-weight: 600;
    transform: scale(1.02);
}

.rail-func-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Favorites in sidebar */
.rail-favorites {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.rail-fav-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.rail-fav-tile:hover {
    background: var(--bg-surface-hover);
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(76,175,80,0.15);
    transform: translateY(-1px);
}

.rail-fav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.rail-fav-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.rail-fav-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 72px;
    text-align: center;
}

.rail-fav-ext {
    font-size: 9px;
    color: var(--text-muted);
}

.rail-fav-incall {
    font-size: 8px;
    color: #FF9800;
    font-weight: 600;
    max-width: 72px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Voicemails in sidebar */
.rail-voicemails {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rail-vm-tile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.rail-vm-tile:hover {
    background: var(--bg-surface-hover);
    transform: translateX(2px);
}

.rail-vm-tile.unread {
    background: rgba(229,57,53,0.04);
    border-color: rgba(229,57,53,0.2);
}

.rail-vm-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.rail-vm-info {
    flex: 1;
    min-width: 0;
}

.rail-vm-name {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-vm-meta {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-vm-new {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(229,57,53,0.4);
}

.rail-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    flex-shrink: 0;
}

.rail-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: var(--primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* === VOICEMAIL VIEW === */
.voicemail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.voicemail-item:hover { background: var(--bg-surface-hover); }
.voicemail-item.selected { background: var(--bg-rail-active); }

.voicemail-item.unread {
    background: rgba(229,57,53,0.03);
}

.voicemail-item.unread .voicemail-name {
    font-weight: 700;
}

.voicemail-info { flex: 1; min-width: 0; }

.voicemail-name {
    font-size: 14px;
    font-weight: 500;
}

.voicemail-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.voicemail-right {
    text-align: right;
    flex-shrink: 0;
}

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

.voicemail-duration {
    font-size: 11px;
    color: var(--text-secondary);
}

.voicemail-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(229,57,53,0.4);
}

/* Voicemail Player */
.vm-player {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
}

.vm-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    transition: all 0.15s;
}

.vm-play-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(229,57,53,0.3); }
.vm-play-btn.playing { background: #FF9800; }

.vm-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    margin: 8px 0;
}

.vm-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

.vm-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.vm-time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.vm-transcription {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-surface-hover);
    border-radius: 10px;
    border-left: 3px solid var(--primary);
}

.vm-transcription h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.vm-transcription-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

.vm-caller-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.vm-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* === TIMELINE (Contact panel) === */
.panel-timeline {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.timeline-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.timeline-tab {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.timeline-tab:hover { background: var(--bg-surface-hover); }

.timeline-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 12px;
}

.timeline-item:hover { background: var(--bg-surface-hover); }

.timeline-item.unread {
    background: rgba(229,57,53,0.04);
    font-weight: 600;
}

.timeline-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-surface-hover);
}

.timeline-item.incoming .timeline-icon { color: #4CAF50; }
.timeline-item.outgoing .timeline-icon { color: #2196F3; }
.timeline-item.missed .timeline-icon { color: #F44336; }

.timeline-info { flex: 1; min-width: 0; }

.timeline-label {
    font-size: 12px;
    font-weight: 500;
}

.timeline-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.timeline-transcription {
    font-size: 10px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 8px;
}

.timeline-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* === VOICE NOTES (Chat) === */
.voice-record-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.voice-record-btn:hover {
    background: rgba(229,57,53,0.08);
    color: var(--primary);
}

.voice-recording {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 4px 8px;
}

.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #F44336;
    animation: rec-pulse 1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes rec-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244,67,54,0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(244,67,54,0); }
}

.recording-time {
    font-size: 14px;
    font-weight: 600;
    color: #F44336;
    font-variant-numeric: tabular-nums;
}

.recording-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.wave-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--primary);
    min-height: 3px;
}

.wave-bar.animate {
    animation: wave-anim 0.6s ease-in-out infinite alternate;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.08s; }
.wave-bar:nth-child(3) { animation-delay: 0.16s; }
.wave-bar:nth-child(4) { animation-delay: 0.24s; }
.wave-bar:nth-child(5) { animation-delay: 0.32s; }
.wave-bar:nth-child(6) { animation-delay: 0.40s; }
.wave-bar:nth-child(7) { animation-delay: 0.48s; }
.wave-bar:nth-child(8) { animation-delay: 0.56s; }

@keyframes wave-anim {
    0% { height: 4px; }
    100% { height: 18px; }
}

.voice-stop-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F44336;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-note-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 4px 8px;
}

.voice-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-play-btn.playing { background: #FF9800; }

.voice-wave-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.voice-duration {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.voice-cancel-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice message bubble */
.voice-message-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(229,57,53,0.06);
    border-radius: 12px;
    min-width: 180px;
    cursor: pointer;
}

.voice-msg-play {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-msg-waves {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.voice-msg-duration {
    font-size: 11px;
    color: var(--text-muted);
}

/* === EMOJI PICKER === */
.emoji-container {
    position: relative;
    flex-shrink: 0;
}

.emoji-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.emoji-toggle-btn:hover {
    background: var(--bg-surface-hover);
    transform: scale(1.1);
}

.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 310px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 10px;
    z-index: 100;
    margin-bottom: 8px;
}

.emoji-picker-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 4px 8px;
}

.emoji-row {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
}

.emoji-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    padding: 0;
}

.emoji-btn:hover {
    background: var(--bg-surface-hover);
    transform: scale(1.2);
}

/* === TRANSFER HISTORY (CDR) === */
.history-transfer-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #4CAF50;
    background: rgba(76,175,80,0.08);
    padding: 2px 6px;
    border-radius: 6px;
    margin-top: 2px;
}

.transfer-history-detail {
    background: var(--bg-surface-hover);
    border-radius: 10px;
    padding: 12px;
    margin: 12px 0;
    border-left: 3px solid #4CAF50;
}

.transfer-history-detail h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4CAF50;
    margin-bottom: 8px;
}

.transfer-history-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.transfer-history-msg {
    font-style: italic;
    color: var(--text-primary);
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--bg-app);
    border-radius: 8px;
    font-size: 12px;
}

.transfer-history-tags {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.transfer-tag-mini {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(76,175,80,0.1);
    color: #4CAF50;
    font-weight: 600;
}

/* === SOUND SETTINGS === */
.sound-section {
    margin-bottom: 20px;
}

.sound-section h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.sound-mode-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.sound-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.sound-mode-tab:hover { background: var(--bg-surface-hover); }

.sound-mode-tab.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.sound-recorder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.sound-recorder canvas {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    background: var(--bg-app);
}

.sound-player {
    width: 100%;
    margin-top: 8px;
}

.sound-player audio {
    width: 100%;
    height: 36px;
    border-radius: 8px;
}

.sound-tts-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sound-tts-form textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 13px;
    background: var(--bg-app);
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    outline: none;
    min-height: 80px;
}

.sound-tts-form textarea:focus {
    border-color: var(--primary);
}

.sound-tts-form select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.sound-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-surface-hover);
    border-radius: 10px;
    margin-top: 8px;
}

.ringtone-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ringtone-row select {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.volume-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.volume-slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.volume-label {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* === KEYBOARD SHORTCUTS HINTS === */
.shortcuts-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.shortcut-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 10px;
    color: var(--text-muted);
}

.shortcut-key {
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
}

/* === MOBILE RESPONSIVE (Preact shell) === */
@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 60px;
    }

    .app-shell.has-call {
        grid-template-rows: 1fr auto 60px;
    }

    .rail {
        grid-row: 2;
        flex-direction: row;
        width: 100%;
        height: 60px;
        border-right: none;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        padding: 4px 0;
        align-items: center;
    }

    .rail-top {
        flex-direction: row;
        gap: 0;
        justify-content: space-around;
        width: 100%;
    }

    .rail-bottom { display: none; }
    .rail-sections { display: none; }
    .rail-label { display: none; }
    .top-bar-user-info { display: none; }
    .top-bar-status-label { display: none; }

    .rail-item {
        width: 50px;
        height: 50px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }

    .panel {
        width: 100%;
        left: 0;
    }

    .call-panel {
        width: 280px;
    }

    .fab {
        bottom: 72px;
        right: 16px;
        width: 48px;
        height: 48px;
    }

    .view-content {
        max-width: 100%;
    }
}

/* =========================================================================
   DASHBOARD - KPI Cards, Charts, Agent Performance
   ========================================================================= */

.dashboard-tabs { display: flex; gap: 8px; }

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.2s;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.kpi-icon { flex-shrink: 0; }
.kpi-value { font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.kpi-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.dashboard-direction {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.direction-item { display: flex; align-items: center; gap: 10px; }
.direction-icon { font-size: 20px; }
.direction-value { font-size: 20px; font-weight: 700; }
.direction-label { font-size: 11px; color: var(--text-secondary); }

.dashboard-chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    position: relative;
    height: 280px;
}

.dashboard-agents {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.dashboard-agents h3 { margin: 0 0 12px 0; font-size: 15px; }

.agents-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.agents-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--text-secondary); }
.agents-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.agents-table tr:last-child td { border-bottom: none; }
.agent-cell { display: flex; align-items: center; gap: 8px; }
.text-success { color: #43A047; }
.text-danger { color: #E53935; }

.rate-badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.rate-good { background: rgba(67,160,71,0.12); color: #43A047; }
.rate-warn { background: rgba(251,140,0,0.12); color: #FB8C00; }
.rate-bad { background: rgba(229,57,53,0.12); color: #E53935; }

/* =========================================================================
   QUEUE WALLBOARD
   ========================================================================= */

.queue-wallboard { animation: fadeIn 0.3s ease; }

.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.queue-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.queue-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }
.queue-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(33,150,243,0.2); }
.queue-card.has-callers { border-left: 3px solid #E53935; }

.queue-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.queue-card-name { font-weight: 600; font-size: 14px; text-transform: capitalize; }
.queue-card-sla {
    font-size: 11px;
    font-weight: 600;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
}

.queue-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}
.queue-stat-value { display: block; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.queue-stat-label { display: block; font-size: 10px; color: var(--text-secondary); text-transform: uppercase; }

.queue-sla-bar {
    margin-top: 10px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.queue-sla-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.queue-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}
.queue-detail h3 { margin: 0 0 16px 0; font-size: 16px; text-transform: capitalize; }

.queue-section { margin-bottom: 16px; }
.queue-section h4 { margin: 0 0 8px 0; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }

.queue-callers { display: flex; flex-direction: column; gap: 6px; }
.queue-caller-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(229,57,53,0.04);
    border: 1px solid rgba(229,57,53,0.1);
    border-radius: 8px;
}
.queue-caller-pos { font-weight: 700; color: #E53935; font-size: 14px; min-width: 24px; }
.queue-caller-info { flex: 1; }
.queue-caller-name { font-weight: 600; font-size: 13px; }
.queue-caller-num { font-size: 11px; color: var(--text-secondary); }
.queue-caller-wait { font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.queue-caller-wait.long-wait { color: #E53935; }

.btn-warn { background: #FB8C00; color: white; }
.btn-warn:hover { opacity: 0.9; }

/* === RECORDINGS VIEW === */
.recordings-view { display: flex; flex-direction: column; height: 100%; }

.recordings-filters {
    display: flex; gap: 8px; padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.recordings-filters .search-box {
    flex: 1; min-width: 180px;
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 6px 10px;
}
.recordings-filters .search-box input {
    border: none; background: none; outline: none; flex: 1;
    font-size: 13px; color: var(--text-primary);
}
.recordings-filters .date-filters {
    display: flex; gap: 4px; align-items: center;
}
.recordings-filters .date-filters input[type="date"] {
    padding: 5px 8px; border: 1px solid var(--border-color); border-radius: 6px;
    background: var(--bg-input); color: var(--text-primary); font-size: 12px;
}

.recordings-list {
    flex: 1; overflow-y: auto; padding: 0;
}

.recording-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-bottom: 1px solid var(--border-color);
    cursor: pointer; transition: background 0.15s;
}
.recording-item:hover { background: var(--bg-hover); }
.recording-item.selected { background: var(--bg-active); }
.recording-item.playing .recording-icon { color: #4CAF50; animation: pulse 1.5s infinite; }

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

.recording-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-hover); display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); flex-shrink: 0;
}

.recording-info { flex: 1; min-width: 0; }
.recording-parties {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600;
}
.recording-caller { color: var(--text-primary); }
.recording-callee { color: var(--text-primary); }
.recording-meta {
    display: flex; gap: 8px; margin-top: 2px;
    font-size: 11px; color: var(--text-secondary);
}
.recording-format {
    background: var(--bg-hover); padding: 1px 4px; border-radius: 3px;
    font-size: 10px; font-weight: 600;
}
.recording-stt {
    background: #E3F2FD; color: #1565C0; padding: 1px 4px; border-radius: 3px;
    font-size: 10px; font-weight: 600;
}

.recording-actions {
    display: flex; gap: 4px; flex-shrink: 0;
}
.recording-actions .btn-icon {
    width: 32px; height: 32px; border: none; border-radius: 6px;
    background: var(--bg-hover); color: var(--text-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.recording-actions .btn-icon:hover { background: var(--accent-color); color: white; }
.recording-actions .btn-icon.active { background: #4CAF50; color: white; }
.recording-actions .btn-icon.btn-danger:hover { background: #E53935; color: white; }

.recording-transcription {
    padding: 8px 16px 12px 62px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}
.transcription-header {
    font-size: 11px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 4px; display: flex; align-items: center; gap: 4px;
}
.recording-transcription p {
    font-size: 12px; color: var(--text-primary); line-height: 1.5;
    white-space: pre-wrap;
}

.recordings-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 8px; border-top: 1px solid var(--border-color);
}
.btn-page {
    width: 32px; height: 32px; border: 1px solid var(--border-color); border-radius: 6px;
    background: var(--bg-input); color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.btn-page:disabled { opacity: 0.3; cursor: default; }
.page-info { font-size: 12px; color: var(--text-secondary); }

.recording-player {
    padding: 6px 16px; border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.badge-count {
    background: var(--accent-color); color: white; border-radius: 10px;
    padding: 1px 7px; font-size: 11px; font-weight: 600; margin-left: 6px;
}

/* === OPERATOR CONSOLE === */
.operator-console { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.operator-stats {
    display: flex; gap: 12px; padding: 10px 16px;
    background: var(--bg-primary); border-bottom: 1px solid var(--border-color);
}
.stat-item {
    display: flex; flex-direction: column; align-items: center; padding: 6px 16px;
    border-radius: 8px; min-width: 80px;
}
.stat-active { background: rgba(244, 67, 54, 0.1); }
.stat-waiting { background: rgba(255, 152, 0, 0.1); }
.stat-parked { background: rgba(33, 150, 243, 0.1); }
.stat-missed { background: rgba(156, 39, 176, 0.1); }
.stat-num { font-size: 22px; font-weight: 700; line-height: 1; }
.stat-active .stat-num { color: #F44336; }
.stat-waiting .stat-num { color: #FF9800; }
.stat-parked .stat-num { color: #2196F3; }
.stat-missed .stat-num { color: #9C27B0; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.operator-panels { display: flex; flex: 1; overflow: hidden; gap: 1px; background: var(--border-color); }
.operator-panel {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-primary);
}
.panel-extensions { flex: 0 0 260px; }
.panel-calls { flex: 1; }
.panel-queue { flex: 0 0 240px; }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-bottom: 1px solid var(--border-color);
}
.panel-header h3 { font-size: 14px; font-weight: 600; }
.btn-refresh {
    padding: 4px; border: none; background: transparent; cursor: pointer;
    color: var(--text-secondary); border-radius: 4px;
}
.btn-refresh:hover { background: var(--bg-secondary); }

.operator-search {
    width: 100%; padding: 6px 10px; border: 1px solid var(--border-color);
    border-radius: 6px; font-size: 12px; margin-top: 6px; outline: none;
    background: var(--bg-secondary);
}
.operator-search:focus { border-color: var(--accent-color); }

/* Extensions list */
.extensions-list { overflow-y: auto; flex: 1; }
.ext-group-header {
    padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--text-secondary);
    background: var(--bg-secondary); text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 1;
}
.ext-group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ext-tile {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    cursor: pointer; transition: background 0.15s;
}
.ext-tile:hover { background: var(--bg-secondary); }
.ext-tile.drag-over { background: rgba(33, 150, 243, 0.15); outline: 2px dashed #2196F3; }
.ext-avatar {
    width: 32px; height: 32px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; color: white;
    font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.ext-info { flex: 1; min-width: 0; }
.ext-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ext-num { font-size: 11px; color: var(--text-secondary); }
.ext-actions { display: flex; gap: 2px; }
.ext-btn {
    padding: 4px; border: none; background: transparent; cursor: pointer;
    color: var(--text-secondary); border-radius: 4px;
}
.ext-btn:hover { background: var(--bg-secondary); color: var(--accent-color); }

/* Active calls */
.calls-list { overflow-y: auto; flex: 1; padding: 8px; }
.call-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: var(--bg-secondary); border-radius: 8px; margin-bottom: 6px;
    cursor: grab; transition: box-shadow 0.15s, transform 0.15s;
}
.call-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.call-card:active { cursor: grabbing; transform: scale(0.98); }
.call-direction { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.call-direction.in { background: rgba(76, 175, 80, 0.15); color: #4CAF50; }
.call-direction.out { background: rgba(33, 150, 243, 0.15); color: #2196F3; }
.call-info { flex: 1; min-width: 0; }
.call-parties { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.call-from, .call-to { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-meta { display: flex; gap: 8px; font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.call-duration { font-family: monospace; }
.call-state { background: rgba(255, 152, 0, 0.15); padding: 0 4px; border-radius: 3px; color: #FF9800; }
.call-actions { display: flex; gap: 4px; }
.call-btn {
    width: 28px; height: 28px; border: none; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s;
}
.btn-transfer { background: rgba(33, 150, 243, 0.15); color: #2196F3; }
.btn-transfer:hover { background: rgba(33, 150, 243, 0.3); }
.btn-park { background: rgba(255, 152, 0, 0.15); color: #FF9800; }
.btn-park:hover { background: rgba(255, 152, 0, 0.3); }
.btn-hangup { background: rgba(244, 67, 54, 0.15); color: #F44336; }
.btn-hangup:hover { background: rgba(244, 67, 54, 0.3); }
.btn-pickup { background: rgba(76, 175, 80, 0.15); color: #4CAF50; }
.btn-pickup:hover { background: rgba(76, 175, 80, 0.3); }

/* Parking */
.parking-section { margin-top: 12px; }
.parking-header {
    padding: 6px 12px; font-size: 11px; font-weight: 600; color: #2196F3;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.parking-slot {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(33, 150, 243, 0.05); border-radius: 6px; margin-bottom: 4px;
    cursor: pointer; border: 1px dashed rgba(33, 150, 243, 0.3);
}
.parking-slot:hover { background: rgba(33, 150, 243, 0.1); }
.parking-num { font-family: monospace; font-weight: 600; color: #2196F3; }
.parking-info { flex: 1; }
.parking-time { font-size: 11px; color: var(--text-secondary); font-family: monospace; }

/* Queue callers */
.queue-list { overflow-y: auto; flex: 1; padding: 8px; }
.queue-card {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: var(--bg-secondary); border-radius: 6px; margin-bottom: 4px;
}
.queue-position {
    width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 152, 0, 0.15);
    color: #FF9800; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.queue-info { flex: 1; min-width: 0; }
.queue-caller { font-size: 13px; font-weight: 500; }
.queue-meta { display: flex; gap: 6px; font-size: 11px; color: var(--text-secondary); }
.queue-name { background: rgba(255, 152, 0, 0.1); padding: 0 4px; border-radius: 3px; }
.queue-wait { font-family: monospace; }
.queue-actions { display: flex; gap: 2px; }

.empty-state {
    text-align: center; padding: 30px 10px; color: var(--text-secondary);
    font-size: 13px;
}

/* Responsive: stack panels on small screens */
@media (max-width: 768px) {
    .operator-panels { flex-direction: column; }
    .panel-extensions, .panel-queue { flex: 0 0 auto; max-height: 200px; }
    .operator-stats { flex-wrap: wrap; gap: 6px; }
    .stat-item { min-width: 60px; padding: 4px 10px; }
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-row { display: flex; gap: 10px; align-items: center; padding: 8px 12px; }

/* === VIEW TRANSITIONS === */
.main-content > * {
    animation: view-slide-in 0.2s ease-out;
}
@keyframes view-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === KEYBOARD SHORTCUT HINT === */
.shortcut-hint {
    display: inline-block; padding: 1px 5px; border: 1px solid var(--border-color);
    border-radius: 3px; font-size: 10px; color: var(--text-secondary);
    font-family: monospace; background: var(--bg-secondary);
}

/* ===== BLF SETTINGS ===== */
.blf-settings { padding: 16px; }
.blf-header { margin-bottom: 20px; }
.blf-header .view-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.blf-header .view-subtitle { color: #888; font-size: 13px; margin: 0; }

.blf-phone-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.blf-phone-tab { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.15s; }
.blf-phone-tab:hover { border-color: #1976d2; }
.blf-phone-tab.active { background: #1976d2; color: #fff; border-color: #1976d2; }

.blf-phone-info { display: flex; flex-direction: column; gap: 1px; }
.blf-phone-name { font-weight: 600; }
.blf-phone-model { font-size: 11px; color: #888; }
.blf-phone-tab.active .blf-phone-model { color: rgba(255,255,255,0.7); }

.blf-keys-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.blf-keys-info { display: flex; align-items: center; gap: 12px; }
.blf-count { font-size: 13px; font-weight: 600; color: #333; }
.blf-model-info { font-size: 12px; color: #888; }
.blf-progress-bar { width: 100%; height: 4px; background: #e0e0e0; border-radius: 2px; overflow: hidden; }
.blf-progress-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; }
.btn-add-key:disabled { opacity: 0.4; cursor: not-allowed; border-color: #ccc; color: #999; }
.blf-empty-hint { font-size: 12px; color: #aaa; margin-top: 8px; }
.blf-actions { display: flex; gap: 8px; }
.btn-add-key { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid #1976d2; background: #fff; color: #1976d2; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-save-keys { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border: none; background: #1976d2; color: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-save-keys:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-save-keys.saving { background: #90caf9; }

.blf-keys-list { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.blf-empty { padding: 24px; text-align: center; color: #888; font-size: 13px; }

.blf-key-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; background: #fff; transition: background 0.15s; }
.blf-key-row:last-child { border-bottom: none; }
.blf-key-row:hover { background: #f8f9fa; }
.blf-key-row.dragging { opacity: 0.5; background: #e3f2fd; }

.blf-key-grip { cursor: grab; color: #bbb; padding: 2px; }
.blf-key-grip:active { cursor: grabbing; }
.blf-key-num { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: #e3f2fd; border-radius: 50%; font-size: 11px; font-weight: 700; color: #1976d2; flex-shrink: 0; }
.blf-key-type { padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; min-width: 130px; }
.blf-key-value { flex: 1; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; min-width: 140px; }
.blf-key-label { width: 120px; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 12px; }
.blf-key-actions { display: flex; gap: 2px; flex-shrink: 0; }
.blf-btn-move { padding: 2px 4px; border: 1px solid #e0e0e0; background: #fff; border-radius: 3px; cursor: pointer; display: flex; align-items: center; }
.blf-btn-move:disabled { opacity: 0.3; cursor: not-allowed; }
.blf-btn-remove { padding: 2px 6px; border: 1px solid #ef9a9a; background: #fff; color: #c62828; border-radius: 3px; cursor: pointer; display: flex; align-items: center; }

@media (max-width: 600px) {
    .blf-key-row { flex-wrap: wrap; }
    .blf-key-type, .blf-key-value, .blf-key-label { min-width: 100%; }
}
