* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #eef2f7;
    color: #1f2933;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px;
}

.app-shell {
    width: 100%;
    max-width: 980px;
    background: white;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12);
}

.app-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 8px 0;
    font-size: 34px;
}

.subtitle {
    margin: 0;
    color: #52616b;
    font-size: 17px;
}

.status-pill {
    white-space: nowrap;
    padding: 10px 14px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #1f6feb;
    font-weight: bold;
}

.interpreter-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.mode-card {
    border: 1px solid #d8e1ea;
    border-radius: 20px;
    padding: 24px;
    background: #f8fafc;
    min-height: 330px;
    display: flex;
    flex-direction: column;
}

.active-mode {
    border-color: #b7d4ff;
    background: #f7fbff;
}

.disabled-mode {
    opacity: 0.68;
}

.mode-label {
    display: inline-block;
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #1f6feb;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 14px;
}

.mode-card h2 {
    margin: 0 0 10px;
    font-size: 28px;
}

.mode-card p {
    margin: 0;
    color: #52616b;
    line-height: 1.45;
}

.big-action-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.big-action-btn {
    width: 100%;
    min-height: 104px;
    border: none;
    border-radius: 24px;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    background: #15803d;
    color: white;
    box-shadow: 0 12px 28px rgba(21, 128, 61, 0.25);
}

.big-action-btn.recording {
    background: #b42318;
    box-shadow: 0 12px 28px rgba(180, 35, 24, 0.25);
}

.disabled-big-btn {
    background: #9aa6b2;
    cursor: not-allowed;
    box-shadow: none;
}

.status {
    min-height: 24px;
    margin-top: 8px !important;
    color: #374151 !important;
    text-align: center;
    font-weight: bold;
}

.muted-status {
    color: #6b7280 !important;
    font-weight: normal;
}

.quick-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    border: 1px solid #e1e7ef;
    border-radius: 16px;
    padding: 14px;
    background: #ffffff;
    margin-bottom: 18px;
}

button {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 16px;
    cursor: pointer;
    background: #1f6feb;
    color: white;
}

button:disabled {
    background: #9aa6b2;
    cursor: not-allowed;
}

#clearBtn {
    background: #6b7280;
}

.secondary-btn {
    background: #e5e7eb;
    color: #1f2933;
    padding: 9px 13px;
    font-size: 14px;
}

.details-panel {
    border: 1px solid #e1e7ef;
    border-radius: 16px;
    padding: 14px 16px;
    background: #ffffff;
    margin-bottom: 16px;
}

.details-panel summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
}

.transcript-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}

.text-panel {
    border: 1px solid #e1e7ef;
    border-radius: 16px;
    padding: 16px;
    background: #ffffff;
}

label {
    display: block;
    margin: 0 0 8px;
    font-weight: bold;
}

textarea {
    width: 100%;
    resize: vertical;
    padding: 12px;
    font-size: 17px;
    line-height: 1.45;
    border: 1px solid #ccd6dd;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

.timing-panel {
    margin-top: 16px;
    border-radius: 14px;
    background: #ffffff;
}

.timing-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.timing-grid > div {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    background: #f9fafb;
}

.timing-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
}

.timing-value {
    display: block;
    font-weight: bold;
    font-size: 16px;
}

.delay-summary {
    margin: 12px 0 0;
    color: #374151;
    font-weight: bold;
}

.history-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 22px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.history-header h2 {
    margin: 0;
    font-size: 22px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.empty-history {
    margin: 0;
    color: #6b7280;
}

.history-entry {
    border: 1px solid #d8e1ea;
    border-radius: 14px;
    padding: 14px;
    background: #f9fafb;
}

.history-number {
    font-weight: bold;
    color: #1f6feb;
    margin-bottom: 8px;
}

.history-label {
    font-size: 13px;
    font-weight: bold;
    color: #6b7280;
    text-transform: uppercase;
    margin-top: 8px;
}

.history-text {
    margin: 4px 0 8px;
    line-height: 1.45;
}

@media (max-width: 760px) {
    .page {
        padding: 14px;
    }

    .app-shell {
        padding: 18px;
    }

    .app-header {
        flex-direction: column;
    }

    .interpreter-panel {
        grid-template-columns: 1fr;
    }

    .transcript-grid {
        grid-template-columns: 1fr;
    }

    .quick-controls {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .timing-grid {
        grid-template-columns: 1fr;
    }
}
.streaming-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 28px;
}

.danger-btn {
    background: #b42318;
}

.event-log {
    white-space: pre-wrap;
    background: #111827;
    color: #e5e7eb;
    padding: 14px;
    border-radius: 12px;
    max-height: 260px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.45;
}
.dialog-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
}
.direction-panel h2 {
    margin-top: 0;
}

.direction-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.direction-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid #d8e1ea;
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    background: #f9fafb;
}

.direction-option input {
    margin-top: 4px;
}

.direction-option strong {
    display: block;
    margin-bottom: 5px;
}

.direction-option small {
    display: block;
    color: #6b7280;
    line-height: 1.35;
}

.active-direction {
    border-color: #1f6feb;
    background: #f7fbff;
}

.direction-option:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.65;
}

@media (max-width: 760px) {
    .direction-options {
        grid-template-columns: 1fr;
    }
}

.phone-dashboard {
    border: 1px solid #d8e1ea;
    border-radius: 18px;
    padding: 18px;
    background: #f8fafc;
    margin-bottom: 22px;
}

.phone-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.phone-dashboard-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.phone-dashboard-header p {
    margin: 0;
    color: #52616b;
}

.connection-badge {
    white-space: nowrap;
    padding: 9px 13px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 14px;
}

.connection-badge.idle {
    background: #e5e7eb;
    color: #374151;
}

.connection-badge.connected {
    background: #dcfce7;
    color: #166534;
}

.connection-badge.partial {
    background: #fef3c7;
    color: #92400e;
}

.connection-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

.phone-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.phone-status-grid > div,
.phone-file-list > div {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 11px;
    background: #ffffff;
    min-width: 0;
}

.phone-status-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

.phone-status-value {
    display: block;
    font-size: 15px;
    color: #1f2933;
    overflow-wrap: anywhere;
}

.mono {
    font-family: monospace;
    font-size: 13px;
}

.error-text {
    color: #991b1b;
}

.phone-files-details {
    margin-top: 14px;
}

.phone-files-details summary {
    cursor: pointer;
    font-weight: bold;
}

.phone-file-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 760px) {
    .phone-dashboard-header {
        flex-direction: column;
    }

    .phone-status-grid {
        grid-template-columns: 1fr;
    }
}
.browser-call-panel {
    border: 1px solid #d8e1ea;
    border-radius: 18px;
    padding: 18px;
    background: #ffffff;
    margin-bottom: 22px;
}

.browser-call-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.browser-call-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.browser-call-header p {
    margin: 0;
    color: #52616b;
}

.browser-call-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.browser-call-btn {
    min-width: 180px;
}

.browser-call-status {
    margin: 14px 0 0;
    color: #374151;
    font-weight: bold;
}

@media (max-width: 760px) {
    .browser-call-header {
        flex-direction: column;
    }

    .browser-call-actions {
        flex-direction: column;
    }

    .browser-call-btn {
        width: 100%;
    }
}

/* Full-Duplex tab */
.full-duplex-call-green {
    background: #16a34a;
    color: white;
    border-color: #15803d;
}

.full-duplex-call-green:hover {
    background: #15803d;
}

/* Full-Duplex compact call setup */
.full-duplex-call-setup {
    max-width: 760px;
}

.full-duplex-language-row {
    max-width: 260px;
    margin-bottom: 12px;
}

.full-duplex-number-row {
    display: grid;
    grid-template-columns: 120px 220px 150px;
    gap: 12px;
    align-items: end;
}

/* Full-Duplex call setup alignment */
.full-duplex-call-setup {
    max-width: none;
    width: 100%;
}

.full-duplex-number-row {
    display: grid;
    grid-template-columns: 120px 240px 150px;
    gap: 12px;
    align-items: start;
    justify-content: start;
}

.full-duplex-number-row #fullDuplexCallBtn {
    margin-top: 24px;
    height: 46px;
    align-self: start;
}


/* Room Interpreter tab */
.room-interpreter-card {
    border: 1px solid #dbe3ef;
    border-radius: 22px;
    background: #ffffff;
    padding: 24px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
    display: grid;
    gap: 18px;
}

.room-interpreter-hero {
    border: 1px solid #dbe3ef;
    border-radius: 20px;
    background: #f8fafc;
    padding: 22px;
}


.room-interpreter-hero h2 {
    margin: 0;
    color: #0f172a;
    font-size: 2rem;
}

.room-interpreter-hero p {
    margin: 8px 0 0;
    color: #475569;
    line-height: 1.5;
    max-width: 760px;
}

.room-interpreter-section {
    border: 1px solid #dbe3ef;
    border-radius: 18px;
    background: #f8fafc;
    padding: 18px;
}

.room-interpreter-section-header {
    margin-bottom: 16px;
}

.room-interpreter-section-header h3,
.room-interpreter-status-grid h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 1.1rem;
}

.room-interpreter-section-header p {
    margin: 0;
    color: #64748b;
    line-height: 1.45;
}

.room-interpreter-language-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px 120px;
    gap: 12px;
    align-items: end;
}

.room-interpreter-field {
    display: grid;
    gap: 7px;
    color: #0f172a;
    font-weight: 800;
}

.room-interpreter-field select {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    font-size: 1rem;
    background: #ffffff;
}

.room-interpreter-start-button,
.room-interpreter-stop-button {
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    font-weight: 900;
    cursor: pointer;
    min-height: 48px;
}

.room-interpreter-start-button {
    background: #16a34a;
    color: #ffffff;
}

.room-interpreter-stop-button {
    background: #dc2626;
    color: #ffffff;
}

.room-interpreter-status-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    gap: 18px;
}

.room-interpreter-status-box {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #bbf7d0;
    border-radius: 16px;
    background: #f0fdf4;
    color: #14532d;
    padding: 16px;
    font-weight: 800;
    min-height: 64px;
}

.room-interpreter-status-dot {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    background: #22c55e;
    flex: 0 0 auto;
}

.room-interpreter-status-dot.listening {
    background: #0f62d8;
}

.room-interpreter-status-dot.paused {
    background: #f59e0b;
}

.room-interpreter-hint {
    margin: 10px 0 0;
    color: #475569;
    line-height: 1.45;
}







@media (max-width: 900px) {
    .room-interpreter-language-row,
    .room-interpreter-status-grid {
        grid-template-columns: 1fr;
    }

    .room-interpreter-start-button,
    .room-interpreter-stop-button {
        width: 100%;
    }
}


.room-interpreter-translation-card {
    display: grid;
    gap: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    background: #ffffff;
    padding: 16px;
}

.room-interpreter-translation-card span {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.room-interpreter-translation-card p {
    margin: 0;
    color: #0f172a;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-line;
}







@media (max-width: 900px) {

