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

:root {
    /* Teal-accented palette replacing the old indigo. Lighter background,
       sharper status colors so directory dots scan instantly. */
    --primary: #0d7377;
    --primary-hover: #14919b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #eab308;
    --offline: #94a3b8;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-dark: #1e293b;
    --text: #1a2332;
    --text-secondary: #5f6c7b;
    --border: #e4e9f0;
    --border-strong: #cdd5df;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.05);
    --shadow-lg: 0 10px 25px -8px rgba(15,23,42,0.15), 0 4px 10px -4px rgba(15,23,42,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

.screen {
    width: 100vw;
    height: 100vh;
}

#dashboard.screen {
    display: flex;
    flex-direction: column;
}
#dashboard.screen.hidden {
    display: none;
}

/* ======== Login ======== */
.login-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
}

/* Login method tabs: 账号密码 | 企业微信扫码 */
.login-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
}

.login-tab {
    flex: 1;
    padding: 7px 0;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.login-tab.active {
    background: var(--primary);
    color: #fff;
}

#loginQrLinkForm { margin-top: 12px; }


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

.logo-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.version-tag {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.7;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,115,119,0.12);
}

.form-error {
    min-height: 18px;
    margin: 4px 0 12px;
    color: #dc2626;
    font-size: 13px;
}

/* ======== Admin screen ======== */
#adminScreen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg);
}

#adminScreen .topbar h2 { font-size: 18px; font-weight: 700; }

.admin-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    gap: 4px;
    flex-shrink: 0;
}

.admin-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

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

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.admin-hotel {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.admin-hotel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.admin-hotel-title {
    display: flex; gap: 8px; align-items: baseline;
}
.admin-hotel-title .id  { font-family: monospace; color: var(--text-secondary); font-size: 12px; }
.admin-hotel-title .name { font-weight: 600; }

.admin-hotel-body { padding: 8px 14px; }

.admin-machine-row {
    display: grid;
    grid-template-columns: 90px 1fr 60px auto;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.admin-machine-row:last-child { border-bottom: none; }
.admin-machine-row .id { font-family: monospace; color: var(--text-secondary); font-size: 12px; }
.admin-machine-row.disabled { opacity: 0.55; }

.admin-form {
    display: grid;
    grid-template-columns: 90px 1fr 60px auto auto;
    gap: 8px;
    padding: 8px 0;
    align-items: center;
}

.admin-form input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--bg);
    width: 100%;
}

.admin-form input.id { font-family: monospace; }

.admin-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }

.admin-section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.admin-section-header h3 { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

.btn-mini {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.btn-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini.danger:hover { border-color: #dc2626; color: #dc2626; }
.btn-mini.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-mini.primary:hover { background: var(--primary-hover); }

/* Role picker in the users tab — sized to sit with the btn-mini row */
.admin-role-select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.admin-role-select:hover { border-color: var(--primary); }

/* Sessions table + online table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table tr:hover td { background: var(--bg-card); }
.admin-table .col-mono { font-family: monospace; color: var(--text-secondary); }
.admin-table .clickable { cursor: pointer; }

.online-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 6px;
}
.online-dot.idle  { background: #f59e0b; }
.online-dot.stale { background: var(--text-secondary); }
.online-dot.busy  { background: #f59e0b; }
.online-dot.paused { background: #9ca3af; }

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}
.admin-toolbar h3 { font-size: 16px; font-weight: 700; }
.admin-toolbar .toolbar-right { display: flex; gap: 8px; align-items: center; }

.session-detail {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.session-detail h4 { font-size: 14px; margin-bottom: 8px; color: var(--text-secondary); }
.session-detail .shots {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.session-detail .shots img {
    width: 120px; height: 90px; object-fit: cover;
    border-radius: 4px; cursor: pointer;
    border: 1px solid var(--border);
}
.session-detail .notes-list { display: flex; flex-direction: column; gap: 6px; }
.session-detail .note-item {
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}
.session-detail .note-item .note-meta {
    font-size: 11px; color: var(--text-secondary); margin-top: 4px;
}

/* Cloud-recording playback (see _renderRecordings in app.js) */
.rec-block { margin-bottom: 16px; }
.rec-title { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.rec-item {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 6px;
}
.rec-item audio { flex: 1 1 260px; min-width: 220px; height: 32px; }
.rec-dl { font-size: 12px; color: var(--text-secondary); text-decoration: none; }
.rec-dl:hover { text-decoration: underline; }
.rec-failed { color: var(--danger, #d33); }

/* Logs/audit admin tab */
.audit-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}
.audit-summary strong { color: var(--text); }
.audit-summary .id   { grid-column: 1 / -1; }

.audit-findings { display: flex; flex-direction: column; gap: 10px; }
.audit-finding {
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
}
.audit-finding-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 6px;
}
.audit-warnings {
    margin: 6px 0 6px 18px; padding: 0;
    color: #b45309; font-size: 13px;
}
.audit-warnings li { margin: 2px 0; }
.audit-pill {
    display: inline-block;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 4px;
}

/* Sessions tab — master/detail two-column layout */
.sessions-layout {
    display: flex;
    gap: 16px;
    height: calc(100vh - 220px);     /* topbar + tabs + toolbar + paddings */
    min-height: 360px;
}

.sessions-list {
    width: 360px;
    flex-shrink: 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
}

.sessions-detail-pane {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    background: var(--bg-card);
}

.sessions-list-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.sessions-list-item:hover { background: var(--bg); }
.sessions-list-item.active {
    background: var(--bg);
    border-left: 3px solid var(--primary);
    padding-left: 11px;
}
.sessions-list-item .top {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 8px;
}
.sessions-list-item .name {
    font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sessions-list-item .time {
    color: var(--text-secondary); font-size: 12px; flex-shrink: 0;
}
.sessions-list-item .meta {
    color: var(--text-secondary); font-size: 12px; margin-top: 4px;
}

/* ======== Buttons ======== */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
}

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

.btn-small {
    padding: 8px 16px;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-success { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-tiny {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

/* ======== Top Bar ======== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 44px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

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

.topbar h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-metric {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.topbar-metric.busy { color: var(--primary); border-color: var(--primary); }

/* ===== Top-nav history popup ===== */
.history-anchor {
    position: relative;
}

.history-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    max-height: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: historyPopIn 0.12s ease-out;
}

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

.history-popup-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.history-popup .call-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-popup .history-more-link {
    border-top: 1px solid var(--border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    padding: 10px;
    margin: 0;
    background: var(--bg);
    border-style: solid;
    cursor: pointer;
}

.history-popup .history-more-link:hover { background: var(--border); }

.agent-badge {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: var(--text-secondary);
}

.status-dot.online { background: var(--success); }
.status-dot.paused { background: #f59e0b; }

.duty-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}

.duty-pill:hover { background: var(--bg-card); border-color: var(--primary); }
.duty-pill:disabled { cursor: not-allowed; opacity: 0.7; }
.duty-pill:disabled:hover { background: var(--bg); border-color: var(--border); }

/* Paused mode is a frequent foot-gun — make the pill itself amber so
   the staff can't miss the fact that incoming-call alerts are muted. */
.duty-pill:has(.status-dot.paused),
.duty-pill.is-paused {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
    font-weight: 600;
}
.duty-pill:has(.status-dot.paused):hover,
.duty-pill.is-paused:hover {
    background: #fde68a;
    border-color: var(--warning);
}

/* Online standby staff list (top nav) */
.online-staff-list {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 40vw;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 12px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 12px), transparent);
}
.online-staff-list::-webkit-scrollbar { display: none; }

.online-staff-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.online-staff-chip .online-dot { margin-right: 0; }

/* Animated dot for the 来电 count badge when there's a pending call. */
@keyframes incomingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234,179,8,0.55); }
    50% { box-shadow: 0 0 0 5px rgba(234,179,8,0.15); }
}

/* ===== Floating incoming-call card =====
   Pops up centered above everything else when a CALL_REQUEST arrives.
   Big enough that staff can't miss it; small enough that the dashboard
   underneath stays visible. Auto-dismissed on accept / ignore / 接听
   by another staff. */

/* Semi-transparent dimmer behind the card so the eye is forced onto it. */
.incoming-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.42);
    z-index: 11900;
    animation: incomingBackdropIn 0.18s ease-out;
    pointer-events: none;   /* clicks fall through to the card buttons */
}

@keyframes incomingBackdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.incoming-card {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: calc(100vw - 32px);
    padding: 24px 28px 20px;
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15,23,42,0.28), 0 6px 16px rgba(15,23,42,0.16);
    z-index: 12000;
    text-align: center;
    animation: incomingCardIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes incomingCardIn {
    from { opacity: 0; transform: translate(-50%, -16px) scale(0.92); }
    to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Pulsing amber ring around the icon — the headline visual cue. */
.incoming-card-pulse {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 78px;
    height: 78px;
    border-radius: 50%;
    border: 3px solid var(--warning);
    opacity: 0;
    pointer-events: none;
    animation: incomingCardPulse 1.6s ease-out infinite;
}

@keyframes incomingCardPulse {
    0%   { transform: translateX(-50%) scale(0.75); opacity: 0.9; }
    100% { transform: translateX(-50%) scale(1.7);  opacity: 0; }
}

.incoming-card-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    animation: incomingCardShake 0.6s ease-in-out infinite;
}

@keyframes incomingCardShake {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-14deg); }
    75%      { transform: rotate(14deg); }
}

.incoming-card-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--warning);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.incoming-card-caller {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.incoming-card-machine {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.incoming-card-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin: 12px 0 18px;
}

.incoming-card-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-incoming-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
    font-family: inherit;
}
.btn-incoming-card .ic-glyph { font-size: 16px; line-height: 1; }
.btn-incoming-card kbd {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.btn-incoming-card.accept {
    background: var(--success);
    box-shadow: 0 4px 14px rgba(22,163,74,0.35);
    padding: 10px 24px;
    font-size: 14px;
}
.btn-incoming-card.accept:hover { background: #15803d; }

.btn-incoming-card.ignore {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border-strong);
}
.btn-incoming-card.ignore kbd { background: rgba(15,23,42,0.08); color: #1e293b; }
.btn-incoming-card.ignore:hover { background: #e2e8f0; }

.btn-incoming-card.reject {
    background: var(--danger);
    box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.btn-incoming-card.reject:hover { background: #b91c1c; }

.btn-incoming-card:active { transform: translateY(1px); }

.incoming-card-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 12px;
    min-height: 14px;
}

/* When the staff is already in another call, the card shows muted —
   no ringtone, no pulse — so the in-progress call isn't disrupted. */
.incoming-card.muted .incoming-card-pulse { animation: none; opacity: 0; }
.incoming-card.muted .incoming-card-icon { animation: none; opacity: 0.6; }
.incoming-card.muted .incoming-card-title { color: var(--text-secondary); }
.incoming-card.muted .incoming-card-title::after { content: ' · 静音'; }

/* ======== Long-call reminder (billing guard) ======== */
.reminder-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,0.55);
    z-index: 12500;   /* above the incoming-call card */
    animation: incomingBackdropIn 0.18s ease-out;
}

.reminder-card {
    width: 340px;
    max-width: calc(100vw - 32px);
    padding: 26px 28px 22px;
    background: var(--bg-card);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.32), 0 8px 20px rgba(15,23,42,0.18);
    text-align: center;
    animation: incomingCardIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.reminder-card-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 10px;
}

.reminder-card-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--warning);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.reminder-card-body {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 10px;
}
.reminder-card-body strong { color: var(--warning); }

.reminder-card-countdown {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 18px;
    font-variant-numeric: tabular-nums;
}
.reminder-card-countdown .reminder-count {
    font-weight: 700;
    color: var(--danger);
}

.reminder-card-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-reminder {
    padding: 10px 22px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    font-family: inherit;
    transition: transform 0.08s, background 0.15s;
}
.btn-reminder:active { transform: translateY(1px); }

.btn-reminder.continue {
    background: var(--success);
    box-shadow: 0 4px 14px rgba(22,163,74,0.35);
}
.btn-reminder.continue:hover { background: #15803d; }

.btn-reminder.hangup {
    background: var(--danger);
    box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.btn-reminder.hangup:hover { background: #b91c1c; }

/* ======== Dashboard Body (two-column) ======== */
.dashboard-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dashboard-body.two-col {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 0;
}

/* ======== Kiosk Directory ======== */
.kiosk-directory {
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.directory-header {
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.directory-search {
    position: relative;
    margin-bottom: 8px;
}

.directory-search input {
    width: 100%;
    padding: 7px 10px 7px 28px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.directory-search input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(13,115,119,0.1);
}

.directory-search::before {
    content: '🔍';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.5;
}

.directory-filters {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.filter-pill {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
}

.filter-pill:hover { border-color: var(--primary); color: var(--primary); }

.filter-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.directory-counts {
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.directory-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 4px 8px 8px;
}

.hotel-group {
    margin-bottom: 8px;
}

.hotel-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 4px 8px 2px;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hotel-group-header .hotel-name { color: var(--text); }
.hotel-group-header .hotel-id { font-variant-numeric: tabular-nums; opacity: 0.6; }

.kiosk-tile {
    display: grid;
    grid-template-columns: 14px 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    /* Tile body is inert by default — only the action button triggers the
       action. Keyboard focus is still allowed so Enter / Space work. */
    cursor: default;
    transition: background 0.1s, border-color 0.1s, transform 0.05s;
    outline: none;
}

/* Color-coded chip per machine number — lets staff scan 1号/2号/3号
   within a hotel without reading the label text. Colors cycle every 9. */
.kiosk-mn {
    min-width: 22px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    background: var(--offline);
}
.kiosk-mn.mn-1 { background: #3b82f6; }   /* blue   */
.kiosk-mn.mn-2 { background: #f97316; }   /* orange */
.kiosk-mn.mn-3 { background: #a855f7; }   /* purple */
.kiosk-mn.mn-4 { background: #ec4899; }   /* pink   */
.kiosk-mn.mn-5 { background: #06b6d4; }   /* cyan   */
.kiosk-mn.mn-6 { background: #ca8a04; }   /* amber  */
.kiosk-mn.mn-7 { background: #f43f5e; }   /* rose   */
.kiosk-mn.mn-8 { background: #6366f1; }   /* indigo */
.kiosk-mn.mn-9 { background: #14b8a6; }   /* teal   */
/* Some machines have no number in either id or name (e.g. a bare "m"
   id with a non-numeric display name). Hide the chip rather than
   showing "?" — the column stays so the rest of the row aligns. */
.kiosk-mn.mn-none { visibility: hidden; }
/* Dim the chip on offline tiles so it doesn't shout. */
.kiosk-tile.state-offline .kiosk-mn { opacity: 0.45; }

.kiosk-tile:hover {
    background: var(--bg);
    border-color: var(--border);
}

.kiosk-tile:focus-visible {
    background: rgba(13,115,119,0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(13,115,119,0.18);
}

.kiosk-tile:active { transform: scale(0.99); }

.kiosk-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--offline);
    margin: 0 auto;
    box-shadow: 0 0 0 2px rgba(15,23,42,0.04);
}

.kiosk-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.kiosk-name .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kiosk-name .meta {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kiosk-action {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.12s, transform 0.05s;
}
.kiosk-action:hover { background: var(--primary-hover); }
.kiosk-action:active { transform: translateY(1px); }

/* State-specific colors */
.kiosk-tile.state-idle .kiosk-dot { background: var(--success); }

.kiosk-tile.state-ringing {
    background: #fffbeb;
    border-color: #fde68a;
    animation: tilePulse 1.5s ease-in-out infinite;
}
.kiosk-tile.state-ringing .kiosk-dot { background: var(--warning); }
.kiosk-tile.state-ringing .kiosk-action { background: var(--warning); color: #422006; }

@keyframes tilePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234,179,8,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(234,179,8,0.18); }
}

.kiosk-tile.state-busy { background: #fef2f2; }
.kiosk-tile.state-busy .kiosk-dot { background: var(--danger); }
.kiosk-tile.state-busy .kiosk-action { background: var(--primary); }
.kiosk-tile.state-busy.is-mine { background: #ecfdf5; border-color: #a7f3d0; }
.kiosk-tile.state-busy.is-mine .kiosk-action { background: var(--success); }

.kiosk-tile.state-offline { opacity: 0.55; cursor: default; }
.kiosk-tile.state-offline:hover { background: transparent; border-color: transparent; }
.kiosk-tile.state-offline .kiosk-action { display: none; }

.count-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ======== Call Workspace (right column) ======== */
.call-workspace {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Top row: 来电 + 通话中, always visible. Fixed-ish height so the
   bottom area takes the rest. Each panel scrolls inside. */
.workspace-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 16px 0;
    flex-shrink: 0;
}

.ws-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 0;
    height: 180px;
}

.ws-panel.ws-incoming {
    border-color: var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ws-panel.ws-incoming.has-ring {
    border-color: var(--warning);
    box-shadow: 0 0 0 2px rgba(234,179,8,0.18);
    animation: incomingPulse 1.5s ease-in-out infinite;
}

.count-badge.muted {
    background: var(--border-strong);
    color: var(--text-secondary);
}

.ws-panel.ws-incoming.has-ring .count-badge { background: var(--warning); color: #422006; }

.ws-panel .incoming-list,
.ws-panel .active-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

/* Bottom area: idle hint (empty state) OR active-call detail. */
.workspace-idle {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 16px;
}

.idle-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    gap: 12px;
    padding: 32px;
}

.idle-hint-icon {
    font-size: 36px;
    opacity: 0.5;
}

.idle-hint-text {
    font-size: 13px;
    line-height: 1.6;
}

/* Lists pack items into a grid of small boxes so a panel can hold many
   calls at a glance. Each row is one compact card per call. */
.ws-panel .incoming-list,
.ws-panel .active-conversations {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px;
    align-content: start;
}

.ws-panel .incoming-list .empty-state,
.ws-panel .active-conversations .empty-state {
    grid-column: 1 / -1;
}

/* Per-row incoming call card. Each pending CALL_REQUEST gets one. */
.incoming-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left-width: 3px;
    min-height: 30px;
    animation: incomingPulse 1.5s ease-in-out infinite;
}

.incoming-row.muted {
    background: var(--bg);
    border-color: var(--border-strong);
    border-left-color: var(--border-strong);
    animation: none;
    opacity: 0.85;
}

.incoming-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.incoming-row-hotel {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incoming-row-machine {
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incoming-row-timer {
    font-size: 10px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    flex-shrink: 0;
}

.incoming-row-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.btn-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    line-height: 1;
    min-height: 20px;
    transition: background 0.12s, transform 0.05s;
}
.btn-ring.accept { background: var(--success); }
.btn-ring.accept:hover { background: #15803d; }
.btn-ring.reject { background: var(--danger); }
.btn-ring.reject:hover { background: #b91c1c; }
.btn-ring.ignore { background: #f1f5f9; color: #475569; border: 1px solid var(--border-strong); padding: 1px 5px; }
.btn-ring.ignore:hover { background: #e2e8f0; }
.btn-ring:active { transform: translateY(1px); }
/* In the dense grid layout the inline kbd hints just clutter — they're
   already shown in the shortcut bar / cheatsheet. */
.btn-ring kbd { display: none; }

.ws-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.ws-panel-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.ws-panel .active-conversations,
.ws-panel .call-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

/* Active conversations list (now lives inside workspace-idle) */
.active-conversations {
    max-height: none;
}

.call-history { max-height: none; }

/* Compact box format: same shape as .incoming-row so 来电 + 通话中
   feel symmetric and pack many calls into the panels. */
.conv-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-left-color: var(--offline);
    cursor: pointer;
    transition: background 0.12s;
    min-height: 30px;
}

.conv-item:hover { background: #e2e8f0; }

.conv-item.is-mine {
    background: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: var(--success);
}

.conv-item.is-mine:hover { background: #d1fae5; }

/* The render still wraps the label + meta in a .conv-item-top span; in
   the compact layout it just becomes the flex-1 text column. */
.conv-item-top {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.conv-hotel {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-staff {
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-time {
    font-size: 10px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.conv-join-btn {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    background: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    min-height: 20px;
    line-height: 1;
}

.conv-join-btn:hover { background: var(--primary-hover); }
.conv-view-btn { background: var(--success); }
.conv-view-btn:hover { background: #15803d; }

.history-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    background: var(--bg);
    font-size: 12px;
    gap: 2px;
}

.history-hotel { font-weight: 600; margin-right: 4px; }
.history-machine { color: var(--text-secondary); }

.history-meta {
    display: flex;
    gap: 8px;
    color: var(--text-secondary);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}

.history-item.clickable { cursor: pointer; transition: background 0.12s; }
.history-item.clickable:hover { background: var(--border); }

.history-more-link {
    display: block;
    text-align: center;
    padding: 6px;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.history-more-link:hover { background: var(--bg); }

.history-icons {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 18px 8px;
}

.history-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: var(--bg);
    font-size: 12px;
    gap: 2px;
}

.history-hotel {
    font-weight: 600;
    margin-right: 4px;
}

.history-machine {
    color: var(--text-secondary);
}

.history-meta {
    display: flex;
    gap: 8px;
    color: var(--text-secondary);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Active conversations list */
.active-conversations {
    max-height: 180px;
    overflow-y: auto;
}

/* (see compact .conv-item rules above — duplicate block removed). */

.history-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.history-item.clickable:hover {
    background: var(--border);
}

/* "查看更多 →" link at the foot of the 通话历史 dropdown. Admin-only,
   opens the manage page on the 通话记录 tab. */
.history-more-link {
    display: block;
    text-align: center;
    padding: 6px;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-more-link:hover {
    background: var(--border);
}

.history-icons {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

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

/* ======== Workspace Active (in-call view) ======== */
.workspace-active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
}

.active-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.active-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.screenshot-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screenshot-timeline {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: max-content;
    gap: 6px;
    background: var(--bg);
}

/* Empty-state should span the whole grid, not occupy one cell. */
.screenshot-timeline > .empty-state { grid-column: 1 / -1; }

.screenshot-item {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    overflow: hidden;
    background: #1e293b;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

.screenshot-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Overlay strip on the thumbnail — keeps the # and timestamp visible
   without stealing image area. */
.screenshot-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 6px;
    font-size: 10px;
    color: white;
    background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
    display: flex;
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

/* Notes panel */
.notes-area {
    width: 340px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-card);
}

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

.notes-header h3 {
    font-size: 13px;
    font-weight: 700;
}

.notes-input {
    padding: 10px 12px;
    border: none;
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    transition: background 0.15s;
}

.notes-input:focus {
    background: white;
    box-shadow: inset 0 0 0 2px rgba(13,115,119,0.18);
}

.notes-input:disabled {
    background: var(--bg);
    color: var(--text-secondary);
}

.notes-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.note-item {
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 12px;
}

.note-item .note-text {
    margin-bottom: 4px;
    white-space: pre-wrap;
}

.note-item .note-meta {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Screenshot lightbox */
.screenshot-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.screenshot-lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 8px;
}

/* Active-call header pieces */
.call-timer {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}

.call-room-info, .call-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

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

/* Live mic level. The staff cannot otherwise tell a working mic from one
   publishing silence — the call looks identical from this side either way. */
.mic-meter {
    display: none;
    width: 56px;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
    flex-shrink: 0;
}
.mic-meter.visible { display: inline-block; }
.mic-meter > i {
    display: block;
    width: 0;
    height: 100%;
    background: #3ba55d;
    transition: width 90ms linear;
}
/* No input for long enough that it can't be "nobody spoke". */
.mic-meter.dead {
    background: #5c1f1f;
    animation: micDeadPulse 1s ease-in-out infinite;
}
@keyframes micDeadPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* Call controls */
.call-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.ctrl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 72px;
    position: relative;
}

.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctrl-btn:hover { background: var(--bg-card); border-color: var(--primary); color: var(--primary); }

.ctrl-btn.active {
    background: var(--warning);
    border-color: var(--warning);
    color: #422006;
}

.ctrl-btn .ctrl-icon { font-size: 20px; }
.ctrl-btn .ctrl-label { font-size: 11px; font-weight: 600; }

.ctrl-btn kbd {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 9px;
    padding: 0 4px;
    background: rgba(15,23,42,0.07);
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.ctrl-hangup kbd { background: rgba(255,255,255,0.25); color: white; }

/* ======== Toast ======== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-dark);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    pointer-events: none;
}

.toast + .toast { top: 70px; }
.toast + .toast + .toast { top: 120px; }

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ======== Shortcut Bar + Help Overlay ======== */
.shortcut-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 30px;
    padding: 0 14px;
    background: #0f172a;
    color: #cbd5e1;
    font-size: 11px;
    border-top: 1px solid #1e293b;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.shortcut-bar::-webkit-scrollbar { display: none; }

.shortcut-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0.35;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.shortcut-group.active { opacity: 1; }

.shortcut-help { margin-left: auto; opacity: 0.7; }

.shortcut-bar kbd {
    display: inline-block;
    padding: 1px 6px;
    background: #1e293b;
    border: 1px solid #334155;
    border-bottom-width: 2px;
    border-radius: 3px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 10px;
    line-height: 14px;
    color: #f1f5f9;
    margin-right: 3px;
}

.shortcut-help-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shortcut-help-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px 28px;
    min-width: 360px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.shortcut-help-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}

.shortcut-help-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 14px;
}

.shortcut-help-card th {
    text-align: left;
    padding: 10px 0 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.shortcut-help-card td {
    padding: 5px 0;
}

.shortcut-help-card td:first-child {
    width: 130px;
    color: var(--text-secondary);
}

.shortcut-help-card kbd {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 3px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 11px;
    color: var(--text);
}

/* ======== Responsive ======== */
@media (max-width: 900px) {
    .dashboard-body.two-col { grid-template-columns: 240px 1fr; }
    .workspace-top { grid-template-columns: 1fr; }
    .ws-panel { height: 140px; }
    .notes-area { width: 280px; }
}

@media (max-width: 600px) {
    .kiosk-directory { display: none; }
    .online-staff-list { display: none; }
    .shortcut-bar { display: none; }
}

.conv-item.highlight-flash {
    background: #fef3c7;
    transition: background 0.3s ease;
}

.active-header .btn-leave-room {
    margin-left: auto;
}
.btn-leave-room {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
.btn-leave-room:hover {
    background: var(--border);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-leave-room:active {
    transform: scale(0.97);
}
.btn-leave-room:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.btn-leave-room .leave-icon {
    font-size: 14px;
    line-height: 1;
}

.ctrl-spacer {
    width: 24px;
    flex-shrink: 0;
}
.ctrl-hangup {
    position: relative;
    overflow: hidden;
    background: #ef4444;
    color: white;
    border-color: #dc2626;
}
.ctrl-hangup .ctrl-label {
    font-weight: 600;
}
.ctrl-hangup:hover {
    background: #dc2626;
}
.ctrl-hangup .hangup-progress {
    position: absolute;
    left: 0; bottom: 0; height: 3px; width: 0;
    background: rgba(255, 255, 255, 0.95);
    pointer-events: none;
}
.ctrl-hangup.confirming .hangup-progress {
    transition: width 600ms linear;
    width: 100%;
}
.ctrl-hangup.confirming {
    background: #b91c1c;
}

/* ======== OTA admin tab ======== */
.ota-upload-card {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ota-upload-row {
    display: grid;
    grid-template-columns: minmax(220px, auto) 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.ota-upload-row input[type="text"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--bg);
    width: 100%;
}

/* 通道选择(正式/测试) — 2026-10-07: 测试版只允许「选择机器…」推送 */
.ota-upload-row select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
}

.ota-upload-row input[type="file"] {
    font-size: 13px;
    color: var(--text-secondary);
}

.ota-progress-wrap {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ota-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.ota-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.15s linear;
}

.ota-progress-label {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

.ota-package-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ota-package {
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.ota-package.archived {
    opacity: 0.6;
}

.ota-package-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ota-package-meta {
    display: flex;
    gap: 12px;
    align-items: baseline;
    flex-wrap: wrap;
}

.ota-package-meta .ota-version {
    font-weight: 600;
    color: var(--primary);
    font-family: monospace;
}

.ota-package-meta .id {
    font-family: monospace;
    color: var(--text-secondary);
    font-size: 12px;
}

.ota-package-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ota-package-notes {
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.ota-deployments .ota-err {
    max-width: 280px;
    color: #b91c1c;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Archived bundles — collapsible accordion under the active list. */
.ota-archived-section {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    overflow: hidden;
}

.ota-archived-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.ota-archived-toggle:hover { color: var(--text); background: var(--bg-card); }

.ota-archived-chevron {
    display: inline-block;
    width: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.ota-archived-body {
    padding: 8px 14px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* Hollow danger button — used on archived rows where delete is permanent. */
.btn-mini.btn-danger-outline {
    border-color: #fca5a5;
    color: #b91c1c;
    background: var(--bg);
}
.btn-mini.btn-danger-outline:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}

/* Pagination footer under the OTA deployments table */
.ota-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 4px;
    font-size: 13px;
    color: #4b5563;
}
.ota-pagination-btn {
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    color: #1f2937;
    font-size: 13px;
}
.ota-pagination-btn:hover:not([disabled]) { background: #f3f4f6; }
.ota-pagination-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.ota-pagination-info {
    flex: 0 0 auto;
    color: #6b7280;
}

/* Banner shown when WS push lands while user is past page 0 */
.ota-new-banner {
    margin: 8px 0;
    padding: 8px 14px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: center;
}
.ota-new-banner:hover { background: #fde68a; }

/* Status pill colors */
.ota-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}
.ota-pill.grey   { background: #e5e7eb; color: #4b5563; }
.ota-pill.blue   { background: #dbeafe; color: #1e40af; }
.ota-pill.green  { background: #d1fae5; color: #065f46; }
.ota-pill.red    { background: #fee2e2; color: #991b1b; }
.ota-pill.amber  { background: #fef3c7; color: #92400e; }

@keyframes ota-pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.55; }
    100% { opacity: 1; }
}
.ota-pill.animated {
    animation: ota-pulse 1.4s ease-in-out infinite;
}

/* Machine picker modal */
.ota-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ota-modal-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 560px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.ota-modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ota-modal-head h3 { font-size: 15px; font-weight: 700; }

.ota-modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

.ota-modal-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

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

.ota-machine-row {
    display: grid;
    grid-template-columns: 24px 110px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.ota-machine-row:hover { background: var(--bg); border-color: var(--border); }
.ota-machine-row .col-mono { font-family: monospace; color: var(--text-secondary); }
.ota-machine-row .id { font-family: monospace; color: var(--text-secondary); font-size: 11px; }

/* 坐席端一行比机器多一列(账号 id + 已装版本 + 状态)，其余沿用上面的样式 */
.ota-machine-row.staff { grid-template-columns: 24px 110px 1fr auto auto; }
/* 离线坐席仍然列出(让管理员知道这个账号存在)，但不可选：推过去只会立刻
   记一条 failed，徒增历史噪音。 */
.ota-machine-row.is-offline { opacity: .5; cursor: not-allowed; }
.ota-machine-row.is-offline:hover { background: none; border-color: transparent; }

/* ---- OTA 目标切换(自助机 / 坐席端) ----
   放在整页最上方。下面每一个动作(列出哪些包、推给谁)都取决于它，而把坐席端
   的包推到自助机是不可恢复的，所以「现在是哪一队」必须一眼可见，不能靠推断。 */
.ota-target-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.ota-target-btn {
    padding: 6px 18px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.ota-target-btn:hover { color: var(--text); }
.ota-target-btn.active {
    background: var(--card, #fff);
    color: var(--accent, #2f81f7);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

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

/* Kiosk log viewer / manual pull modal — shares the OTA modal aesthetic but
 * needs a wider/taller card so a <pre> block can scroll inside. */
.kiosk-log-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.kiosk-log-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 80vw;
    max-width: 1100px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.kiosk-log-modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kiosk-log-modal-head h3 { font-size: 15px; font-weight: 700; }
.kiosk-log-modal-head .id {
    font-family: monospace;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 8px;
}

.kiosk-log-modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

.kiosk-log-modal-pre {
    flex: 1;
    margin: 0;
    padding: 12px 18px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: 'Consolas', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.55;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 70vh;
}

.kiosk-log-modal-pre::-webkit-scrollbar { width: 10px; height: 10px; }
.kiosk-log-modal-pre::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 5px;
}
.kiosk-log-modal-pre::-webkit-scrollbar-track { background: #1e293b; }

.kiosk-log-modal-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

/* Pull-in-progress spinner card */
.log-pull-overlay { z-index: 10001; }
.log-pull-card {
    width: auto;
    max-width: 360px;
    padding: 22px 28px;
    align-items: center;
    text-align: center;
    gap: 10px;
}
.log-pull-card > div { padding: 4px 0; }

.log-pull-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: log-pull-spin 0.9s linear infinite;
    margin: 0 auto 6px;
}

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