/* ============================================================
   VoiceLink — App Stylesheet (Light Theme)
   ============================================================ */

:root {
    --bg-deep:       #f4f6fb;
    --bg-panel:      #ffffff;
    --bg-card:       #ffffff;
    --bg-card2:      #f3f0ff;
    --bg-hover:      rgba(0, 0, 0, 0.04);
    --border:        rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);
    --purple:        #6d4aff;
    --purple-dark:   #5a3fe0;
    --purple-dim:    rgba(109, 74, 255, 0.1);
    --purple-ring:   rgba(109, 74, 255, 0.22);
    --green:         #16a34a;
    --red:           #dc2626;
    --amber:         #d97706;
    --text:          #111827;
    --text-secondary:#4b5563;
    --text-muted:    #9ca3af;
    --shadow-sm:     0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md:     0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg:     0 16px 40px rgba(15, 23, 42, 0.12);
    --radius:        14px;
    --radius-sm:     8px;
    --sidebar-width: 300px;
    --topbar-height: 64px;
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-deep);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html { overflow: hidden; }
body { overflow: hidden; }

/* ---- Utility ---- */
.text-purple      { color: var(--purple) !important; }
.text-muted-light { color: var(--text-muted) !important; }
.text-faint       { opacity: 0.45; font-size: 0.85rem; }
.icon-muted       { font-size: 1.8rem; opacity: 0.25; }
.icon-muted-lg    { font-size: 4rem; opacity: 0.18; }
.spinner-tiny     { width: 14px; height: 14px; }
.spinner-reconnect { width: 2.5rem; height: 2.5rem; }

.online-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
    flex-shrink: 0;
}
.offline-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    display: inline-block;
    flex-shrink: 0;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    background: var(--bg-deep);
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    z-index: 20;
}
.sidebar-header {
    padding: 1.15rem 1.1rem 1rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-section-title {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.btn-icon-sm {
    background: var(--purple-dim);
    border: 1px solid var(--purple-ring);
    color: var(--purple);
    border-radius: var(--radius-sm);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.1s;
}
.btn-icon-sm:hover { background: rgba(109, 74, 255, 0.16); }
.btn-icon-sm:active { transform: scale(0.95); }

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem 0.5rem;
    -webkit-overflow-scrolling: touch;
}
.conv-placeholder {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}
.conv-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.75rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
    position: relative;
    margin-bottom: 2px;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active {
    background: var(--purple-dim);
    box-shadow: inset 3px 0 0 var(--purple);
}
.conv-item .avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b61ff, #5a3fe0);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(109, 74, 255, 0.25);
}
.conv-item .info { flex: 1; min-width: 0; }
.conv-item .name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.conv-item .sub  { font-size: 0.76rem; color: var(--text-muted); }
.conv-item .status-dot { flex-shrink: 0; }
.conv-item .conv-chevron {
    display: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Sidebar guidance (mobile) */
.sidebar-hint {
    display: none;
    margin: 0.5rem 0.75rem 0;
    padding: 0.85rem 1rem;
    background: var(--purple-dim);
    border: 1px solid var(--purple-ring);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    text-align: center;
}
.sidebar-hint i {
    display: block;
    font-size: 1.4rem;
    color: var(--purple);
    margin-bottom: 0.35rem;
}

/* Resume active conversation (mobile, after back) */
.resume-conv-bar {
    display: none;
    padding: 0 0.75rem 0.5rem;
}
.btn-resume-conv {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--purple-ring);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #7b61ff, #5a3fe0);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    box-shadow: 0 4px 14px rgba(90, 63, 224, 0.28);
    transition: opacity 0.15s, transform 0.1s;
}
.btn-resume-conv:hover { opacity: 0.92; }
.btn-resume-conv:active { transform: scale(0.98); }

.sidebar-footer {
    padding: 0.85rem 1rem calc(0.85rem + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
}
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-logout:hover { background: #fee2e2; color: #b91c1c; }

/* ---- Main panel ---- */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-deep);
}
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}
.empty-state .hint { font-size: 0.84rem; opacity: 0.7; margin-top: 0.35rem; }
.conv-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Mobile back button (hidden on desktop) */
.btn-mobile-back {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}
.btn-mobile-back:hover { background: var(--bg-hover); }

/* Conversation top bar */
.conv-topbar {
    padding: 0.85rem 1.25rem;
    min-height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.conv-topbar-info { flex: 1; min-width: 0; }

/* Live indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--red);
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.live-indicator.compact {
    font-size: 0.65rem;
    padding: 0.12rem 0.5rem;
}
.live-dot {
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.8); }
}

/* ---- Voice cards area ---- */
.voice-cards {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.25rem calc(1.25rem + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    -webkit-overflow-scrolling: touch;
}

/* Individual voice card */
.voice-card {
    display: flex;
    flex-direction: column;
    max-width: min(480px, 100%);
    width: fit-content;
    transition: transform 0.2s ease;
}
.voice-card.outgoing { align-self: flex-end; }
.voice-card.incoming { align-self: flex-start; }
.voice-card:hover { transform: translateY(-1px); }

.voice-card .card-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    min-width: min(240px, 100%);
    box-shadow: var(--shadow-md);
}
.voice-card.outgoing .card-bubble {
    background: var(--bg-card2);
    border-color: var(--purple-ring);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}
.card-sender {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--purple);
    letter-spacing: 0.01em;
}
.card-badge-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}
.card-badge-wrap .badge {
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    font-weight: 600;
}
.voice-new-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #7b61ff, #5d45d8);
    color: #fff;
    border: none;
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
}
.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #7b61ff, #5b40de);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(91, 64, 222, 0.28);
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.voice-play-btn:hover { filter: brightness(1.06); }
.voice-play-btn:active { transform: scale(0.96); }
.voice-track-wrap { flex: 1; min-width: 0; }
.voice-progress {
    width: 100%;
    height: 4px;
    accent-color: var(--purple);
    cursor: pointer;
}
.voice-time-row {
    margin-top: 0.3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-secondary);
}
.card-audio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Pending card */
.voice-card.pending-card .card-bubble {
    background: #fafafa;
    border-color: var(--border);
    opacity: 0.75;
}
.pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--amber);
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
}
.pending-audio-placeholder {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Live card */
.voice-card.live-card .card-bubble {
    border-color: #fca5a5;
    background: #fef2f2;
}
.voice-card.live-card { opacity: 0.95; }
.waveform-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 28px;
}
.waveform-bars span {
    width: 4px;
    border-radius: 2px;
    background: var(--red);
    animation: wave 0.8s ease-in-out infinite;
}
.waveform-bars span:nth-child(1) { height: 10px; animation-delay: 0.0s; }
.waveform-bars span:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.waveform-bars span:nth-child(3) { height: 14px; animation-delay: 0.2s; }
.waveform-bars span:nth-child(4) { height: 24px; animation-delay: 0.1s; }
.waveform-bars span:nth-child(5) { height: 10px; animation-delay: 0.3s; }
@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50%       { transform: scaleY(1); }
}

/* ---- Transmit bar ---- */
.transmit-bar {
    padding: 0.9rem 1.25rem calc(0.9rem + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
}
.tx-status-label {
    flex: 1;
    font-size: 0.84rem;
    color: var(--text-secondary);
    min-width: 0;
}
.btn-transmit {
    background: linear-gradient(135deg, #7b61ff, #5a3fe0);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(90, 63, 224, 0.3);
    min-height: 44px;
}
.btn-transmit:hover:not(:disabled) { opacity: 0.92; }
.btn-transmit:active:not(:disabled) { transform: scale(0.97); }
.btn-transmit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-transmit.stop-mode {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    animation: pulse-btn 1.4s infinite;
}
@keyframes pulse-btn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ---- User picker in modal ---- */
.user-picker { display: flex; flex-direction: column; gap: 0.5rem; }
.user-pick-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.user-pick-item:hover {
    border-color: var(--purple);
    background: var(--purple-dim);
    box-shadow: var(--shadow-sm);
}
.user-pick-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b61ff, #5a3fe0);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
    flex-shrink: 0;
}
.user-pick-name { font-weight: 600; color: var(--text); }

/* ---- Modal ---- */
.modal-app {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.modal-app .modal-header { padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }

/* ---- Autoplay banner ---- */
.autoplay-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 0.65rem 1rem;
    z-index: 9999;
    cursor: pointer;
}

/* ---- Floating transmission popup ---- */
.tx-popup {
    position: fixed;
    right: 22px;
    bottom: calc(22px + var(--safe-bottom));
    width: min(360px, calc(100vw - 24px));
    background: var(--bg-panel);
    border: 1px solid var(--purple-ring);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 6000;
}
.tx-popup.pending-mode { border-color: #fde68a; }
.tx-popup.live-mode    { border-color: #fca5a5; }
.tx-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}
.tx-popup-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}
.tx-popup-orb {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #7b61ff, #5d45d8);
    box-shadow: 0 0 0 0 rgba(123, 97, 255, 0.35);
    animation: tx-orb-pulse 1.8s infinite;
}
.tx-popup.live-mode .tx-popup-orb {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
}
.tx-popup.pending-mode .tx-popup-orb {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.35);
}
.tx-popup-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}
.tx-popup-mode {
    margin-top: 0.1rem;
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.tx-popup.live-mode .tx-popup-mode    { color: #dc2626; }
.tx-popup.pending-mode .tx-popup-mode { color: #d97706; }
.tx-popup-timer {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text);
}
.tx-popup-status {
    margin-top: 0.5rem;
    font-size: 0.79rem;
    line-height: 1.4;
    color: var(--text-secondary);
}
.tx-popup-wave {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 32px;
    margin-top: 0.62rem;
    padding: 0.2rem 0.15rem 0;
}
.tx-popup-wave span {
    width: 5px;
    border-radius: 999px;
    background: #f87171;
    animation: wave 0.9s ease-in-out infinite;
}
.tx-popup.pending-mode .tx-popup-wave span { background: #fbbf24; }
.tx-popup-wave span:nth-child(1) { height: 10px; animation-delay: 0s; }
.tx-popup-wave span:nth-child(2) { height: 20px; animation-delay: 0.12s; }
.tx-popup-wave span:nth-child(3) { height: 15px; animation-delay: 0.24s; }
.tx-popup-wave span:nth-child(4) { height: 24px; animation-delay: 0.08s; }
.tx-popup-wave span:nth-child(5) { height: 12px; animation-delay: 0.32s; }
.tx-popup-stop {
    width: 100%;
    margin-top: 0.78rem;
    border: 1px solid var(--border-strong);
    background: var(--bg-deep);
    color: var(--text);
    border-radius: 12px;
    padding: 0.58rem 0.68rem;
    font-weight: 600;
    font-size: 0.84rem;
    min-height: 44px;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s ease;
}
.tx-popup-stop:hover { background: var(--bg-hover); }
.tx-popup-stop:active { transform: scale(0.98); }

@keyframes tx-orb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(123, 97, 255, 0.3); }
    50%      { box-shadow: 0 0 0 10px rgba(123, 97, 255, 0); }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* ---- Reconnect overlay ---- */
.reconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}
.reconnect-overlay.d-none { display: none !important; }
.reconnect-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.reconnect-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.reconnect-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.reconnect-timer {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--purple);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   AUTH PAGES (login, confirm)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(160deg, #f4f6fb 0%, #ede9fe 45%, #f4f6fb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.auth-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.25rem 2rem 2rem;
    width: 100%;
    max-width: 420px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.auth-card.wide { max-width: 440px; }
.auth-card .brand-icon {
    font-size: 2.75rem;
    color: var(--purple);
}
.auth-card h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.auth-card .sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.auth-card .form-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}
.auth-card .form-control {
    background: var(--bg-deep);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    min-height: 44px;
}
.auth-card .form-control:focus {
    background: var(--bg-panel);
    border-color: var(--purple);
    color: var(--text);
    box-shadow: 0 0 0 3px var(--purple-ring);
}
.auth-card .form-control::placeholder { color: var(--text-muted); }
.auth-card .btn-primary-gradient {
    background: linear-gradient(90deg, #7b61ff, #5a3fe0);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 0.7rem;
    min-height: 44px;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 4px 14px rgba(90, 63, 224, 0.28);
}
.auth-card .btn-primary-gradient:hover { opacity: 0.92; }
.auth-card .btn-primary-gradient:active { transform: scale(0.98); }
.auth-card .alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
    border-radius: 10px;
}
.auth-card .footnote {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.name-row { display: flex; gap: 0.75rem; }
.name-row .mb-3 { flex: 1; min-width: 0; }

/* Confirm page specifics */
.warn-icon { font-size: 2.75rem; color: #d97706; }
.user-badge {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.user-badge .avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b61ff, #5a3fe0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.user-badge .name { font-weight: 600; font-size: 0.95rem; }
.user-badge .email { font-size: 0.8rem; color: var(--text-muted); }
.notice-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    color: #78350f;
    line-height: 1.5;
}
.notice-box i { color: #d97706; }
.btn-confirm {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    padding: 0.7rem;
    color: #fff;
    min-height: 44px;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}
.btn-confirm:hover { opacity: 0.92; color: #fff; }
.btn-cancel {
    background: var(--bg-deep);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-weight: 500;
    padding: 0.7rem;
    color: var(--text-secondary);
    min-height: 44px;
    transition: background 0.2s;
}
.btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.auth-divider {
    border-top: 1px solid var(--border);
    margin: 1.5rem 0 1.25rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767.98px) {
    .app-shell {
        position: relative;
        overflow: hidden;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        border-right: none;
        height: 100%;
        z-index: 5;
    }

    .conv-list {
        flex: 0 1 auto;
        overflow-y: auto;
        max-height: 50vh;
    }

    .sidebar-footer {
        margin-top: auto;
    }

    .main-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 30;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--bg-panel);
        display: flex;
        flex-direction: column;
    }

    .app-shell.conv-open .main-panel {
        transform: translateX(0);
    }

    .app-shell.conv-open .sidebar {
        visibility: hidden;
        pointer-events: none;
    }

    .empty-state { display: none !important; }

    .btn-mobile-back { display: inline-flex; }

    .conv-item .conv-chevron { display: inline-flex; }
    .conv-item .status-dot { display: none; }

    .sidebar-hint { display: block; }
    .sidebar-hint.d-none { display: none !important; }

    .resume-conv-bar { display: block; }
    .resume-conv-bar.d-none { display: none !important; }

    .conv-topbar {
        padding: 0.75rem 1rem;
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }

    .voice-cards {
        padding: 1rem 1rem calc(1rem + var(--safe-bottom));
    }

    .transmit-bar {
        flex-wrap: nowrap;
        gap: 0.75rem;
        padding: 0.85rem 1rem calc(0.85rem + var(--safe-bottom));
    }
    .tx-status-label {
        flex: 1;
        text-align: left;
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .btn-transmit {
        flex-shrink: 0;
        justify-content: center;
        min-width: 120px;
        padding: 0.65rem 1.1rem;
    }

    .tx-popup {
        right: 12px;
        left: 12px;
        bottom: calc(12px + var(--safe-bottom));
        width: auto;
    }

    .voice-card {
        max-width: 100%;
        width: 100%;
    }
    .voice-card.outgoing,
    .voice-card.incoming {
        align-self: stretch;
    }
    .voice-card .card-bubble {
        width: 100%;
        min-width: 0;
    }

    .auth-card {
        padding: 1.75rem 1.25rem 1.5rem;
    }
    .name-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (min-width: 768px) {
    .app-shell.conv-open .main-panel,
    .main-panel {
        transform: none;
        position: static;
    }

    .btn-mobile-back { display: none !important; }
}

@media (max-width: 380px) {
    .sidebar-header .fs-5 { font-size: 1.1rem !important; }
}
