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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0A0A0A;
    color: #E0E0E0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    font-size: 14px;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Record section ── */

.record-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 16px;
    gap: 0;
}

.mic-btn {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid #2a2a2a;
    background: #141414;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.mic-btn svg {
    width: 56px;
    height: 56px;
    color: #888;
    transition: color 0.2s;
}

.mic-btn:active { transform: scale(0.93); }

.mic-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.mic-btn.recording {
    border-color: #FF4757;
    background: #1c0808;
    animation: recording-pulse 1.8s infinite;
}

.mic-btn.recording svg { color: #FF4757; }

.mic-btn.processing {
    border-color: #FFB800;
    background: #181200;
    animation: processing-pulse 1s ease-in-out infinite;
}

.mic-btn.processing svg { color: #FFB800; }

.mic-btn.saved {
    border-color: #00D68F;
    background: #001a10;
}

.mic-btn.saved svg { color: #00D68F; }

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.45); }
    50%       { box-shadow: 0 0 0 20px rgba(255, 71, 87, 0); }
}

@keyframes processing-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 0, 0.4); }
    50%       { box-shadow: 0 0 0 14px rgba(255, 184, 0, 0); }
}

/* ── Status ── */

.status-wrap {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 44px;
}

.status {
    font-size: 15px;
    font-weight: 500;
    color: #888;
    text-align: center;
    letter-spacing: 0.1px;
    transition: color 0.2s;
    max-width: 280px;
    word-break: break-word;
}

.status-hint {
    font-size: 12px;
    color: #333;
    text-align: center;
    letter-spacing: 0.2px;
    min-height: 16px;
}

.status.recording { color: #FF6370; }
.status.processing { color: #FFB800; }
.status.saved      { color: #00D68F; }

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

/* ── Audio wave visualizer ── */

.audio-wave {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 36px;
    margin: 14px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.audio-wave.active  { opacity: 1; }
.audio-wave.processing { opacity: 0.6; }

.audio-wave span {
    display: block;
    width: 4px;
    min-height: 4px;
    border-radius: 3px;
    background: #FF4757;
    transform-origin: bottom;
    transform: scaleY(0.15);
    transition: background 0.3s;
}

.audio-wave.active span {
    animation: bar-wave 1.1s ease-in-out infinite;
}

.audio-wave.active span:nth-child(1) { animation-delay: 0.0s; animation-duration: 1.0s; }
.audio-wave.active span:nth-child(2) { animation-delay: 0.15s; animation-duration: 0.9s; }
.audio-wave.active span:nth-child(3) { animation-delay: 0.05s; animation-duration: 1.2s; }
.audio-wave.active span:nth-child(4) { animation-delay: 0.22s; animation-duration: 0.85s; }
.audio-wave.active span:nth-child(5) { animation-delay: 0.08s; animation-duration: 1.05s; }
.audio-wave.active span:nth-child(6) { animation-delay: 0.18s; animation-duration: 0.95s; }
.audio-wave.active span:nth-child(7) { animation-delay: 0.03s; animation-duration: 1.15s; }

.audio-wave.processing span {
    animation: bar-idle 1.8s ease-in-out infinite;
    background: #FFB800;
}

.audio-wave.processing span:nth-child(odd)  { animation-delay: 0s; }
.audio-wave.processing span:nth-child(even) { animation-delay: 0.4s; }

@keyframes bar-wave {
    0%, 100% { transform: scaleY(0.15); }
    50%       { transform: scaleY(1.0);  }
}

@keyframes bar-idle {
    0%, 100% { transform: scaleY(0.2); }
    50%       { transform: scaleY(0.5); }
}

/* ── Response area ── */

.response {
    margin: 10px 12px 6px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    min-height: 0;
    overflow: hidden;
}

.response.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.resp-logged         { background: #071a0e; color: #34d399; border: 1px solid #0d2e1a; }
.resp-undone         { background: #1f100a; color: #fb923c; border: 1px solid #2a1a10; }
.resp-edited         { background: #071220; color: #60A5FA; border: 1px solid #0d2035; }
.resp-deleted        { background: #1c0808; color: #f87171; border: 1px solid #2a1010; }
.resp-answer         { background: #0e0e28; color: #c4b5fd; border: 1px solid #1e1e45; font-size: 14px; }
.resp-clarify        { background: #1a1400; color: #fbbf24; border: 1px solid #2a2000; font-size: 14px; }
.resp-shift_started  { background: #001a20; color: #38BDF8; border: 1px solid #003040; }
.resp-shift_ended    { background: #120820; color: #a78bfa; border: 1px solid #2a1545; }
.resp-insight        { background: #001818; color: #67e8f9; border: 1px solid #003535; font-style: italic; }
.resp-note           { background: #0e1408; color: #a3e635; border: 1px solid #1e2a10; }

/* ── Log list ── */

.log-list {
    flex: 1;
    padding: 4px 10px 60px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Log entry ── */

.log-entry {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.log-entry.expanded  { border-color: #2e2e2e; }

@keyframes log-slide-in {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

.log-entry.new-entry {
    animation: log-slide-in 0.28s ease-out;
}

.log-entry.removing {
    opacity: 0;
    transform: translateX(-100%);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.log-entry.flash { border-color: #60A5FA; transition: border-color 1.5s ease; }

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    min-height: 52px;
    overflow: hidden;
}

.log-time {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.3;
}

.log-platform {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
}

.plat-uber     { background: #1e1e1e; color: #ccc; }
.plat-ubereats { background: #112200; color: #7acc00; }
.plat-lyft     { background: #260018; color: #f000c0; }
.plat-doordash { background: #2e0a00; color: #ff4422; }
.plat-roadie   { background: #001d3d; color: #22aaff; }
.plat-veho     { background: #170a30; color: #a78bfa; }
.plat-onway    { background: #251500; color: #f59e0b; }
.plat-curri    { background: #001a0c; color: #10b981; }
.plat-other    { background: #1a1a1a; color: #666; }

.log-payout {
    font-size: 14px;
    font-weight: 700;
    color: #00D68F;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-city {
    font-size: 12px;
    font-weight: 600;
    color: #60A5FA;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.1px;
}

.log-gate {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 5px;
    background: #2a1a00;
    color: #f59e0b;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-summary {
    font-size: 13px;
    color: #777;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-chevron {
    font-size: 16px;
    color: #444;
    flex-shrink: 0;
    transition: transform 0.2s;
    line-height: 1;
}

.log-entry.expanded .log-chevron { transform: rotate(90deg); }

/* ── Log body (expanded) ── */

.log-body {
    border-top: 1px solid #1a1a1a;
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-body.hidden { display: none; }

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

.log-entry.expanded .log-body {
    animation: body-expand 0.18s ease-out;
}

.log-row {
    display: flex;
    gap: 12px;
    font-size: 13px;
    line-height: 1.55;
}

.row-label {
    color: #555;
    flex-shrink: 0;
    width: 72px;
    text-align: right;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding-top: 1px;
}

.row-val {
    color: #ccc;
    flex: 1;
    word-break: break-word;
    font-size: 13px;
}

.tracked-row .row-label { color: #c98a00; }
.tracked-row .row-val   { color: #ffc940; }

.transcript-row .row-val {
    color: #555;
    font-style: italic;
    font-size: 12px;
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.modal-overlay.hidden { display: none; }

.modal {
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    padding: 28px 22px 22px;
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.modal-icon { font-size: 30px; }

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.modal-desc {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
}

.modal-desc strong { color: #fff; }

.modal-reason {
    font-size: 12px;
    color: #444;
    font-style: italic;
}

.modal-question {
    font-size: 14px;
    color: #aaa;
    margin-top: 2px;
}

.modal-question strong { color: #FFB800; }

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-yes,
.btn-no {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.btn-yes:active,
.btn-no:active { opacity: 0.65; }

.btn-yes { background: #00D68F; color: #000; }

.btn-no {
    background: #1e1e1e;
    color: #777;
    border: 1px solid #2a2a2a;
}
