/* === WhatsApp Web Clone — Dark Theme === */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #0b141a;
    --bg-panel: #111b21;
    --bg-header: #202c33;
    --bg-input: #2a3942;
    --bg-hover: #202c33;
    --bg-active: #2a3942;
    --bg-msg-in: #202c33;
    --bg-msg-out: #005c4b;
    --bg-chat: #0b141a;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-light: #667781;
    --green: var(--brand-color, #00a884);
    --green-dark: #00876a;
    --green-light: #25d366;
    --blue: #53bdeb;
    --border: #222d34;
    --unread: var(--brand-color, #00a884);
    --topbar: var(--brand-color, #00a884);
}

[data-theme="light"] {
    --bg-deep: #f0f2f5;
    --bg-panel: #ffffff;
    --bg-header: #f0f2f5;
    --bg-input: #f0f2f5;
    --bg-hover: #f5f6f6;
    --bg-active: #e9edef;
    --bg-msg-in: #ffffff;
    --bg-msg-out: #d9fdd3;
    --bg-chat: #efeae2;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --text-light: #8696a0;
    --border: #e9edef;
}

html {
    height: 100%;
    background: var(--bg-deep);
}
body {
    min-height: 100%;
    height: 100%;
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* === Login === */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-deep);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

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

.login-header h1 {
    font-size: 20px;
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.login-card {
    background: var(--bg-panel);
    border-radius: 4px;
    padding: 32px;
    width: 360px;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.login-error {
    background: rgba(255,107,107,.15);
    color: #ff6b6b;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
}

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

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

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(134,150,160,0.4);
    background: color-mix(in srgb, var(--bg-input), #fff 3%);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--green);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .5px;
    cursor: pointer;
    transition: background .2s;
}

.login-btn:hover { background: var(--green-dark); }

.login-hint {
    margin-top: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

.login-hint strong { color: var(--text-secondary); }

/* === App Layout === */
.app-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 128px;
    background: var(--topbar);
    flex-shrink: 0;
}

.app-container {
    display: flex;
    flex: 1;
    margin-top: -88px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 1600px;
    height: calc(100vh - 40px);
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
    overflow: hidden;
}

/* === Nav Rail === */
.nav-rail {
    width: 72px;
    min-width: 72px;
    background: #1a2a33;
    border-right: 2px solid #00a884;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    flex-shrink: 0;
    z-index: 2;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Thin scrollbar for nav rail */
#navRail { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
#navRail::-webkit-scrollbar { width: 3px; }
#navRail::-webkit-scrollbar-track { background: transparent; }
#navRail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
#navRail::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
[data-theme="light"] .nav-rail { background: #e8eaed; border-right-color: #00a884; }
.nav-rail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.nav-rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.nav-rail-btn {
    width: 56px;
    padding: 8px 0 4px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #aebac1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: background .15s, color .15s;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .2px;
}
.nav-rail-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}
.nav-rail-btn:hover svg path { fill: var(--text-primary) !important; }
.nav-rail-btn.active {
    background: var(--bg-active);
    color: var(--green);
}
.nav-rail-btn.active svg path { fill: var(--green) !important; }
.nav-rail-sep {
    width: 32px;
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* === Left Panel === */
.left-panel {
    width: 440px;
    min-width: 340px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-header);
    height: 60px;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
}
.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.header-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .2s;
    cursor: pointer;
}

.header-icon:hover { background: rgba(255,255,255,.1); }

/* Search */
.search-container {
    padding: 8px 12px;
    background: var(--bg-panel);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 12px;
    background: var(--bg-input);
    border-radius: 8px;
    height: 36px;
    flex: 1;
    min-width: 0;
}

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

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

.new-chat-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.new-chat-btn:hover { background: var(--bg-active); }


/* Chat List */
.chat-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 14px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    flex-shrink: 0;
}

.chat-avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.chat-avatar.small {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

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

.chat-info-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

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

.chat-time {
    font-size: 12px;
    color: var(--text-light);
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-info-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
}

.msg-check { flex-shrink: 0; }

.unread-badge {
    background: var(--unread);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

.chat-agent-tag {
    font-size: 11px;
    color: var(--green);
    margin-top: 2px;
}

.chat-agent-tag.unassigned { color: #ff9500; }

/* === Right Panel === */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    min-height: 0;
    overflow: hidden;
}

/* Empty state */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-bottom: 6px solid var(--green);
    background: var(--bg-panel);
}

.empty-icon { margin-bottom: 28px; opacity: .6; }

.empty-state h2 {
    font-size: 32px;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Chat area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-header);
    height: 60px;
    flex-shrink: 0;
    gap: 14px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.chat-header-phone {
    font-size: 13px;
    color: var(--text-secondary);
}

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

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

.call-contact-btn:hover {
    background: rgba(255,255,255,.08);
}

.call-contact-btn:hover svg path { fill: #00a884; }

.chat-header-agent {
    font-size: 12px;
    color: var(--green);
    background: rgba(0,168,132,.1);
    padding: 4px 10px;
    border-radius: 4px;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 60px;
    background-color: var(--bg-chat);
    background-image: url('/static/img/chat-bg-doodle.png');
    background-repeat: repeat;
    background-size: 400px;
    background-position: center;
    opacity: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
/* Dark mode: dim the green doodle so it's subtle */
.messages-container { filter: none; position: relative; background-blend-mode: darken; background-color: rgba(11, 20, 26, 0.92); }
/* Light mode: use the light doodle with subtle overlay */
[data-theme="light"] .messages-container {
    background-image: url('/static/img/chat-bg-light.png');
    background-size: 400px;
    background-color: rgba(234, 229, 222, 0.85);
    background-blend-mode: lighten;
}

.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.messages-list { max-width: 800px; margin: 0 auto; }

.msg-date {
    text-align: center;
    margin: 16px 0;
}

.msg-date span {
    background: #182229;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

.message {
    display: flex;
    margin-bottom: 2px;
}

.message.out { justify-content: flex-end; }
.message.in { justify-content: flex-start; }

.msg-bubble {
    max-width: 65%;
    padding: 6px 8px 8px;
    border-radius: 8px;
    position: relative;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.out .msg-bubble {
    background: var(--bg-msg-out);
    border-top-right-radius: 0;
}

.message.in .msg-bubble {
    background: var(--bg-msg-in);
    border-top-left-radius: 0;
}

.message.out.tail .msg-bubble { border-top-right-radius: 0; }
.message.in.tail .msg-bubble { border-top-left-radius: 0; }

.msg-text {
    color: var(--text-primary);
    margin-right: 52px;
}

.msg-meta {
    float: right;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    margin-left: 8px;
    position: relative;
    top: 6px;
}

.msg-time {
    font-size: 11px;
    color: rgba(255,255,255,.45);
}

.msg-status svg { display: block; }

/* Input area */
.input-area {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-header);
    gap: 10px;
    flex-shrink: 0;
    position: relative;
}

.input-box {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    height: 42px;
}

.input-box input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

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

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.send-btn:hover { background: rgba(255,255,255,.08); }

/* Recording — slide to cancel */
.rec-slide-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    height: 42px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-light);
    user-select: none;
    transition: background .15s;
}
.rec-slide-zone:hover { background: var(--bg-input); }
.rec-slide-chevron {
    flex-shrink: 0;
    animation: slideChevron 1.5s ease-in-out infinite;
}
@keyframes slideChevron {
    0%, 100% { transform: translateX(0); opacity: .4; }
    50%      { transform: translateX(-5px); opacity: 1; }
}

/* Recording timer + pulsing mic */
.rec-timer {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
    flex-shrink: 0;
}
.rec-mic-pulse {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
    0%, 100% { background: rgba(239,68,68,.10); }
    50%      { background: rgba(239,68,68,.25); }
}

/* Review send button (green circle) */
.rec-send-btn {
    width: 42px; height: 42px;
    border: none;
    background: var(--green);
    cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.rec-send-btn:hover { background: var(--green-dark); }

/* Review player */
.review-player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 0 12px;
    height: 42px;
}
.review-play-btn {
    width: 32px; height: 32px;
    border: none; background: transparent;
    cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.review-play-btn:hover { background: var(--bg-hover); }
.review-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.review-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.review-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    width: 0%;
    transition: width .1s linear;
}
.review-duration {
    font-size: 12px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    min-width: 30px;
    text-align: right;
}

/* === Metrics & Evaluation === */
.page-nav {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.page-nav-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .5px;
    color: var(--text-primary);
}

.metrics-sidebar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.stat-card {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

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

.stat-value.warn { color: #ff9500; }

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-top: 2px;
}

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

.metrics-agent-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 14px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--border);
}

.metrics-agent-item:hover { background: var(--bg-hover); }
.metrics-agent-item.active { background: var(--bg-active); }

.metrics-panel {
    display: flex;
    flex-direction: column;
}

.metrics-header { flex-shrink: 0; }

.agent-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.metrics-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 2px solid transparent;
    transition: transform .15s, box-shadow .15s;
}

.metric-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.metric-card:nth-child(1) { border-left-color: #00a884; }
.metric-card:nth-child(2) { border-left-color: #53bdeb; }
.metric-card:nth-child(3) { border-left-color: #ff9500; }
.metric-card:nth-child(4) { border-left-color: #ff6b6b; }

.metric-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 14px;
    height: 14px;
}

.metric-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.metric-value small {
    font-size: 10px;
    color: var(--text-secondary);
}

.metric-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
    line-height: 1.2;
}

.metrics-section {
    margin-bottom: 28px;
}

.metrics-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 16px;
}

/* Score bars */
.score-bars { max-width: 400px; }

.score-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.score-label {
    font-size: 13px;
    color: var(--text-secondary);
    width: 28px;
    text-align: right;
}

.score-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width .3s;
}

.score-count {
    font-size: 13px;
    color: var(--text-secondary);
    width: 20px;
}

/* Category grid */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.category-card {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 16px;
}

.category-score {
    font-size: 28px;
    font-weight: 600;
    color: var(--green);
}

.category-name {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 8px;
}

.category-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
}

/* === Evaluation === */
.eval-form {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.eval-form h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 16px;
}

.star-rating {
    display: flex;
    gap: 6px;
}

.star {
    font-size: 28px;
    color: var(--border);
    cursor: pointer;
    transition: color .15s;
}

.star:hover, .star.filled { color: #ffa62b; }
.star.empty { color: var(--border); }

.eval-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--green);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-top: 8px;
}

.eval-submit-btn:hover { background: var(--green-dark); }

.eval-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.eval-card {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}

.eval-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.eval-agent {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.eval-score { display: flex; gap: 2px; }
.eval-score .star { font-size: 14px; cursor: default; }
.eval-score .star.filled { color: #ffa62b; }
.eval-score .star.empty { color: var(--border); }

.eval-category {
    font-size: 11px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 6px;
}

.eval-notes {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.eval-date {
    font-size: 11px;
    color: var(--text-light);
}

/* === Call Analytics === */
.analytics-filters {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: flex-end;
}

.analytics-filters .form-group { flex: 1; margin-bottom: 0; }
.analytics-filters select {
    width: 100%;
    padding: 8px 32px 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238696a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .15s;
}
.analytics-filters select:hover {
    border-color: rgba(134,150,160,0.4);
    background-color: color-mix(in srgb, var(--bg-input), #fff 3%);
}
.analytics-filters select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.1);
}
.analytics-filters label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-light);
    margin-bottom: 5px;
    display: block;
}

.analytics-summary {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.an-card {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.an-card-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.an-card-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-top: 2px;
}

/* Direction split */
.analytics-split {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.an-split-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.an-split-label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 90px;
    flex-shrink: 0;
}

.an-split-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.an-split-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .4s ease;
}

.an-split-fill.user { background: #53bdeb; }
.an-split-fill.biz { background: #00a884; }

.an-split-val {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    width: 50px;
    text-align: right;
    font-family: 'SF Mono', Consolas, monospace;
}

/* Phone list */
.analytics-section-title {
    padding: 10px 16px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.analytics-phone-list {
    overflow-y: auto;
    max-height: 120px;
    border-bottom: 1px solid var(--border);
}

.an-phone-row {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    gap: 8px;
    font-size: 12px;
}

.an-phone-num {
    color: var(--text-primary);
    flex: 1;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
}

.an-phone-stat {
    color: var(--text-secondary);
    font-size: 11px;
}

.an-phone-cost {
    color: var(--green);
    font-weight: 600;
    font-size: 11px;
    font-family: 'SF Mono', Consolas, monospace;
}

/* Charts */
.analytics-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    min-height: 0;
}

.an-chart-wrap {
    margin-bottom: 24px;
}

.an-chart-wrap.compact { margin-bottom: 0; }

.an-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 160px;
    padding: 0 4px;
}

.an-chart.duration { height: 100px; }

.an-bar-group {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    cursor: pointer;
}

.an-bar-group:hover .an-bar-stack,
.an-bar-group:hover .an-bar-single { opacity: .85; }

.an-bar-stack {
    width: 100%;
    max-width: 20px;
    border-radius: 3px 3px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: height .3s ease;
}

.an-bar-seg.user { background: #53bdeb; }
.an-bar-seg.biz { background: #00a884; }

.an-bar-single {
    width: 100%;
    max-width: 16px;
    border-radius: 3px 3px 0 0;
    transition: height .3s ease;
}

.an-bar-single.dur { background: #ff9500; }
.an-bar-single.grp { background: #53bdeb; }

.an-chart-labels {
    display: flex;
    gap: 2px;
    padding: 4px 4px 0;
}

.an-label {
    flex: 1;
    text-align: center;
    font-size: 9px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

.an-section {
    margin-bottom: 24px;
}

.an-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 12px;
}

/* Outcomes */
.an-outcomes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.an-outcome-card {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.an-outcome-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.an-outcome-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.an-outcome-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 8px;
}

.an-outcome-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.an-outcome-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .4s ease;
}

.an-outcome-pct {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

/* Analytics views — scrollable */
.an-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Messaging Costs */
.msg-cost-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.msg-cost-summary-card {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    border-top: 3px solid var(--border);
}

.msg-cost-summary-card.total { border-top-color: #8696a0; }
.msg-cost-summary-card.free { border-top-color: #00a884; }
.msg-cost-summary-card.billable { border-top-color: #ff9500; }
.msg-cost-summary-card.cost { border-top-color: #ff6b6b; }

.msg-cost-summary-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.msg-cost-summary-card.cost .msg-cost-summary-val { color: #ff6b6b; }
.msg-cost-summary-card.free .msg-cost-summary-val { color: #00a884; }

.msg-cost-summary-lbl {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-top: 2px;
}

.msg-cost-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-panel);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.msg-cost-note svg { flex-shrink: 0; margin-top: 1px; }
.msg-cost-note strong { color: #00a884; }

.msg-cost-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.msg-cost-card {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 14px;
}

.msg-cost-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

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

.msg-cost-cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.msg-cost-free-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: #00a884;
    background: rgba(0,168,132,.15);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: .5px;
}

.msg-cost-rate {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

.msg-cost-cat-desc {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.msg-cost-cat-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.msg-cost-cat-stats > div { text-align: center; }

.msg-cost-cat-val {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.msg-cost-cat-val.free { color: #00a884; font-size: 13px; }
.msg-cost-cat-val.paid { color: #ff6b6b; }

.msg-cost-cat-lbl {
    display: block;
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* Peak Hours Heatmap */
.an-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
}

.an-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform .15s;
}

.an-heatmap-cell:hover { transform: scale(1.15); }

.an-hm-count {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,.8);
    font-family: 'SF Mono', Consolas, monospace;
}

.an-heatmap-labels {
    display: flex;
    justify-content: space-between;
    padding-top: 4px;
}

.an-heatmap-labels span {
    font-size: 9px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

/* Call Log */
.log-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 0 12px;
    height: 36px;
    flex: 1;
}

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

.log-search-bar input::placeholder { color: var(--text-light); }

.log-filters {
    display: flex;
    gap: 6px;
    margin-left: 10px;
}

.log-filters select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 7px 30px 7px 10px;
    font-size: 11px;
    font-weight: 500;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238696a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .15s;
}
.log-filters select:hover {
    border-color: rgba(134,150,160,0.4);
}
.log-filters select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.1);
}

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

.log-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background .15s;
}

.log-row:hover { background: var(--bg-hover); }

.log-dir {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    line-height: 0;
}

.log-contact { flex: 2; min-width: 0; }
.log-contact-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.log-contact-phone {
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

.log-agent {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-outcome {
    width: 72px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

.log-duration {
    width: 60px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Consolas, monospace;
    text-align: right;
    flex-shrink: 0;
}

.log-cost {
    width: 52px;
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
    text-align: right;
    flex-shrink: 0;
}

.log-time {
    width: 130px;
    font-size: 11px;
    color: var(--text-light);
    text-align: right;
    flex-shrink: 0;
}

.log-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.log-total {
    font-size: 12px;
    color: var(--text-secondary);
}

.log-pages {
    display: flex;
    gap: 4px;
}

.log-pages button {
    background: var(--bg-input);
    border: none;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
}

.log-pages button:hover { background: var(--bg-active); }
.log-pages button.active {
    background: var(--green);
    color: #fff;
}

/* Group analytics */
.an-group-card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.an-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.an-group-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.an-group-id {
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
    margin-left: auto;
}

.an-group-stats {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.an-group-stat {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.an-gs-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.an-gs-val.grn { color: #00a884; }
.an-gs-val.red { color: #ff6b6b; }

.an-gs-lbl {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.an-empty {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* === Profile Drawer === */
.profile-trigger { cursor: pointer; }

.profile-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    overflow: hidden;
    transition: width .25s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.profile-drawer.open { width: 340px; }

.profile-drawer-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bg-header);
    height: 60px;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: 50%;
    transition: background .15s;
}

.profile-close:hover { background: rgba(255,255,255,.08); }

.profile-drawer-body {
    flex: 1;
    overflow-y: auto;
}

.profile-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 13px;
}

/* Hero */
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 24px;
    background: var(--bg-header);
}

.profile-avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 75px;
    font-weight: 400;
    color: #fff;
    margin-bottom: 14px;
    overflow: hidden;
}

.profile-name {
    font-size: 21px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-phone {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Sections */
.profile-section {
    padding: 14px 20px;
    border-bottom: 8px solid var(--bg-deep);
}

.profile-section-title {
    font-size: 13px;
    color: var(--green);
    margin-bottom: 12px;
}

.profile-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 8px 0;
}

.profile-row svg { flex-shrink: 0; margin-top: 2px; }

.profile-row-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 1px;
}

.profile-row-value {
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-agent-dot,
.profile-perm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Stats grid */
.profile-stats-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.profile-stat {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
}

.profile-stat-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-stat-lbl {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-top: 2px;
}

.profile-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 12px;
}

.profile-meta-row span:first-child { color: var(--text-light); }
.profile-meta-row span:last-child { color: var(--text-secondary); }

/* Right panel needs relative for drawer positioning */
.right-panel { position: relative; }

/* Left panel needs relative for agent drawer */
.left-panel { position: relative; overflow: hidden; }

/* Agent Drawer (slides over left panel like WhatsApp Web) */
.agent-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: var(--bg-panel);
    z-index: 30;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
}

.agent-drawer.open { transform: translateX(0); }

/* Extra profile styles */
.profile-stats-grid.four { grid-template-columns: repeat(4, 1fr); }
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

/* Eval header */
.profile-eval-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.profile-eval-score {
    font-size: 36px;
    font-weight: 700;
    color: var(--green);
    line-height: 1;
}

.profile-eval-score small {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
}

.profile-eval-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Category bars */
.profile-cat-list { display: flex; flex-direction: column; gap: 8px; }

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

.profile-cat-name {
    font-size: 12px;
    color: var(--text-secondary);
    width: 110px;
    flex-shrink: 0;
}

.profile-cat-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.profile-cat-fill {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
    transition: width .4s ease;
}

.profile-cat-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 24px;
    text-align: right;
    font-family: 'SF Mono', Consolas, monospace;
}

/* Permission bar */
.profile-perm-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    gap: 2px;
    margin-bottom: 8px;
}

.profile-perm-seg { border-radius: 4px; }
.profile-perm-seg.permanent { background: #00a884; }
.profile-perm-seg.temporary { background: #ff9500; }
.profile-perm-seg.none { background: #ff6b6b; }

.profile-perm-legend {
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: var(--text-secondary);
}

.profile-perm-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Contact list in agent profile */
.profile-contacts-list {
    max-height: 250px;
    overflow-y: auto;
}

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

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

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

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

.profile-contact-phone {
    font-size: 11px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

.profile-contact-date {
    font-size: 11px;
    color: var(--text-light);
    flex-shrink: 0;
}

/* Profile media section */
.profile-media-count {
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    cursor: pointer;
}

.profile-media-types {
    margin-bottom: 12px;
}

.profile-media-type-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s;
}

.profile-media-type-row:hover { background: var(--bg-hover); }

.profile-media-type-count {
    font-size: 12px;
    color: var(--text-light);
    font-family: 'SF Mono', Consolas, monospace;
}

.profile-media-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.profile-media-thumb {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity .15s;
}

.profile-media-thumb:hover { opacity: .8; }

.profile-media-empty {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    padding: 12px;
}

/* Media Gallery Modal */
.media-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.media-modal {
    background: var(--bg-panel);
    border-radius: 12px;
    width: 700px;
    max-width: 92vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.media-modal-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    gap: 14px;
    flex-shrink: 0;
}

.media-modal-header > span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.media-modal-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
}

.media-modal-tabs button {
    padding: 5px 12px;
    border: none;
    border-radius: 16px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.media-modal-tabs button.active {
    background: var(--green);
    color: #fff;
}

.media-modal-tabs button:hover:not(.active) { background: var(--bg-active); }

.media-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

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

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

/* Gallery grid */
.media-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
}

.media-gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: opacity .15s;
}

.media-gallery-item:hover { opacity: .85; }

.media-gallery-item.image,
.media-gallery-item.video {
    aspect-ratio: 1;
    background: var(--bg-input);
}

.media-gallery-item.image img,
.media-gallery-item.video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-gallery-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.3);
}

.media-gallery-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 8px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,.6));
    font-size: 10px;
    color: rgba(255,255,255,.8);
}

.media-gallery-item.audio .media-gallery-date,
.media-gallery-item.doc .media-gallery-date {
    position: static;
    background: none;
    padding: 0;
    margin-top: 3px;
    color: var(--text-light);
}

.media-gallery-item.audio,
.media-gallery-item.doc {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: 8px;
    aspect-ratio: auto;
}

.media-gallery-file-info { flex: 1; min-width: 0; }

.media-gallery-filename {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.media-gallery-dl {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    flex-shrink: 0;
    transition: background .15s;
}

.media-gallery-dl:hover { background: rgba(255,255,255,.15); }

.media-gallery-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 14px;
}

/* Full preview */
.media-preview-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.media-preview-back {
    padding: 6px 16px;
    background: var(--bg-input);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.media-preview-back:hover { color: var(--text-primary); }

/* Profile edit */
.profile-edit-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.profile-edit-input:focus { border-color: var(--green); }

.profile-color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.profile-color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
}

.profile-color-dot:hover { transform: scale(1.15); }
.profile-color-dot.active { border-color: #fff; }

/* === Call Permissions === */
.perm-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
    white-space: nowrap;
}

.perm-badge:hover { opacity: .85; }

.perm-badge.perm-no-permission {
    background: rgba(255,107,107,.15);
    color: #ff6b6b;
}

.perm-badge.perm-temporary {
    background: rgba(255,149,0,.15);
    color: #ff9500;
}

.perm-badge.perm-permanent {
    background: rgba(0,168,132,.15);
    color: #00a884;
}

/* Permission Panel */
.perm-panel {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    animation: slideDown .2s ease-out;
}

@keyframes slideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 600px; opacity: 1; }
}

.perm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.perm-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

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

.perm-panel-body { padding: 14px 16px; }

.perm-status-row { margin-bottom: 14px; }

.perm-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-input);
}

.perm-status-card.perm-no-permission { border-left: 3px solid #ff6b6b; }
.perm-status-card.perm-temporary { border-left: 3px solid #ff9500; }
.perm-status-card.perm-permanent { border-left: 3px solid #00a884; }

.perm-status-icon { flex-shrink: 0; line-height: 0; }

.perm-status-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.perm-status-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.perm-limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
}

.perm-limit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.perm-limit-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', Consolas, monospace;
}

.perm-actions { margin-bottom: 14px; }

.perm-request-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.perm-request-form textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.perm-request-form textarea:focus { border-color: var(--green); }

.perm-request-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--green);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
    align-self: flex-end;
}

.perm-request-btn:hover { background: var(--green-dark); }
.perm-request-btn:disabled { opacity: .5; cursor: not-allowed; }

.perm-simulate {
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 8px;
}

.perm-simulate-label {
    font-size: 11px;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.perm-simulate-btns {
    display: flex;
    gap: 6px;
}

.perm-sim-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}

.perm-sim-btn:hover { opacity: .85; }
.perm-sim-btn.accept { background: rgba(0,168,132,.2); color: #00a884; }
.perm-sim-btn.accept-perm { background: rgba(83,189,235,.2); color: #53bdeb; }
.perm-sim-btn.reject { background: rgba(255,107,107,.2); color: #ff6b6b; }

/* Permission log */
.perm-log-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 8px;
}

.perm-log-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.perm-log-icon {
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 0;
}

.perm-log-action {
    font-size: 12px;
    color: var(--text-primary);
}

.perm-log-meta {
    font-size: 11px;
    color: var(--text-light);
}

.perm-log-empty {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    padding: 12px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    padding: 4px 0;
    max-width: 800px;
    margin: 0 auto;
}

.typing-bubble {
    background: var(--bg-msg-in);
    border-radius: 8px;
    border-top-left-radius: 0;
    padding: 10px 14px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 16px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8696a0;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Reply context inside bubble */
.msg-reply-context {
    background: rgba(0,0,0,.15);
    border-radius: 6px;
    padding: 6px 10px;
    margin: -2px -4px 4px;
    display: flex;
    gap: 8px;
    cursor: pointer;
    transition: background .15s;
}

.msg-reply-context:hover { background: rgba(0,0,0,.25); }

.msg-reply-bar {
    width: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

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

.msg-reply-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 1px;
}

.msg-reply-text {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reply button on hover */
.message {
    position: relative;
}

/* Message layout: [reply+react] [bubble] [forward] */
.message { display: flex; align-items: center; gap: 4px; }

.msg-side-left, .msg-side-right {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-self: center;
    opacity: 0;
    transition: opacity .15s;
}

.message:hover .msg-side-left,
.message:hover .msg-side-right {
    opacity: 1;
}

.msg-side-btn {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background .12s;
}

.msg-side-btn:hover { background: rgba(255,255,255,.08); }
.msg-side-btn:hover svg path { fill: var(--green); }
.msg-delete-btn:hover svg path { fill: #ef4444; }



/* Reply banner above input */
.reply-banner {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    gap: 10px;
    flex-shrink: 0;
}

.reply-banner-bar {
    width: 3px;
    height: 36px;
    background: var(--green);
    border-radius: 2px;
    flex-shrink: 0;
}

.reply-banner-content { flex: 1; min-width: 0; }

.reply-banner-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
    margin-bottom: 1px;
}

.reply-banner-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-banner-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .15s;
}

.reply-banner-close:hover { background: rgba(255,255,255,.08); }

/* Scroll highlight */
@keyframes msgHighlight {
    0% { background: rgba(0,168,132,.2); }
    100% { background: transparent; }
}

.msg-highlight > .msg-bubble {
    animation: msgHighlight 1.5s ease-out;
}

/* Attach button */
.attach-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}

.attach-btn:hover { background: rgba(255,255,255,.08); }

/* Media in chat bubbles */
.msg-media {
    margin: -2px -4px 4px;
    border-radius: 6px;
    overflow: hidden;
}

.msg-media img {
    display: block;
    max-width: 330px;
    max-height: 300px;
    border-radius: 6px;
    cursor: pointer;
}

.msg-media video {
    display: block;
    max-width: 330px;
    max-height: 260px;
    border-radius: 6px;
}

/* WhatsApp-style voice message */
.msg-voice {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px 0;
    min-width: 280px;
}
.voice-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.message.out .voice-avatar { background: rgba(255,255,255,.12); }
.voice-play-btn {
    width: 34px; height: 34px;
    border: none; background: transparent;
    cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: var(--text-light);
    padding: 0;
}
.message.out .voice-play-btn { color: rgba(255,255,255,.85); }
.voice-track-col {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}
.voice-seekbar {
    position: relative;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.voice-seekbar::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--border);
}
.message.out .voice-seekbar::before { background: rgba(255,255,255,.2); }
.voice-seekbar-fill {
    position: absolute;
    left: 0; top: 50%;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--text-light);
    width: 0%;
    transition: width .08s linear;
}
.message.out .voice-seekbar-fill { background: rgba(255,255,255,.55); }
.voice-seekbar-dot {
    position: absolute;
    top: 50%; left: 0%;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--text-light);
    transform: translate(-50%, -50%);
    transition: left .08s linear;
    z-index: 1;
}
.message.out .voice-seekbar-dot { background: rgba(255,255,255,.85); }
.voice-duration {
    font-size: 11px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    float: left;
    margin-top: 8px;
    margin-left: 7px;
}
.message.out .voice-duration { color: rgba(255,255,255,.55); }

.msg-media.msg-doc {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0,0,0,.15);
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 4px;
    transition: background .15s;
}

.msg-media.msg-doc:hover { background: rgba(0,0,0,.25); }

.msg-doc-info { min-width: 0; }

.msg-doc-name {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.msg-doc-hint {
    font-size: 11px;
    color: var(--text-light);
}

.msg-media.msg-sticker {
    background: transparent;
}

.msg-media.msg-sticker img {
    width: 150px;
    height: 150px;
}

/* System message bubble (permission requests) */
.msg-bubble.msg-system {
    background: rgba(0,168,132,.08) !important;
    border: 1px solid rgba(0,168,132,.2);
    border-radius: 8px !important;
}

/* === Call Settings === */
.settings-nav {
    flex: 1;
    overflow-y: auto;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .15s, color .15s;
}

.settings-nav-item:hover { background: var(--bg-hover); }
.settings-nav-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
    border-left: 3px solid var(--green);
}

.settings-status-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: auto;
}

.settings-status-badge.enabled {
    background: rgba(0,168,132,.15);
    color: #00a884;
}

.settings-status-badge.disabled {
    background: rgba(255,107,107,.15);
    color: #ff6b6b;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.setting-group {
    background: var(--bg-panel);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.setting-info { flex: 1; }

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
}

.setting-hint {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 400;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-switch label {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: var(--bg-input);
    border-radius: 24px;
    transition: background .25s;
}

.toggle-switch label::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .25s;
}

.toggle-switch input:checked + label {
    background: var(--green);
}

.toggle-switch input:checked + label::after {
    transform: translateX(20px);
}

/* Selects in settings */
.settings-content select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 9px 34px 9px 14px;
    font-size: 13px;
    font-weight: 500;
    outline: none;
    min-width: 180px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238696a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .15s;
}
.settings-content select:hover {
    border-color: rgba(134,150,160,0.4);
    background-color: color-mix(in srgb, var(--bg-input), #fff 3%);
}
.settings-content select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.1);
}

.setting-text-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    width: 220px;
}

.setting-text-input.short { width: 100px; }
.setting-text-input:focus { border-color: var(--green); }

/* Country tags */
.country-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    align-items: center;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,168,132,.15);
    color: var(--green);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
}

.tag button {
    background: none;
    border: none;
    color: var(--green);
    font-size: 14px;
    cursor: pointer;
    padding: 0 0 0 2px;
    line-height: 1;
}

.tag-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tag-input-wrap input {
    width: 50px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 12px;
    text-transform: uppercase;
    outline: none;
}

.tag-input-wrap input:focus { border-color: var(--green); }

.tag-add-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: var(--green);
    color: #fff;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hours grid */
.hours-grid { display: flex; flex-direction: column; gap: 8px; }

.hours-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hours-day {
    width: 40px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.hours-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
    width: 120px;
}

.hours-input:focus { border-color: var(--green); }
.hours-sep { font-size: 12px; color: var(--text-light); }

.hours-clear {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.hours-clear:hover { color: #ff6b6b; }

.save-hours-btn {
    margin-top: 14px;
    padding: 10px 24px;
    background: var(--green);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.save-hours-btn:hover { background: var(--green-dark); }

/* Holiday rows */
.holiday-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.holiday-date {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
}

.holiday-date:focus { border-color: var(--green); }

.add-row-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: border-color .2s, color .2s;
    display: block;
    width: 100%;
    text-align: center;
}

.add-row-btn:hover { border-color: var(--green); color: var(--green); }

/* API preview */
.api-endpoint {
    background: var(--bg-input);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
    color: var(--green);
}

.api-preview {
    background: var(--bg-input);
    padding: 16px;
    border-radius: 8px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: auto;
    max-height: 500px;
    white-space: pre;
    margin: 0;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--green);
    color: #fff;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: transform .3s, opacity .3s;
    z-index: 9999;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Webhooks === */
.wh-config {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.wh-config .setting-group { margin-bottom: 10px; }

.wh-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border-radius: 6px;
    padding: 8px 12px;
}

.wh-url-box code {
    flex: 1;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--green);
    word-break: break-all;
}

.wh-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: 4px;
    transition: background .15s;
}

.wh-copy-btn:hover { background: rgba(255,255,255,.08); }

.wh-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wh-field-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.wh-field-check input {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
}

.wh-field-check span {
    font-family: 'SF Mono', Consolas, monospace;
}

.wh-test {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.wh-test-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.wh-test-btns button {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.wh-test-btns button:hover {
    border-color: var(--green);
    color: var(--green);
}

/* Mode toggle */
.wh-mode-toggle {
    display: flex;
    gap: 0;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.wh-mode-toggle button {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s;
}

.wh-mode-toggle button.active {
    background: var(--green);
    color: #fff;
}

.wh-mode-toggle button:first-child { border-right: 1px solid var(--border); }

.wh-demo-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
}

.wh-demo-info svg { flex-shrink: 0; margin-top: 2px; }

.wh-refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    line-height: 0;
    border-radius: 50%;
    transition: background .15s;
}

.wh-refresh-btn:hover { background: rgba(255,255,255,.08); }

/* Event list */
.wh-events {
    flex: 1;
    overflow-y: auto;
}

.wh-event-row {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s;
}

.wh-event-row:hover { background: var(--bg-hover); }

.wh-event-icon { flex-shrink: 0; line-height: 0; }

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

.wh-event-type {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'SF Mono', Consolas, monospace;
}

.wh-event-time {
    font-size: 11px;
    color: var(--text-light);
}

.wh-dir-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: .3px;
    font-family: inherit;
}

.wh-dir-badge.test {
    background: rgba(83,189,235,.15);
    color: #53bdeb;
}

.wh-event-sig {
    font-size: 11px;
    font-weight: 600;
    width: 48px;
    text-align: center;
    flex-shrink: 0;
}

.wh-event-sig.sig-valid { color: #00a884; }
.wh-event-sig.sig-invalid { color: #ff6b6b; }
.wh-event-sig.sig-na { color: var(--text-light); }

.wh-event-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
    font-family: 'SF Mono', Consolas, monospace;
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* Payload Modal */
@keyframes whModalIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes whOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    animation: whOverlayIn .15s ease-out;
    backdrop-filter: blur(2px);
    overflow-y: auto;
    padding: 40px 0;
}

.wh-modal {
    background: var(--bg-panel);
    border-radius: 12px;
    width: 640px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
    animation: whModalIn .2s ease-out;
    margin: auto 0;
}

.wh-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.wh-modal-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background .15s, color .15s;
}

.wh-modal-header button:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.wh-modal-body {
    padding: 16px 18px;
    overflow: auto;
    flex: 1;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre;
    margin: 0;
    background: var(--bg-deep);
    border-radius: 0 0 12px 12px;
}

/* Themed modal form inputs */
.wh-modal .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
}
.wh-modal .form-group textarea:focus { border-color: var(--green); }

.wh-modal .form-group input,
.wh-modal .form-group select {
    border-radius: 10px;
    transition: border-color .2s, box-shadow .2s, background .15s;
}

.wh-modal .login-btn {
    margin-top: 4px;
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: .3px;
    transition: background .15s, transform .1s;
}
.wh-modal .login-btn:active { transform: scale(.98); }

/* === Call Queue === */
.q-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-header);
}

.user-avatar { position: relative; }
.chat-avatar.small { position: relative; }

.queue-header-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #ff6b6b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

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

.q-agent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

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

.q-agent-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.q-agent-call {
    font-size: 11px;
    color: #ff9500;
}

.q-agent-avail {
    font-size: 11px;
    color: var(--text-light);
    text-transform: capitalize;
}

.q-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.q-section { margin-bottom: 20px; }

.q-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 10px;
}

.q-section-count {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-primary);
}

.q-list { display: flex; flex-direction: column; gap: 4px; }

.q-call-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-panel);
    border-radius: 10px;
    border-left: 3px solid transparent;
}

.q-call-row.waiting { border-left-color: #ff9500; }
.q-call-row.active { border-left-color: #00a884; }

.q-call-icon { flex-shrink: 0; line-height: 0; }
.q-call-info { flex: 1; min-width: 0; }

.q-call-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.q-call-phone {
    font-size: 12px;
    color: var(--text-secondary);
}

.q-call-wait {
    font-size: 13px;
    font-weight: 600;
    color: #ff9500;
    font-family: 'SF Mono', Consolas, monospace;
}

.q-call-dur {
    font-size: 13px;
    font-weight: 600;
    color: #00a884;
    font-family: 'SF Mono', Consolas, monospace;
}

/* === Incoming Call UI === */
.call-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.call-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 50px;
    min-width: 300px;
}

.call-card-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 400;
    color: #fff;
    margin-bottom: 20px;
    transition: box-shadow .3s;
}

.call-card-avatar.ring-pulse {
    box-shadow: 0 0 0 15px rgba(0,168,132,.2), 0 0 0 30px rgba(0,168,132,.1);
}

.call-card-name {
    font-size: 24px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.call-card-phone {
    font-size: 14px;
    color: rgba(255,255,255,.6);
    margin-bottom: 8px;
}

.call-card-status {
    font-size: 14px;
    color: rgba(255,255,255,.5);
    margin-bottom: 6px;
}

.call-overlay.ringing .call-card-status {
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

.call-card-timer {
    font-size: 32px;
    font-weight: 300;
    color: #fff;
    font-family: 'SF Mono', Consolas, monospace;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

/* Accept / Reject buttons */
.call-actions {
    display: flex;
    gap: 40px;
    margin-top: 30px;
}

.call-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}

.call-btn:hover { transform: scale(1.1); }
.call-btn.accept { background: #00a884; box-shadow: 0 4px 20px rgba(0,168,132,.4); }
.call-btn.reject { background: #ff6b6b; box-shadow: 0 4px 20px rgba(255,107,107,.4); }
.call-btn.end { background: #ff6b6b; }

/* Active call actions */
.call-active-actions {
    display: flex;
    gap: 24px;
    margin-top: 30px;
    align-items: center;
}

.call-active-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}

.call-active-btn:hover { background: rgba(255,255,255,.25); }
.call-active-btn.active { background: #fff; }
.call-active-btn.active svg path { fill: #111b21; }

/* FAB Menu */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 50;
}

.fab-main {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--green);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,168,132,.4);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    z-index: 2;
}

.fab-main:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,168,132,.5);
}

.fab-icon-close { display: none; }
.fab-container.open .fab-icon-plus { display: none; }
.fab-container.open .fab-icon-close { display: block; }

.fab-actions {
    position: absolute;
    bottom: 62px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

.fab-container.open .fab-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fab-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 0 12px;
    height: 42px;
    border-radius: 22px;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,.3);
    white-space: nowrap;
    transition: transform .15s;
}

.fab-action:hover { transform: scale(1.04); }

.fab-action:nth-child(1) { background: #ff9500; }
.fab-action:nth-child(2) { background: #53bdeb; }
.fab-action:nth-child(3) { background: #af52de; }

.fab-action span {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

/* === Error Page === */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-deep);
}

.error-content {
    text-align: center;
    max-width: 420px;
    padding: 40px;
}

.error-code {
    font-size: 96px;
    font-weight: 700;
    color: var(--green);
    line-height: 1;
    margin-bottom: 8px;
}

.error-message {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.error-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 28px;
}

.error-back-link {
    display: inline-block;
    padding: 10px 28px;
    background: var(--green);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s;
}

.error-back-link:hover {
    background: var(--green-dark);
}

/* === Canned Response Picker === */
/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 54px;
    left: 60px;
    width: 340px;
    height: 360px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    display: flex;
    flex-direction: column;
    z-index: 70;
    overflow: hidden;
}

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

.emoji-picker-header input {
    flex: 1;
    background: var(--bg-input);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.emoji-picker-header input::placeholder { color: var(--text-light); }

.emoji-picker-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.emoji-picker-tabs {
    display: flex;
    padding: 4px 8px;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.emoji-tab {
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.emoji-tab:hover { background: rgba(255,255,255,.08); }
.emoji-tab.active { background: rgba(0,168,132,.15); }

.emoji-picker-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-content: flex-start;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    border-radius: 8px;
    transition: background .12s;
}

.emoji-item:hover { background: rgba(255,255,255,.1); }

/* Canned button in input area */
.canned-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.canned-btn:hover { background: rgba(255,255,255,.08); }

/* Chat body row — messages + optional sidebar */
.chat-body-row {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.messages-and-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

/* Canned sidebar column */
.canned-sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    animation: slideInRight .2s ease-out;
}

@keyframes slideInRight {
    from { width: 0; opacity: 0; }
    to { width: 280px; opacity: 1; }
}

.canned-picker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.canned-picker-header span { flex: 1; }

.canned-picker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
}

.canned-picker-close:hover { color: var(--text-primary); }

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

.canned-picker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .15s;
}

.canned-picker-item:last-child { border-bottom: none; }
.canned-picker-item:hover { background: var(--bg-hover); }

.canned-picker-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.canned-picker-shortcut {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
    background: rgba(0,168,132,.1);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.canned-picker-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.canned-picker-category {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-left: auto;
    flex-shrink: 0;
}

.canned-picker-body {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.canned-picker-item-main {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.canned-picker-edit {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s, background .15s;
}

.canned-picker-item:hover .canned-picker-edit { opacity: 1; }
.canned-picker-edit:hover { background: rgba(255,255,255,.1); }
.canned-picker-edit:hover svg path { fill: #00a884; }

.canned-picker-empty {
    padding: 24px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

/* === Message Reactions === */
.msg-reactions {
    display: flex;
    gap: 3px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.msg-reaction {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}

.msg-reaction:hover { background: rgba(255,255,255,.15); }

.react-picker {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    z-index: 60;
    margin-bottom: 4px;
}

.react-picker span {
    font-size: 22px;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    transition: transform .12s;
}

.react-picker span:hover { transform: scale(1.3); }

/* === Contact Labels === */
.label-chip {
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all .15s;
    user-select: none;
}

.label-chip:hover { border-color: var(--green); color: var(--text-primary); }
.label-chip.active { background: rgba(0,168,132,.15); color: #00a884; border-color: #00a884; }

/* === Admin Settings === */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 0;
}

.admin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-panel);
    border-radius: 10px;
    margin-bottom: 8px;
    gap: 14px;
}

.admin-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-card-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.admin-edit-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    white-space: nowrap;
}

.admin-edit-btn:hover { border-color: var(--green); color: var(--green); }
.admin-edit-btn:hover svg path { fill: var(--green); }
.admin-edit-btn.del:hover { border-color: #ff6b6b; color: #ff6b6b; }

.canned-shortcut-tag {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--green);
    background: rgba(0,168,132,.1);
    padding: 1px 6px;
    border-radius: 4px;
}

.canned-cat-tag {
    font-size: 10px;
    color: var(--text-light);
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* === API Limitations === */
.lim-card {
    background: var(--bg-panel);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.lim-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.lim-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.lim-icon.lim-blocked { background: rgba(239,68,68,.12); }
.lim-icon.lim-partial { background: rgba(245,158,11,.12); }
.lim-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.lim-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.lim-badge-blocked { background: rgba(239,68,68,.15); color: #ef4444; }
.lim-badge-partial { background: rgba(245,158,11,.15); color: #f59e0b; }
.lim-body {
    padding: 16px 18px;
}
.lim-body p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 14px;
    line-height: 1.6;
}
.lim-body code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-primary);
}
.lim-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.lim-compare-col {
    background: var(--bg-deeper, var(--bg-app));
    border-radius: 8px;
    padding: 12px 14px;
}
.lim-compare-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.lim-label-app { color: #00a884; }
.lim-label-api { color: #53bdeb; }
.lim-compare-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.lim-compare-col li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
    padding-left: 14px;
    position: relative;
    line-height: 1.5;
}
.lim-compare-col li::before {
    content: '';
    position: absolute;
    left: 0; top: 9px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--text-light);
}
.lim-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(134,150,160,.08);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.lim-note svg { flex-shrink: 0; margin-top: 1px; }
.lim-note.lim-note-ok { background: rgba(0,168,132,.08); }
.lim-note code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
}

/* === Dashboard Home === */
.dash-left-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.dash-section-title {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.dash-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.dash-col {
    flex: 1;
    min-width: 0;
}

.dash-card {
    background: var(--bg-panel);
    border-radius: 10px;
    overflow: hidden;
}

.dash-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dash-card-counts {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.dash-count-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.dash-count-badge.waiting {
    background: rgba(255,149,0,.15);
    color: #ff9500;
}

.dash-count-badge.active {
    background: rgba(0,168,132,.15);
    color: #00a884;
}

.dash-card-body {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.dash-card-body::-webkit-scrollbar { width: 5px; }
.dash-card-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.dash-card-body .admin-card {
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.dash-card-body .admin-card:last-child {
    border-bottom: none;
}

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

.dash-loading {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.dash-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: capitalize;
    letter-spacing: .3px;
    flex-shrink: 0;
}

.dash-status-pending {
    background: rgba(255,149,0,.15);
    color: #ff9500;
}

.dash-status-assigned {
    background: rgba(83,189,235,.15);
    color: #53bdeb;
}

.dash-status-in_transit {
    background: rgba(0,168,132,.15);
    color: #00a884;
}

.dash-status-delivered {
    background: rgba(0,168,132,.25);
    color: #25d366;
}

.dash-status-cancelled {
    background: rgba(255,107,107,.15);
    color: #ff6b6b;
}

.dash-dir-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(83,189,235,.15);
    color: #53bdeb;
    flex-shrink: 0;
}

.dash-agent-status-text {
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: capitalize;
}

.dash-agent-status-text.online {
    background: rgba(0,168,132,.15);
    color: #00a884;
}

.dash-agent-status-text.busy {
    background: rgba(255,149,0,.15);
    color: #ff9500;
}

.dash-agent-status-text.offline {
    background: rgba(134,150,160,.15);
    color: #8696a0;
}

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

/* === Chat Search Bar === */
.chat-search-bar {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: relative;
    z-index: 10;
    animation: slideDown .2s ease-out;
}

@keyframes slideDown {
    from { max-height: 0; opacity: 0; }
    to { max-height: 400px; opacity: 1; }
}

.chat-search-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.chat-search-inner svg {
    flex-shrink: 0;
}

.chat-search-inner input {
    flex: 1;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.chat-search-inner input::placeholder {
    color: var(--text-secondary);
}

.chat-search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.chat-search-close:hover {
    background: rgba(255,255,255,.08);
}

.chat-search-results {
    max-height: 320px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
}

.chat-search-result {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: background .15s;
}

.chat-search-result:hover {
    background: var(--bg-hover);
}

.chat-search-result-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 3px;
    word-break: break-word;
}

.chat-search-result-body mark {
    background: rgba(0,168,132,.35);
    color: #fff;
    padding: 1px 2px;
    border-radius: 2px;
}

.chat-search-result-meta {
    font-size: 11px;
    color: var(--text-light);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-search-result-sender {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: capitalize;
}

.chat-search-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* === Export CSV Button === */
.export-csv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.export-csv-btn:hover {
    background: var(--bg-hover);
    color: var(--green);
}

/* === Light theme SVG fill overrides === */
[data-theme="light"] .header-icon svg path { fill: #54656f; }
[data-theme="light"] .header-icon:hover { background: rgba(0,0,0,.08); }
[data-theme="light"] .chat-header-right .call-contact-btn svg path { fill: #54656f; }

/* === Keyboard Shortcuts Modal === */
.shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    padding: 4px 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}

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

.shortcut-keys {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* === Theme toggle button === */
.theme-toggle-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    transition: background .2s;
}

.theme-toggle-btn:hover { background: rgba(255,255,255,.1); }
[data-theme="light"] .theme-toggle-btn:hover { background: rgba(0,0,0,.08); }

.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon { display: none; }

/* Default (dark): show sun icon to switch to light */
.theme-toggle-btn .icon-sun { display: block; }
.theme-toggle-btn .icon-moon { display: none; }

/* Light theme: show moon icon to switch to dark */
[data-theme="light"] .theme-toggle-btn .icon-sun { display: none; }
[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }

/* Nav rail theme toggle */
.nav-rail-btn .icon-sun { display: block; }
.nav-rail-btn .icon-moon { display: none; }
[data-theme="light"] .nav-rail-btn .icon-sun { display: none; }
[data-theme="light"] .nav-rail-btn .icon-moon { display: block; }

/* === Pinned Chats === */
.pin-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: var(--bg-header);
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: var(--text-secondary);
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    transition: background .15s, color .15s;
}

.chat-item:hover .pin-btn { display: flex; }
.pin-btn.pinned { display: flex; color: var(--green); }
.pin-btn:hover { background: var(--bg-active); color: var(--green); }

.pin-indicator {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    flex-shrink: 0;
}

.chat-item.pinned {
    background: rgba(0,168,132,.04);
}

.chat-item.pinned:hover {
    background: rgba(0,168,132,.08);
}

/* === Forward Modal === */
.forward-contact-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-deep);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.forward-contact-list::-webkit-scrollbar { width: 5px; }
.forward-contact-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.forward-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--border);
}

.forward-contact-item:last-child { border-bottom: none; }
.forward-contact-item:hover { background: var(--bg-hover); }

.forward-contact-item input[type="checkbox"] {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

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

/* Responsive — mobile */
@media (max-width: 768px) {
    .top-bar { height: 0; display: none; }
    .app-container {
        margin-top: 0;
        height: 100vh;
        max-width: 100%;
        box-shadow: none;
        flex-direction: column;
    }

    /* Nav rail → bottom tab bar */
    #navRail {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 56px !important;
        min-height: 56px !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0 4px !important;
        order: 99 !important;
        border-right: none !important;
        border-top: 1px solid #374851 !important;
        justify-content: space-around !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 60 !important;
        background: #202c33 !important;
    }
    #navRail > div:first-child { display: none !important; } /* hide avatar */
    #navRail > div[style*="width:32px"] { display: none !important; } /* hide separator */
    #navRail > div[style*="flex:1"] { display: none !important; } /* hide spacer */
    .calls-sub-nav { display: none !important; } /* hide call sub-dots on mobile */
    .sp-widget { bottom: 64px !important; } /* move softphone above mobile nav bar */
    #navRail a, #navRail button {
        margin: 0 !important;
        padding: 6px 0 4px !important;
        width: auto !important;
        min-width: 48px !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }
    #navRail a span, #navRail button span { font-size: 8px !important; }
    #navRail a img, #navRail button img { width: 20px !important; height: 20px !important; }

    /* Space for fixed bottom bar */
    .left-panel { padding-bottom: 56px !important; }
    .right-panel.mobile-open { padding-bottom: 56px !important; }

    /* Left panel fills screen */
    .left-panel {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        flex: 1;
        min-height: 0;
        border-right: none;
    }

    /* Right panel hidden by default, shown when chat is open */
    .right-panel {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 50 !important;
        background: var(--bg-panel) !important;
    }
    .right-panel.mobile-open {
        display: flex !important;
        flex-direction: column !important;
    }
    /* Chat area fills the mobile view */
    .right-panel.mobile-open .chat-area {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
    }
    .right-panel.mobile-open .empty-state { display: none !important; }
    .right-panel.mobile-open .profile-drawer { width: 100% !important; }

    /* Back button visible on mobile */
    .mobile-back-btn { display: flex !important; }

    /* Chat messages tighter padding */
    .messages-container { padding: 12px 10px; }

    /* Profile drawer full screen only when open */
    .profile-drawer { width: 0 !important; }
    .profile-drawer.open { width: 100% !important; }

    /* Canned sidebar full width */
    .canned-sidebar { width: 100% !important; max-width: none !important; }

    /* Search container */
    .search-container { padding: 8px 10px; }

    /* Chat items tighter */
    .chat-item { padding: 10px 12px; }

    /* Emoji picker */
    .emoji-picker { width: 280px !important; }

    /* Modal responsive */
    .wh-modal { width: 95vw !important; max-width: 95vw !important; }

    .shortcuts-grid { grid-template-columns: 1fr; }

    /* FAB */
    .fab-main { bottom: 70px !important; }
    .fab-menu { bottom: 126px !important; }
}

/* Tablet — keep side-by-side but narrower left panel */
@media (min-width: 769px) and (max-width: 1024px) {
    .left-panel { width: 320px; min-width: 280px; }
    .messages-container { padding: 16px 30px; }
    #navRail a span, #navRail button span { font-size: 8px !important; }
}

/* === Loading Skeletons === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-panel) 25%, var(--bg-input) 50%, var(--bg-panel) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 6px;
}
.skeleton-text { height: 12px; margin-bottom: 6px; width: 80%; }
.skeleton-text.short { width: 40%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 60px; margin-bottom: 8px; border-radius: 10px; }
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === Empty States === */
.empty-state {
    text-align: center; padding: 40px 20px;
}
.empty-state svg { opacity: 0.12; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.empty-state p { font-size: 12px; color: var(--text-secondary); max-width: 280px; margin: 0 auto 16px; }

/* ══════════════════════════════════════════════════════════════
   MASTER SELECT / DROPDOWN STYLING
   Premium custom dropdowns — removes all native browser chrome
   ══════════════════════════════════════════════════════════════ */

/* Global: strip native appearance from every select */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238696a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px !important;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border-radius: 10px;
    transition: border-color .2s, box-shadow .2s, background-color .15s;
}

/* Hover: subtle lift */
select:hover {
    border-color: rgba(134,150,160,0.45);
    background-color: color-mix(in srgb, var(--bg-input), #fff 4%);
}

/* Focus: green glow ring */
select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2300a884' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Disabled state */
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-header);
}

/* Option styling (limited browser support, but helps Chrome/Edge) */
select option {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 8px 12px;
    font-weight: 400;
}
select option:checked {
    background: var(--green);
    color: #fff;
}

/* Firefox-specific dropdown fix */
@-moz-document url-prefix() {
    select {
        text-indent: 2px;
        text-overflow: '';
    }
    select option {
        background: var(--bg-panel);
        color: var(--text-primary);
    }
}

/* Inline selects (used in table cells, tight spaces) */
select.select-inline {
    padding: 4px 28px 4px 8px !important;
    font-size: 11px;
    border-radius: 8px;
    background-position: right 8px center;
}

/* Compact select variant */
select.select-sm {
    padding: 6px 30px 6px 10px !important;
    font-size: 12px;
    border-radius: 8px;
}

/* Large select variant */
select.select-lg {
    padding: 12px 36px 12px 16px !important;
    font-size: 15px;
    border-radius: 12px;
    background-position: right 14px center;
}

/* ── Pill-style select (for filter bars) ── */
select.select-pill {
    padding: 6px 30px 6px 12px !important;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    background-color: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.3px;
}
select.select-pill:hover {
    background-color: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
select.select-pill:focus {
    background-color: rgba(0,168,132,0.06);
    border-color: var(--green);
}

/* ── Status-colored select borders ── */
select.select-status-green { border-color: rgba(0,168,132,0.3); }
select.select-status-green:focus { box-shadow: 0 0 0 3px rgba(0,168,132,0.12); }
select.select-status-orange { border-color: rgba(255,149,0,0.3); }
select.select-status-orange:focus { box-shadow: 0 0 0 3px rgba(255,149,0,0.12); }
select.select-status-red { border-color: rgba(255,107,107,0.3); }
select.select-status-red:focus { box-shadow: 0 0 0 3px rgba(255,107,107,0.12); }
select.select-status-blue { border-color: rgba(83,189,235,0.3); }
select.select-status-blue:focus { box-shadow: 0 0 0 3px rgba(83,189,235,0.12); }

/* ── Light theme overrides ── */
[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23667781' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="light"] select:hover {
    background-color: color-mix(in srgb, var(--bg-input), #000 3%);
    border-color: rgba(0,0,0,0.15);
}
[data-theme="light"] select:focus {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2300a884' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="light"] select option {
    background: #fff;
    color: #111b21;
}
[data-theme="light"] select.select-pill {
    background-color: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] select.select-pill:hover {
    background-color: rgba(0,0,0,0.06);
}

/* ── Delivery Provider credential form fields ── */
.dp-field-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 400;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background-color .15s;
    font-family: inherit;
}
.dp-field-input:hover {
    border-color: rgba(134,150,160,0.45);
    background-color: color-mix(in srgb, var(--bg-input), #fff 4%);
}
.dp-field-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,168,132,0.12);
}
.dp-field-input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

/* Spin animation (used for loading indicators) */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Hide mobile back button on desktop */
.mobile-back-btn { display: none; }