:root {
    --bg: #f4efe6;
    --panel: rgba(255, 251, 245, 0.92);
    --border: #d9c4a0;
    --text: #2a241d;
    --muted: #665c51;
    --accent: #a7442d;
    --accent-dark: #7b2d1b;
    --success: #2f6b49;
    --error: #a02121;
    --shadow: 0 24px 60px rgba(75, 49, 30, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(167, 68, 45, 0.18), transparent 32%),
        radial-gradient(circle at right center, rgba(217, 196, 160, 0.45), transparent 28%),
        linear-gradient(180deg, #f6f0e8 0%, #efe3d4 100%);
    font-family: Georgia, "Times New Roman", serif;
}

.page {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.hero,
.panel {
    background: var(--panel);
    border: 1px solid rgba(217, 196, 160, 0.7);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.hero {
    padding: 28px;
    margin-bottom: 20px;
}

.hero-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent-dark);
    font-size: 0.78rem;
}

h1, h2 {
    margin: 0 0 12px;
}

.lead,
.helper,
.status-text {
    color: var(--muted);
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.workflow .steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding-left: 0;
    list-style: none;
    margin: 0 0 18px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #efe1d0;
    color: var(--accent-dark);
    padding: 8px 14px;
    font-weight: 700;
    margin-top: 8px;
}

.workflow-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.step-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 248, 240, 0.75);
    border: 1px solid rgba(217, 196, 160, 0.6);
    color: var(--muted);
}

.step-item strong,
.step-item span {
    display: block;
}

.step-item strong {
    color: var(--text);
    margin-bottom: 4px;
}

.step-index {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ead3b7;
    color: var(--accent-dark);
    font-weight: 700;
    flex-shrink: 0;
}

.step-item.is-active,
.step-item.is-complete {
    background: rgba(250, 242, 232, 0.98);
    border-color: rgba(167, 68, 45, 0.32);
}

.step-item.is-active .step-index,
.step-item.is-complete .step-index {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff9f4;
}

.step-item.is-active {
    box-shadow: inset 0 0 0 1px rgba(167, 68, 45, 0.12);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.button-row.compact {
    margin-bottom: 0;
}

button,
.upload-field {
    font: inherit;
}

button {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff9f4;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

button.secondary {
    background: linear-gradient(135deg, #7c705f, #5f5444);
}

.upload-field {
    display: grid;
    gap: 10px;
    color: var(--muted);
}

.session-panel-head,
.result-topbar,
.panel-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.session-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.meta-card {
    padding: 14px;
    border-radius: 18px;
    background: #fffaf4;
    border: 1px solid rgba(217, 196, 160, 0.6);
    min-height: 92px;
}

.meta-card strong,
.meta-card span {
    display: block;
}

.meta-label {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.recording-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(160, 33, 33, 0.08);
    border: 1px solid rgba(160, 33, 33, 0.2);
    color: var(--error);
}

.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
    box-shadow: 0 0 0 0 rgba(160, 33, 33, 0.45);
    animation: pulse 1.35s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(160, 33, 33, 0.45); }
    70% { box-shadow: 0 0 0 12px rgba(160, 33, 33, 0); }
    100% { box-shadow: 0 0 0 0 rgba(160, 33, 33, 0); }
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.login-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.login-card {
    background: var(--panel);
    border: 1px solid rgba(217, 196, 160, 0.7);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 30px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    gap: 26px;
    align-items: stretch;
}

.login-intro {
    padding: 10px 6px 10px 4px;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.login-brand-mark {
    width: 48px;
    height: 48px;
    display: block;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(123, 45, 27, 0.18);
    object-fit: cover;
}

.login-brand-copy {
    display: grid;
    gap: 3px;
}

.login-brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.login-brand-tag {
    color: var(--muted);
    font-size: 0.9rem;
}

.login-intro h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 0.96;
    margin-bottom: 16px;
}

.login-intro .lead {
    max-width: 52ch;
    font-size: 1.05rem;
    line-height: 1.6;
}

.login-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 18px;
}

.login-pill {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: #efe1d0;
    border: 1px solid rgba(167, 68, 45, 0.12);
    color: var(--accent-dark);
    font-size: 0.92rem;
}

.login-note {
    max-width: 58ch;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 249, 242, 0.95), rgba(245, 232, 214, 0.9));
    border: 1px solid rgba(217, 196, 160, 0.8);
    color: var(--muted);
    line-height: 1.55;
}

.login-panel {
    background: rgba(255, 252, 247, 0.92);
    border: 1px solid rgba(217, 196, 160, 0.65);
    border-radius: 22px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-panel-header h2 {
    margin-bottom: 6px;
}

.login-panel-header p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.login-form input {
    width: 100%;
    border: 1px solid rgba(217, 196, 160, 0.85);
    border-radius: 14px;
    padding: 14px;
    background: #fffaf4;
    font: inherit;
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-form input:focus {
    outline: none;
    border-color: rgba(167, 68, 45, 0.7);
    box-shadow: 0 0 0 4px rgba(167, 68, 45, 0.12);
    background: #fffefb;
}

.login-form button {
    margin-top: 4px;
}

.password-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.95rem;
    user-select: none;
}

.password-toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

input[type="file"] {
    width: 100%;
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #fffaf4;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.result-workspace {
    display: grid;
    gap: 18px;
}

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-button {
    background: #efe1d0;
    color: var(--accent-dark);
}

.tab-button.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff9f4;
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.panel-card {
    padding: 18px;
    border-radius: 20px;
    background: #fffcf7;
    border: 1px solid rgba(217, 196, 160, 0.55);
}

.summary {
    line-height: 1.65;
}

.note-grid {
    display: grid;
    gap: 14px;
}

.note-section {
    border: 1px solid rgba(217, 196, 160, 0.55);
    border-radius: 18px;
    background: #fffcf7;
    overflow: hidden;
}

.note-section summary {
    cursor: pointer;
    list-style: none;
    padding: 16px 18px;
    font-weight: 700;
    background: rgba(239, 225, 208, 0.4);
}

.note-section summary::-webkit-details-marker {
    display: none;
}

.note-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    padding: 16px 18px 18px;
}

.note-fields.stacked {
    grid-template-columns: 1fr;
}

.note-field {
    padding: 14px;
    border-radius: 16px;
    background: #fff9f2;
    border: 1px solid rgba(217, 196, 160, 0.55);
}

.note-field span,
.note-field strong {
    display: block;
}

.note-field span {
    color: var(--muted);
    font-size: 0.86rem;
    margin-bottom: 8px;
}

.note-field strong {
    line-height: 1.55;
    font-weight: 600;
}

.note-field input,
.note-field textarea,
.review-notes-field textarea {
    width: 100%;
    border: 1px solid rgba(217, 196, 160, 0.8);
    border-radius: 12px;
    padding: 12px;
    background: #fffefb;
    font: inherit;
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
}

.note-field input:focus,
.note-field textarea:focus,
.review-notes-field textarea:focus {
    outline: none;
    border-color: rgba(167, 68, 45, 0.7);
    box-shadow: 0 0 0 4px rgba(167, 68, 45, 0.12);
}

.warning-field {
    border-color: rgba(167, 68, 45, 0.3);
    background: linear-gradient(180deg, rgba(255, 245, 235, 0.95), rgba(255, 249, 242, 0.95));
}

.review-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #fff9f4;
    border-color: rgba(255, 249, 244, 0.16);
    box-shadow: 0 10px 26px rgba(75, 49, 30, 0.18);
}

.review-banner strong,
.review-banner span {
    color: #fff9f4;
}

#reviewBanner.review-banner {
    background: linear-gradient(135deg, #a7442d, #7b2d1b);
}

#approvalBanner.review-banner {
    background: linear-gradient(135deg, #2f6b49, #234d35);
}

.small-toggle,
.copy-button {
    padding: 10px 14px;
}

.review-actions-card {
    display: grid;
    gap: 14px;
}

.review-notes-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.review-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 50;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100% - 36px));
}

.toast {
    padding: 14px 16px;
    border-radius: 16px;
    color: #fff9f4;
    box-shadow: var(--shadow);
    animation: toast-in 0.22s ease;
}

.toast.success {
    background: linear-gradient(135deg, #2f6b49, #234d35);
}

.toast.error {
    background: linear-gradient(135deg, #a02121, #7e1818);
    color: #fff9f4;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.output,
.summary {
    min-height: 220px;
    border-radius: 16px;
    padding: 16px;
    background: #fffdf8;
    border: 1px solid rgba(217, 196, 160, 0.6);
}

.output {
    white-space: pre-wrap;
    word-break: break-word;
}

.empty {
    color: #8a8073;
}

.hidden {
    display: none !important;
}

.error {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #a02121, #7e1818);
    border: 1px solid rgba(255, 249, 244, 0.16);
    color: #fff9f4;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(126, 24, 24, 0.18);
}

audio {
    width: 100%;
    margin-top: 10px;
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 20px, 1000px);
        padding-top: 18px;
    }

    .hero,
    .panel {
        border-radius: 18px;
        padding: 18px;
    }

    .hero-topbar {
        flex-direction: column;
    }

    .workflow-bar,
    .session-panel-head,
    .result-topbar,
    .panel-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-shell {
        width: min(100% - 20px, 1000px);
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .login-card {
        grid-template-columns: 1fr;
        padding: 18px;
        gap: 18px;
    }

    .login-intro h1 {
        max-width: none;
    }

    .login-panel {
        padding: 18px;
    }

    .toast-stack {
        right: 10px;
        left: 10px;
        width: auto;
    }
}

@media (max-width: 860px) {
    .login-card {
        grid-template-columns: 1fr;
    }
}
