@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg: #0a0f0d;
    --bg-deep: #060a08;
    --surface: #0f1a14;
    --surface2: #142018;
    --surface3: #1a2a20;
    --border: rgba(186, 166, 120, 0.10);
    --border-accent: rgba(186, 166, 120, 0.22);
    --text: #e8e4dc;
    --text-secondary: #9c998f;
    --text-muted: #6b6960;

    --emerald: #2ecc71;
    --emerald-deep: #1a7a42;
    --emerald-soft: rgba(46, 204, 113, 0.10);
    --emerald-glow: rgba(46, 204, 113, 0.25);

    --gold: #baa678;
    --gold-bright: #d4be8a;
    --gold-soft: rgba(186, 166, 120, 0.10);
    --gold-glow: rgba(186, 166, 120, 0.30);

    --teal: #3ac5a9;
    --teal-soft: rgba(58, 197, 169, 0.10);

    --red: #e06c6c;
    --red-soft: rgba(224, 108, 108, 0.10);

    --ivory: #f0ead6;

    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;

    --font-display: 'Amiri', serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
    --shadow-glow-gold: 0 0 40px rgba(186,166,120,0.15);
    --shadow-glow-emerald: 0 0 40px rgba(46,204,113,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 600px 400px at 20% 10%, rgba(46,204,113,0.04), transparent),
        radial-gradient(ellipse 500px 500px at 80% 90%, rgba(186,166,120,0.03), transparent);
}

body::after {
    content: "";
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z' fill='none' stroke='%23baa678' stroke-width='0.5'/%3E%3Cpath d='M40 10L70 40L40 70L10 40Z' fill='none' stroke='%23baa678' stroke-width='0.3'/%3E%3C/svg%3E");
    background-size: 80px 80px;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

::selection {
    background: var(--gold-soft);
    color: var(--gold-bright);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.app {
    position: relative; z-index: 1;
    max-width: 560px; margin: 0 auto;
    padding: 28px 18px 48px;
    display: flex; flex-direction: column; gap: 22px;
}

@media (min-width: 900px) {
    .app {
        max-width: 760px;
        padding: 36px 28px 56px;
        gap: 26px;
    }
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.lang-toggle {
    min-width: 86px;
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right;
}

html[dir="rtl"] .topbar,
html[dir="rtl"] .section-head,
html[dir="rtl"] .live-cockpit-bar,
html[dir="rtl"] .transcript-head,
html[dir="rtl"] .session-head,
html[dir="rtl"] .session-actions {
    direction: rtl;
}

html[dir="rtl"] .live-cockpit-controls,
html[dir="rtl"] .header-actions {
    justify-content: flex-start;
}

.ornament {
    display: block;
    margin: 0 auto;
    height: 2px;
    width: 80px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
}

.ornament-wide {
    width: 140px;
}

.bismillah {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--gold-bright);
    opacity: 0.85;
    line-height: 1.8;
    letter-spacing: 0.02em;
    text-shadow: 0 0 20px rgba(186,166,120,0.25);
}

.topbar {
    display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
}

.logo { display: flex; align-items: center; gap: 14px; }

.logo-icon {
    width: 50px; height: 50px; border-radius: 14px;
    background: linear-gradient(135deg, var(--emerald-deep) 0%, var(--surface3) 100%);
    border: 1px solid var(--border-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
    box-shadow: var(--shadow-glow-emerald);
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 50%);
    border-radius: inherit;
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 1.3rem; font-weight: 700;
    line-height: 1.2; color: var(--ivory);
}

.logo-text p {
    font-size: 0.72rem; color: var(--text-muted);
    margin-top: 3px; letter-spacing: 0.04em;
}

.pill,
.link-pill,
.small-btn {
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; padding: 0 16px; height: 38px;
    white-space: nowrap; font-size: 0.78rem; font-weight: 600;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text-secondary);
    cursor: pointer; transition: all 0.25s ease;
    letter-spacing: 0.02em;
}

.pill:hover, .link-pill:hover, .small-btn:hover {
    background: var(--surface3); border-color: var(--border-accent);
    color: var(--text); transform: translateY(-1px);
}

.conn-dot {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.76rem; color: var(--text-muted);
}
.conn-dot .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--surface3); transition: all 0.4s ease;
}
.conn-dot .dot.ok {
    background: var(--emerald);
    box-shadow: 0 0 12px var(--emerald-glow);
}
.conn-dot .dot.err { background: var(--red); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

/* Accordéon réglages : pas de rognage du bloc tarifs à l’ouverture */
details.card {
    overflow: visible;
}

.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

.config-card {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }

.field label {
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--text-muted);
}

select, input[type="text"], input[type="password"] {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-xs); color: var(--text);
    padding: 0 14px; height: 44px;
    font-size: 0.86rem; font-weight: 500;
    transition: border-color 0.2s;
    -webkit-appearance: none; appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6960' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

select:disabled, input:disabled, button:disabled {
    opacity: 0.35; cursor: not-allowed;
}

.live-card {
    background:
        linear-gradient(180deg, rgba(46,204,113,0.04) 0%, var(--surface) 100%);
    border: 1px solid rgba(46,204,113,0.12);
    border-radius: var(--radius);
    padding: 24px 18px;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
}

.live-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--emerald-soft), var(--gold-soft), transparent);
}

.live-status {
    font-size: 1rem; font-weight: 600;
    color: var(--text-muted); text-align: center;
    min-height: 1.4em; transition: color 0.3s;
}
.live-status.active { color: var(--text); }

.live-meta, .live-transcript {
    text-align: center; max-width: 100%; word-break: break-word;
}
.live-meta { font-size: 0.78rem; color: var(--text-muted); }
.live-transcript { font-size: 0.82rem; line-height: 1.5; opacity: 0.9; }

.live-btn {
    width: 160px; height: 160px; border-radius: 50%;
    border: 3px solid var(--emerald-deep);
    background: radial-gradient(circle at 50% 40%, var(--emerald-soft), var(--surface) 70%);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    box-shadow: var(--shadow-glow-emerald);
}

.live-btn::before {
    content: "";
    position: absolute; inset: -8px; border-radius: 50%;
    border: 1px solid rgba(46,204,113,0.08);
    transition: all 0.4s;
}

.live-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 0 60px rgba(46,204,113,0.2);
}
.live-btn:hover::before { border-color: rgba(46,204,113,0.15); }
.live-btn:active { transform: scale(0.97); }

.live-btn .btn-emoji { font-size: 2.8rem; line-height: 1; transition: font-size 0.4s ease; }
.live-btn .btn-label {
    font-size: 0.72rem; font-weight: 800; color: var(--emerald);
    text-transform: uppercase; letter-spacing: 0.12em;
}
.live-btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.live-btn.live-active {
    width: 80px; height: 80px;
    border-color: var(--emerald);
    background: radial-gradient(circle, var(--emerald-soft), var(--surface));
    box-shadow: 0 0 30px var(--emerald-glow);
}
.live-btn.live-active .btn-emoji { font-size: 1.5rem; }
.live-btn.live-active .btn-label { font-size: 0.62rem; }

.live-btn.live-connecting {
    border-color: var(--gold);
    background: radial-gradient(circle, var(--gold-soft), var(--surface));
    box-shadow: var(--shadow-glow-gold);
    animation: breathe 2.5s ease-in-out infinite;
}
.live-btn.live-connecting .btn-label { color: var(--gold); }

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 20px rgba(186,166,120,0.15); }
    50% { box-shadow: 0 0 50px rgba(186,166,120,0.25); }
}

.mute-btn {
    width: 100%; max-width: 320px; height: 56px;
    border-radius: 999px; border: 2px solid var(--border);
    background: var(--surface2); color: var(--text);
    cursor: pointer; font-size: 0.95rem; font-weight: 800;
    padding: 0 28px; transition: all 0.25s ease;
    letter-spacing: 0.02em;
}
.mute-btn:hover { background: var(--surface3); border-color: var(--border-accent); }
.mute-btn:disabled { opacity: 0.3; cursor: not-allowed; height: 44px; font-size: 0.82rem; }
.mute-btn.muted {
    border-color: var(--red); background: var(--red-soft);
    color: var(--red); box-shadow: 0 0 20px rgba(224,108,108,0.15);
}

.mode-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.imam-notes-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.imam-notes-input {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(6, 10, 8, 0.42);
    color: var(--text);
    padding: 16px;
    line-height: 1.7;
    font-size: 0.98rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.imam-notes-input:focus {
    border-color: rgba(186,166,120,0.34);
    box-shadow: 0 0 0 3px rgba(186,166,120,0.08);
}

.imam-notes-reader {
    min-height: 120px;
    border-radius: 18px;
    border: 1px solid rgba(46,204,113,0.12);
    background:
        radial-gradient(circle at 0% 0%, rgba(46,204,113,0.08), transparent 36%),
        rgba(6, 10, 8, 0.62);
    padding: 18px;
    color: var(--ivory);
    font-family: var(--font-display);
    font-size: var(--imam-notes-font-size, 1.55rem);
    line-height: 1.65;
    white-space: pre-wrap;
    max-height: 42vh;
    overflow-y: auto;
}

.imam-notes-card.live-reading .imam-notes-reader {
    border-color: rgba(46,204,113,0.28);
    box-shadow: inset 0 0 30px rgba(46,204,113,0.04), var(--shadow-glow-emerald);
}

.live-cockpit-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at top, rgba(46,204,113,0.10), transparent 34%),
        linear-gradient(180deg, #060a08 0%, #0a0f0d 100%);
    display: grid;
    grid-template-rows: auto auto 1fr;
    overflow: hidden;
}

.live-cockpit-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(6, 10, 8, 0.94);
    backdrop-filter: blur(16px);
}

.live-cockpit-bar h2 {
    font-family: var(--font-display);
    color: var(--ivory);
    font-size: clamp(1.3rem, 3vw, 2rem);
    line-height: 1.1;
}

.live-cockpit-status {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.live-cockpit-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.live-cockpit-controls .action-btn {
    width: auto;
    min-width: 142px;
    height: 44px;
    padding-inline: 18px;
    font-weight: 900;
}

.live-cockpit-controls .action-btn.primary {
    border-color: rgba(46,204,113,0.38);
    background: linear-gradient(135deg, rgba(46,204,113,0.20), rgba(46,204,113,0.08));
}

.live-cockpit-controls .action-btn.danger {
    border-color: rgba(224,108,108,0.50);
    background: linear-gradient(135deg, rgba(224,108,108,0.22), rgba(224,108,108,0.08));
    color: var(--red);
}

.live-cockpit-controls .action-btn.on-air {
    box-shadow: 0 0 28px rgba(46,204,113,0.26);
}

.live-cockpit-controls .mute-btn {
    width: auto;
    min-width: 170px;
    height: 58px;
    padding-inline: 24px;
    font-size: 1rem;
    border-width: 2px;
    box-shadow: var(--shadow-glow-emerald);
}

.live-cockpit-controls .mute-btn.muted {
    box-shadow: 0 0 26px rgba(224,108,108,0.22);
}

.cockpit-telemetry {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.6fr) minmax(110px, 0.7fr);
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(186,166,120,0.12);
    background: rgba(10, 15, 13, 0.92);
}

.cockpit-live-pill,
.cockpit-meter-card,
.cockpit-silence-timer {
    min-height: 72px;
    border: 1px solid rgba(186,166,120,0.16);
    border-radius: 18px;
    background: rgba(255,255,255,0.035);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 24px rgba(0,0,0,0.16);
}

.cockpit-live-pill {
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cockpit-live-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--text-muted);
    box-shadow: 0 0 0 rgba(255,255,255,0);
}

.cockpit-live-pill.on-air {
    color: var(--emerald);
    border-color: rgba(46,204,113,0.38);
    background: rgba(46,204,113,0.08);
}

.cockpit-live-pill.on-air .cockpit-live-dot {
    background: var(--emerald);
    box-shadow: 0 0 22px rgba(46,204,113,0.72);
    animation: liveBlink 1.15s ease-in-out infinite;
}

.cockpit-live-pill.connecting {
    color: var(--gold);
    border-color: rgba(186,166,120,0.35);
}

.cockpit-live-pill.translating {
    color: var(--gold);
    border-color: rgba(186,166,120,0.52);
    background: rgba(186,166,120,0.10);
}

.cockpit-live-pill.translating .cockpit-live-dot {
    background: var(--gold);
    box-shadow: 0 0 22px rgba(186,166,120,0.72);
    animation: liveBlink 0.8s ease-in-out infinite;
}

.cockpit-live-pill.paused {
    color: var(--red);
    border-color: rgba(224,108,108,0.35);
    background: rgba(224,108,108,0.08);
}

@keyframes liveBlink {
    0%, 100% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.25); opacity: 1; }
}

.cockpit-meter-card {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

.cockpit-meter-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.cockpit-meter-head strong {
    color: var(--ivory);
    font-size: 0.82rem;
}

.cockpit-voice-bars {
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.cockpit-voice-bars span {
    --bar-height: 12px;
    width: 5px;
    height: var(--bar-height);
    min-height: 8px;
    border-radius: 999px;
    background: rgba(186,166,120,0.32);
    transition: height 80ms linear, background 120ms ease, box-shadow 120ms ease;
}

.cockpit-voice-bars span.active {
    background: var(--emerald);
    box-shadow: 0 0 12px rgba(46,204,113,0.48);
}

.cockpit-silence-timer {
    flex-direction: column;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cockpit-silence-timer strong {
    color: var(--ivory);
    font-size: clamp(1.45rem, 4vw, 2.15rem);
    line-height: 1;
}

.cockpit-silence-timer.warning {
    border-color: rgba(224,108,108,0.48);
    background: rgba(224,108,108,0.10);
}

.cockpit-silence-timer.warning strong {
    color: var(--red);
}

.cockpit-silence-timer.translating {
    border-color: rgba(186,166,120,0.48);
    background: rgba(186,166,120,0.10);
}

.cockpit-silence-timer.translating strong {
    color: var(--gold);
}

.live-cockpit-notes {
    min-height: 0;
    overflow: hidden;
    padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
}

.cockpit-notes-input {
    height: 100%;
    min-height: 0;
    resize: none;
    font-family: var(--font-display);
    font-size: var(--imam-notes-font-size, 1.1rem);
    line-height: 1.75;
    background:
        radial-gradient(circle at 0% 0%, rgba(186,166,120,0.07), transparent 34%),
        rgba(6, 10, 8, 0.68);
    border-color: rgba(186,166,120,0.16);
    padding: clamp(18px, 4vw, 34px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 760px) {
    .live-cockpit-modal {
        grid-template-rows: auto auto minmax(0, 1fr);
    }

    .live-cockpit-bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: calc(9px + env(safe-area-inset-top)) 10px 8px;
    }

    .live-cockpit-bar .eyebrow {
        font-size: 0.58rem;
        letter-spacing: 0.12em;
    }

    .live-cockpit-bar h2 {
        font-size: 1.05rem;
    }

    .live-cockpit-status {
        margin-top: 2px;
        font-size: 0.72rem;
        line-height: 1.25;
    }

    .live-cockpit-controls {
        width: 100%;
        justify-content: stretch;
        gap: 6px;
    }

    .live-cockpit-controls .action-btn,
    .live-cockpit-controls .mute-btn,
    .live-cockpit-controls .small-btn {
        flex: 1 1 auto;
        min-width: 0;
        height: 38px;
        padding-inline: 10px;
        font-size: 0.76rem;
    }

    .live-cockpit-controls .mute-btn {
        height: 42px;
        font-size: 0.82rem;
    }

    .cockpit-telemetry {
        grid-template-columns: minmax(70px, 0.85fr) minmax(138px, 1.5fr) minmax(74px, 0.9fr);
        gap: 6px;
        padding: 6px 8px;
    }

    .cockpit-live-pill,
    .cockpit-meter-card,
    .cockpit-silence-timer {
        min-height: 48px;
        border-radius: 14px;
    }

    .cockpit-live-pill {
        gap: 6px;
        font-size: 0.58rem;
        letter-spacing: 0.04em;
        padding-inline: 6px;
    }

    .cockpit-live-dot {
        width: 9px;
        height: 9px;
    }

    .cockpit-meter-card {
        gap: 4px;
        padding: 6px 8px;
    }

    .cockpit-meter-head {
        font-size: 0.58rem;
    }

    .cockpit-meter-head > span {
        display: none;
    }

    .cockpit-meter-head strong {
        width: 100%;
        text-align: center;
        font-size: 0.66rem;
    }

    .cockpit-voice-bars {
        height: 22px;
        gap: 2px;
    }

    .cockpit-voice-bars span {
        width: 3px;
        min-height: 5px;
    }

    .cockpit-silence-timer {
        font-size: 0.52rem;
        letter-spacing: 0.03em;
    }

    .cockpit-silence-timer span {
        display: none;
    }

    .cockpit-silence-timer strong {
        font-size: 1.25rem;
    }

    .live-cockpit-notes {
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    }

    .cockpit-notes-input {
        padding: 14px;
        font-size: var(--imam-notes-font-size, 1rem);
        line-height: 1.62;
    }
}

.mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mode-switch-btn {
    min-height: 48px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-switch-btn:hover {
    border-color: var(--border-accent);
    background: var(--surface3);
    color: var(--text);
    transform: translateY(-1px);
}

.mode-switch-btn.active {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(186,166,120,0.16), rgba(186,166,120,0.08));
    color: var(--gold-bright);
    box-shadow: var(--shadow-glow-gold);
}

.mode-note {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.preach-preview-card {
    gap: 16px;
}

.preach-preview-stage {
    min-height: 220px;
    border-radius: 18px;
    border: 1px solid rgba(186,166,120,0.12);
    background:
        radial-gradient(circle at 50% 0%, rgba(186,166,120,0.08), transparent 42%),
        linear-gradient(180deg, rgba(6,10,8,0.82), rgba(15,26,20,0.96));
    padding: 26px 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 14px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.28);
}

.preach-preview-kicker {
    font-size: 0.74rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.9;
}

.preach-preview-source {
    font-size: 0.8rem;
    line-height: 1.5;
    letter-spacing: 0.03em;
    color: rgba(58, 197, 169, 0.95);
    background: rgba(58, 197, 169, 0.08);
    border: 1px solid rgba(58, 197, 169, 0.18);
    border-radius: 999px;
    padding: 8px 12px;
    width: fit-content;
    max-width: 100%;
}

.preach-preview-previous {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.55;
    color: rgba(240,234,214,0.42);
}

.preach-preview-current {
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 4vw, 2.5rem);
    line-height: 1.28;
    color: var(--ivory);
    text-wrap: balance;
    text-shadow: 0 10px 32px rgba(0,0,0,0.35);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.preach-preview-current.is-live {
    color: #f7f1df;
    transform: translateY(-1px);
}

body.preach-screen-body {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at top, rgba(186,166,120,0.12), transparent 36%),
        linear-gradient(180deg, #060a08 0%, #0a0f0d 42%, #08110d 100%);
}

.preach-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 24px calc(32px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.preach-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.preach-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preach-title h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.2vw, 2.7rem);
    color: var(--ivory);
}

.preach-title p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 780px;
    line-height: 1.5;
}

.preach-window-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.preach-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 28px;
    border: 1px solid rgba(186,166,120,0.1);
    background:
        radial-gradient(circle at center, rgba(186,166,120,0.06), transparent 38%),
        linear-gradient(180deg, rgba(8,13,10,0.88), rgba(6,10,8,0.98));
    padding: clamp(28px, 5vw, 64px);
    box-shadow: 0 24px 90px rgba(0,0,0,0.38);
}

.preach-stage-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preach-stage-copy {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preach-stage-source {
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    line-height: 1.55;
    letter-spacing: 0.03em;
    color: rgba(58, 197, 169, 0.95);
    background: rgba(58, 197, 169, 0.08);
    border: 1px solid rgba(58, 197, 169, 0.18);
    border-radius: 999px;
    padding: 10px 16px;
    max-width: min(1100px, 100%);
    width: fit-content;
}

.preach-stage-previous {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    line-height: 1.45;
    color: rgba(240,234,214,0.34);
    max-width: 1100px;
}

.preach-stage-current {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4.7rem);
    line-height: 1.22;
    color: var(--ivory);
    text-shadow: 0 14px 40px rgba(0,0,0,0.35);
    max-width: 1200px;
    text-wrap: balance;
}

.preach-stage-current.is-live {
    color: #fff7e5;
}

.preach-empty {
    color: rgba(240,234,214,0.58);
}

@media (max-width: 720px) {
    .mode-switch {
        grid-template-columns: 1fr;
    }

    .preach-shell {
        padding-inline: 16px;
    }

    .preach-stage {
        border-radius: 22px;
    }
}

.transcript-card, .session-editor, .sessions-card, .auth-card {
    display: flex; flex-direction: column; gap: 14px;
}

.transcript-head, .section-head, .session-item-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
}

.eyebrow, .transcript-title {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.14em;
    color: var(--gold);
}

.transcript-count, .section-subtitle, .meta-line {
    font-size: 0.72rem; color: var(--text-muted);
}

.section-subtitle { line-height: 1.5; }

.transcript-body {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 280px; overflow-y: auto;
    padding: 14px 16px; font-size: 0.84rem; line-height: 1.6;
    color: var(--text); white-space: pre-wrap; word-break: break-word;
}

.transcript-empty, .empty-state {
    color: var(--text-muted); font-style: italic;
    font-size: 0.84rem;
}

.transcript-segment {
    margin-bottom: 10px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.transcript-segment:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

.transcript-actions, .session-actions, .auth-actions {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch;
}

.header-actions {
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
}

.session-actions > .action-btn,
.session-actions > .transcript-btn,
.session-actions > .link-pill {
    flex: 1 1 0;
    min-width: 0;
}

.session-actions > .link-pill {
    height: 44px;
    min-height: 44px;
}

.transcript-btn, .action-btn {
    min-height: 44px; padding: 0 20px;
    font-size: 0.8rem; font-weight: 700;
    white-space: nowrap; flex: 1;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text-secondary);
    cursor: pointer; transition: all 0.25s ease;
    letter-spacing: 0.02em;
}
.transcript-btn:hover, .action-btn:hover {
    background: var(--surface3); border-color: var(--border-accent);
    color: var(--text); transform: translateY(-1px);
}
.transcript-btn:disabled, .action-btn:disabled {
    opacity: 0.35; cursor: not-allowed; transform: none;
}

.primary {
    border-color: var(--gold); background: var(--gold-soft);
    color: var(--gold-bright);
}
.primary:hover { background: rgba(186,166,120,0.18); box-shadow: var(--shadow-glow-gold); }

.success {
    border-color: var(--emerald-deep); background: var(--emerald-soft);
    color: var(--emerald);
}
.success:hover { background: rgba(46,204,113,0.15); box-shadow: var(--shadow-glow-emerald); }

.danger {
    border-color: rgba(224,108,108,0.3); background: transparent;
    color: var(--red);
}
.danger:hover { background: var(--red-soft); }

.icon-btn {
    flex: 0 0 44px !important;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.session-item {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.session-item:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
}

.session-title {
    font-family: var(--font-display);
    font-size: 1.05rem; font-weight: 700;
    color: var(--ivory);
}

.status-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 26px; border-radius: 999px; padding: 0 12px;
    font-size: 0.68rem; font-weight: 800;
    letter-spacing: 0.06em; text-transform: uppercase;
}
.status-badge.published {
    background: var(--emerald-soft); color: var(--emerald);
    box-shadow: 0 0 8px var(--emerald-soft);
}
.status-badge.draft {
    background: var(--gold-soft); color: var(--gold);
}
.status-badge.archived {
    background: rgba(255,255,255,0.05); color: var(--text-muted);
}

.session-audio {
    width: 100%; border-radius: var(--radius-xs);
    filter: sepia(0.2) hue-rotate(80deg);
}

.auth-screen {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px; position: relative; z-index: 1;
    background:
        radial-gradient(ellipse 500px 400px at 50% 30%, rgba(46,204,113,0.06), transparent),
        radial-gradient(ellipse 400px 400px at 50% 70%, rgba(186,166,120,0.04), transparent);
}

.auth-card {
    width: min(100%, 440px);
    background: linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%);
    border: 1px solid var(--border-accent);
    box-shadow: var(--shadow-lg), var(--shadow-glow-gold);
}

.auth-card .logo-icon {
    width: 64px; height: 64px; border-radius: 18px;
    font-size: 32px;
    box-shadow: var(--shadow-glow-gold);
    background: linear-gradient(135deg, var(--surface3) 0%, var(--surface) 100%);
    border-color: var(--gold);
}

.helper {
    font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55;
}

.feedback {
    min-height: 1.2em; font-size: 0.82rem; color: var(--text-muted);
    transition: color 0.2s;
}
.feedback.error { color: var(--red); }
.feedback.success { color: var(--emerald); }

.footer-note {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
    padding-top: 8px;
}

details.card summary { user-select: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card[open] summary::after { content: "▲"; font-size: 0.6rem; color: var(--text-muted); margin-left: auto; }
details.card:not([open]) summary::after { content: "▼"; font-size: 0.6rem; color: var(--text-muted); margin-left: auto; }

@media (min-width: 900px) {
    #settingsAccordion.card {
        padding: 22px 24px 26px;
    }
    #settingsAccordion .config-card {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .app { padding: 16px 12px 32px; gap: 14px; }
    .config-card { grid-template-columns: 1fr; }
    .logo-icon { width: 38px; height: 38px; font-size: 18px; border-radius: 10px; }
    .logo-text h1 { font-size: 1.05rem; }
    .logo-text p { font-size: 0.68rem; }
    .live-btn { width: 130px; height: 130px; }
    .live-btn .btn-emoji { font-size: 2.2rem; }
    .live-btn.live-active { width: 70px; height: 70px; }
    .live-btn.live-active .btn-emoji { font-size: 1.3rem; }
    .mute-btn { height: 52px; font-size: 0.9rem; }
    .transcript-body { max-height: 180px; font-size: 0.78rem; padding: 12px; }
    .bismillah { font-size: 1.3rem; }
    .auth-card .logo-icon { width: 56px; height: 56px; font-size: 28px; }
    .topbar { gap: 8px; align-items: center; }
    .logo { min-width: 0; flex: 1; gap: 10px; }
    .logo-text { min-width: 0; }
    .logo-text h1, .logo-text p { overflow-wrap: anywhere; }
    .session-actions { gap: 6px; }
    .header-actions { flex-wrap: nowrap; }
    .link-pill, .small-btn { padding: 0 12px; height: 34px; font-size: 0.72rem; }
    .card { padding: 14px; border-radius: 16px; }
    .live-card { padding: 20px 14px; }
    .action-btn, .transcript-btn { min-height: 48px; font-size: 0.82rem; }
    .session-actions > .link-pill { height: 48px; min-height: 48px; }
    .icon-btn { flex-basis: 48px !important; width: 48px; min-width: 48px; max-width: 48px; }
    .session-item { padding: 12px; border-radius: 14px; }
    .session-title { font-size: 0.95rem; }
    select, input[type="text"], input[type="password"] { height: 42px; font-size: 0.84rem; }
}
