:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #d9e0ea;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.topbar div {
    display: flex;
    gap: 16px;
    align-items: baseline;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 20px;
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.narrow {
    width: min(520px, calc(100% - 32px));
    margin: 48px auto;
}

h1, h2 {
    margin: 0 0 10px;
    letter-spacing: 0;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

.stack {
    display: grid;
    gap: 14px;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input, select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 800;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.ghost {
    color: var(--accent);
    background: #e6fffb;
}

.danger {
    color: var(--danger);
    background: #fff1f0;
}

.danger:hover {
    color: #fff;
    background: var(--danger);
}

.alert, .error {
    color: var(--danger);
}

.alert {
    padding: 12px;
    border-radius: 6px;
    background: #fff1f0;
    border: 1px solid #fecdca;
}

.muted {
    color: var(--muted);
}

.progress {
    margin-top: 18px;
}

.hidden {
    display: none;
}

.bar {
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: #edf2f7;
}

.bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 180ms ease;
}

.transcript {
    min-height: 160px;
    max-height: 360px;
    overflow: auto;
    margin-top: 18px;
    white-space: pre-wrap;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
    background: #fbfcfe;
}

.history {
    display: grid;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.history-item span {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.downloads {
    display: flex;
    gap: 10px;
    align-items: start;
}

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
