/* Conversations list page -- phone-first, mirrors Checklists styling */

* { box-sizing: border-box; }
body {
    background: #F2F2F4;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: #1A1A1A;
}

.cv-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.cv-header {
    background: #3C3C3C; color: #fff;
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.cv-header h1 {
    margin: 0; flex: 1;
    font-size: 17pt; font-weight: 600; letter-spacing: -0.2px;
}
.cv-back {
    color: #fff; text-decoration: none;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20pt; font-weight: 300; border-radius: 50%;
}
.cv-back:hover { background: rgba(255,255,255,0.10); }
.cv-icon-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; color: inherit;
    border: none; border-radius: 50%;
    cursor: pointer; padding: 0;
}
.cv-icon-btn:hover { background: rgba(0,0,0,0.08); }

.cv-toolbar {
    background: #fff; border-bottom: 1px solid #E5E5E8;
    padding: 12px 16px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 4;
}
.cv-filter-chips { display: flex; gap: 6px; flex: 1; }
.cv-chip {
    padding: 7px 14px;
    font-size: 11pt; font-weight: 600; font-family: inherit;
    background: #F5F5F7; color: #555;
    border: 1px solid #E0E0E4; border-radius: 16px;
    cursor: pointer;
}
.cv-chip:hover { background: #ECECEE; }
.cv-chip.active { background: #1A73E8; color: #fff; border-color: #0B4FA8; }

.cv-poller-pill {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    font-size: 10pt; font-weight: 600;
    border-radius: 14px;
    background: #F5F5F7; color: #6A6A6E;
    border: 1px solid #E0E0E4;
    cursor: pointer;
    text-decoration: none;
}
.cv-poller-pill:hover { background: #ECECEE; }
.cv-poller-pill .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #C0C0C4; flex: 0 0 auto;
}
.cv-poller-pill.on  { color: #157A3C; background: #F0F8F3; border-color: #14A08C; }
.cv-poller-pill.on  .dot { background: #14A08C; }
.cv-poller-pill.off { color: #B85B22; background: #FBF5EE; border-color: #E89A1F; }
.cv-poller-pill.off .dot { background: #E89A1F; }
.cv-poller-pill.err { color: #C00000; background: #FDF1F1; border-color: #C00000; }
.cv-poller-pill.err .dot { background: #C00000; }

.cv-list {
    flex: 1;
    padding: 12px 14px 90px 14px;
}
.cv-empty {
    color: #888; font-style: italic;
    padding: 64px 24px; text-align: center;
    font-size: 12pt;
}

.cv-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.15s ease;
    display: flex; flex-direction: column; gap: 8px;
    position: relative;
}
.cv-card:active {
    transform: scale(0.995);
    box-shadow: 0 1px 1px rgba(0,0,0,0.10);
}
.cv-card.closed { opacity: 0.72; }

.cv-card-top {
    display: flex; align-items: flex-start; gap: 12px;
}
.cv-card-title {
    flex: 1; min-width: 0;
    font-size: 14pt; font-weight: 600; color: #1A1A1A;
    line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
}
.cv-status-chip {
    flex: 0 0 auto;
    padding: 3px 10px;
    font-size: 9pt; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
    border-radius: 10px;
    background: #E8F0FE; color: #1A73E8;
    border: 1px solid #1A73E8;
}
.cv-card.closed .cv-status-chip {
    background: rgba(20,160,140,0.13); color: #14A08C; border-color: #14A08C;
}

.cv-awaiting-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    font-size: 9pt; font-weight: 700; text-transform: uppercase;
    border-radius: 10px;
    background: #FFF6E5; color: #B85B22;
    border: 1px solid #E89A1F;
}

.cv-card-preview {
    font-size: 11pt; color: #5A5A5E; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
}
.cv-card-preview .from {
    font-weight: 600; color: #1A73E8; margin-right: 6px;
}
.cv-card-preview .from.claude { color: #14A08C; }

.cv-card-meta {
    font-size: 9.5pt; color: #8A8A8E;
    display: flex; gap: 10px;
}

/* FAB */
.cv-fab {
    position: fixed;
    right: 22px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 60px; height: 60px;
    border-radius: 50%; border: none;
    background: #1A7A3C; color: #fff;
    font-size: 32pt; font-weight: 300; line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.28), 0 2px 4px rgba(0,0,0,0.18);
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    z-index: 20;
}
.cv-fab:hover { background: #226B40; }
.cv-fab:active { transform: scale(0.96); }

/* Overlay (new conversation) */
.cv-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    /* Must out-stack the injected Quick Launch icon band (.lw-iconband,
       z-index:300, sticky top:0). At the old z-index:100 the band painted
       over the sheet's header on mobile, swallowing the Cancel button's
       clicks (nightly Playwrite smoke failure 2026-06-06). A fullscreen
       modal covers all chrome, so it sits above the band -- matches
       .cl-overlay in checklists.css. */
    z-index: 1000;
    display: flex; flex-direction: column;
}
.cv-overlay-sheet {
    background: #F5F5F7;
    display: flex; flex-direction: column;
    overflow: hidden;
    width: 100%; height: 100%;
}
.cv-overlay-header {
    background: #3C3C3C; color: #fff;
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    display: flex; align-items: center; gap: 10px;
}
.cv-overlay-header .cv-icon-btn { color: #fff; }
.cv-overlay-header .cv-icon-btn:hover { background: rgba(255,255,255,0.10); }
.cv-overlay-title {
    flex: 1; font-size: 14pt; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: center;
}
/* Invisible right-side spacer mirrors the left cancel button so the centered
   title is geometrically centered between equal-weight elements (otherwise
   `text-align:center` on a flex-1 child centers within the gap, but the gap
   itself is off-center because the cancel button takes ~46px on the left only). */
.cv-overlay-header-spacer {
    width: 38px; height: 38px; flex: 0 0 38px;
}
.cv-text-btn {
    background: transparent; color: inherit;
    border: 1px solid rgba(255,255,255,0.35); border-radius: 4px;
    padding: 7px 16px;
    font: inherit; font-size: 11pt; font-weight: 600;
    cursor: pointer;
}
.cv-text-btn.primary { background: #1A7A3C; border-color: #1A7A3C; color: #fff; }
.cv-text-btn.primary:hover { background: #226B40; }
.cv-text-btn-lg {
    font-size: 13pt; padding: 13px 28px; border-radius: 8px;
    min-width: 130px;
}

/* Body has NO horizontal padding. Edge-to-edge fields (cv-field-fullwidth)
   span the sheet naturally; everything else (cv-hint, regular cv-field) adds
   its own --cv-overlay-pad indent. This avoids the negative-margin trick that
   kept drifting out of alignment whenever the body padding changed. */
.cv-overlay-body {
    --cv-overlay-pad: 22px;
    flex: 1; overflow-y: auto;
    padding: 24px 0 calc(40px + env(safe-area-inset-bottom, 0px)) 0;
}
.cv-field { margin-bottom: 18px; padding: 0 var(--cv-overlay-pad); }
.cv-field > label {
    display: block;
    font-size: 11pt; font-weight: 600; color: #333;
    margin-bottom: 6px;
}
.cv-field input[type="text"],
.cv-field textarea {
    display: block;     /* picasso-voice.js checks display=='block' to decide
                           whether its mic-wrap should also be block. Without
                           this, <input> stays inline-block, the wrap shrinks
                           to fit the placeholder text, and the Title field
                           ends up narrower than the textarea below it. */
    width: 100%;
    padding: 11px 13px;
    font: inherit; font-size: 12pt;
    border: 1px solid #D5D5D9; border-radius: 8px;
    background: #fff;
    -webkit-appearance: none;
}
.cv-field textarea { resize: vertical; min-height: 110px; }
.cv-field-fullwidth { padding: 0; }
.cv-field-fullwidth > label { padding: 0 var(--cv-overlay-pad); }
.cv-field-fullwidth input[type="text"],
.cv-field-fullwidth textarea {
    border-left: none; border-right: none; border-radius: 0;
    padding: 14px var(--cv-overlay-pad); font-size: 13pt;
}
.cv-field-fullwidth textarea { min-height: 160px; }
.cv-hint {
    font-size: 10.5pt; color: #888; line-height: 1.4;
    padding: 0 var(--cv-overlay-pad);
}

/* Bottom footer on the new-conversation sheet -- holds the polling toggle and
   the Start button. Sticky to the bottom so it stays visible above the
   keyboard on phones. */
.cv-overlay-footer {
    flex: 0 0 auto;
    background: #fff;
    border-top: 1px solid #E0E0E4;
    padding: 14px 18px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.06);
}
.cv-overlay-footer .cv-poller-toggle { flex: 1; }

/* The polling toggle pill -- used in the new-conv footer and the conversation
   detail footer. Shares colour rules with `.cv-poller-pill` but renders as a
   button-shaped tap target. */
.cv-poller-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 16px;
    font: inherit; font-size: 11pt; font-weight: 600;
    border-radius: 22px;
    background: #F5F5F7; color: #6A6A6E;
    border: 1px solid #E0E0E4;
    cursor: pointer;
    justify-content: flex-start;
    min-height: 44px;
}
.cv-poller-toggle:hover { background: #ECECEE; }
.cv-poller-toggle .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #C0C0C4; flex: 0 0 auto;
}
.cv-poller-toggle.on  { color: #157A3C; background: #F0F8F3; border-color: #14A08C; }
.cv-poller-toggle.on  .dot { background: #14A08C; }
.cv-poller-toggle.off { color: #B85B22; background: #FBF5EE; border-color: #E89A1F; }
.cv-poller-toggle.off .dot { background: #E89A1F; }
.cv-poller-toggle.err { color: #C00000; background: #FDF1F1; border-color: #C00000; }
.cv-poller-toggle.err .dot { background: #C00000; }
.cv-poller-toggle.busy { opacity: 0.6; cursor: wait; }

/* Transient status toast shown after returning from a conversation action
   (e.g. close). Pinned to the bottom of the shell, above the bottom safe area.
   Hidden by default; conversations.js toggles .show. */
.cv-statusbar {
    position: fixed;
    left: 50%; transform: translateX(-50%) translateY(140%);
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    background: #2A2A2A; color: #fff;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 11pt; font-weight: 500;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    opacity: 0; pointer-events: none;
    transition: transform 220ms ease, opacity 220ms ease;
    z-index: 60;
    max-width: calc(100vw - 32px);
    text-align: center;
}
.cv-statusbar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 720px) {
    .cv-list { max-width: 920px; margin: 0 auto; padding: 20px 24px 110px 24px; }
    .cv-toolbar { padding: 14px 24px; }
    .cv-overlay { align-items: center; justify-content: center; padding: 32px; }
    .cv-overlay-sheet {
        width: 100%; max-width: 720px;
        max-height: calc(100vh - 64px);
        border-radius: 14px;
        height: auto;
    }
    .cv-overlay-body { --cv-overlay-pad: 28px; padding: 26px 0 28px 0; }
}
