:root {
    color-scheme: light;
    --page: #f6f8fc;
    --surface: #ffffff;
    --surface-soft: #f1f5fa;
    --surface-hover: #e9eff8;
    --ink: #18243b;
    --muted: #62718a;
    --border: #dce4ef;
    --blue: #2463eb;
    --blue-hover: #174fcb;
    --blue-soft: #edf3ff;
    --blue-ink: #194fc2;
    --purple: #7657f6;
    --purple-hover: #6544e8;
    --danger: #dc3545;
    --danger-soft: #fff0f1;
    --success: #16835c;
    --warning: #ac6a12;
    --shadow: 0 8px 30px #20365a0f;
    --radius: 14px;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--page);
    color: var(--ink);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page: #0e1521;
    --surface: #172131;
    --surface-soft: #1d2a3d;
    --surface-hover: #26364d;
    --ink: #e9effa;
    --muted: #a5b4cb;
    --border: #304057;
    --blue: #77a7ff;
    --blue-hover: #9abdff;
    --blue-soft: #223a60;
    --blue-ink: #b6d0ff;
    --purple: #a98cff;
    --purple-hover: #bda6ff;
    --danger: #e94a5b;
    --danger-soft: #432330;
    --success: #64d7ab;
    --warning: #edbd6f;
    --shadow: 0 8px 30px #00000040;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--ink);
}

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

button {
    cursor: pointer;
}

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

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

:is(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 92px;
    padding: 8px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
}

.brand img {
    display: block;
    width: 76px;
    height: 76px;
    object-fit: contain;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex: 0 0 auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.badge.ok::before {
    background: var(--success);
}

.badge.pending::before {
    background: var(--warning);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.button.primary:hover:not(:disabled) {
    background: var(--blue-hover);
    border-color: var(--blue-hover);
}

.button.secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}

.button.secondary:hover:not(:disabled) {
    background: var(--surface-hover);
}

.button.ghost {
    background: transparent;
    color: var(--muted);
}

.button.purple {
    background: linear-gradient(135deg, #7657f6, #a45cff);
    border: 0;
    color: #fff;
    box-shadow: 0 10px 24px #7657f633;
}

.button.purple:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--purple-hover), #9348ee);
}

.button.enabled {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 20px 72px;
}

.eyebrow {
    color: var(--blue-ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    margin: 8px 0 0;
    font-size: clamp(30px, 4vw, 40px);
    line-height: 1.15;
    letter-spacing: -1.2px;
}

h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.4px;
}

.lede {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
    max-width: 620px;
}

.progress {
    display: flex;
    gap: 8px;
    margin: 26px 0 22px;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.progress li {
    flex: 1;
    padding: 10px 12px;
    border-top: 2px solid var(--border);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.progress li::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero) "  ";
    color: var(--blue-ink);
}

.progress li.current {
    border-color: var(--blue);
    color: var(--ink);
}

.progress li.completed {
    border-color: var(--success);
    color: var(--ink);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.card h2 {
    margin-bottom: 4px;
}

.section-copy {
    margin: 6px 0 22px;
    color: var(--muted);
    font-size: 14px;
}

.step[hidden] {
    display: none;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
    margin-top: 18px;
}

.field {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}

.field.full {
    grid-column: 1 / -1;
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 400;
}

.field input:hover,
.field select:hover {
    border-color: var(--muted);
}

.help {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
}

.tabs {
    display: flex;
    gap: 6px;
    margin-top: 18px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.tabs button {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.tabs button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--blue-ink);
    box-shadow: var(--shadow);
}

.panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.account {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.account p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    max-width: 420px;
}

.translate-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 22px;
    padding: 14px 16px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, #7657f6, #a45cff);
    color: #fff;
    text-align: left;
    box-shadow: 0 10px 24px #7657f633;
}

.translate-cta:hover {
    background: linear-gradient(135deg, var(--purple-hover), #9348ee);
}

.translate-cta .spark {
    font-size: 22px;
}

.translate-cta strong,
.translate-cta small {
    display: block;
}

.translate-cta small {
    margin-top: 2px;
    color: #f1eaff;
    font-size: 11.5px;
}

.preview {
    position: relative;
    aspect-ratio: 16 / 9;
    margin-bottom: 18px;
    border: 1px solid #ffffff12;
    border-radius: 16px;
    background: radial-gradient(ellipse at 50% 20%, #263952, #101827 85%);
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #dce9ff;
}

.preview video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #05070b;
}

.preview .avatar {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: #37619b33;
    border: 1px solid #91b4ef33;
    font-size: 30px;
    font-weight: 600;
}

.preview .hint {
    position: absolute;
    left: 14px;
    bottom: 12px;
    color: #a9b8cf;
    font-size: 12px;
}

.media-actions {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.media-actions .button {
    width: 100%;
    min-height: 50px;
}

.meter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.meter {
    flex: 1;
    height: 7px;
    border-radius: 6px;
    background: var(--border);
    overflow: hidden;
}

.meter span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--success);
    transition: width 0.12s linear;
}

.meter-row output {
    min-width: 92px;
    text-align: right;
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.footer-actions .primary,
.footer-actions .purple {
    flex: 1;
    min-height: 50px;
}

.alert {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
}

.notice {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue-ink);
    font-size: 13px;
}

.room-result {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.room-result code {
    display: block;
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    overflow-wrap: anywhere;
}

dialog {
    width: min(440px, calc(100vw - 24px));
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 70px #0a152a33;
}

dialog::backdrop {
    background: #080e1880;
}

.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.dialog-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.dialog-actions .button {
    flex: 1;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-soft);
}

tr:last-child td {
    border-bottom: 0;
}

.status {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status.pending {
    background: #fdf3e2;
    color: var(--warning);
}

.status.approved {
    background: #e4f7ef;
    color: var(--success);
}

.status.disabled {
    background: var(--danger-soft);
    color: var(--danger);
}

html[data-theme="dark"] .status.pending {
    background: #3b2f1b;
}

html[data-theme="dark"] .status.approved {
    background: #16342a;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.stat .label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat .value {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.6px;
}

.stat .meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.chart-card {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.chart-card h3 {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

canvas {
    display: block;
    width: 100%;
    height: 160px;
}

.service-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.service {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

.service::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.service.active::before {
    background: var(--success);
}

.service.down::before {
    background: var(--danger);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -0.6px;
}

@media (max-width: 760px) {
    .app-header {
        min-height: 82px;
        padding-inline: 12px;
        gap: 8px;
    }

    .brand img {
        width: 64px;
        height: 64px;
    }

    .header-actions {
        gap: 6px;
    }

    .badge {
        display: none;
    }

    .page {
        padding: 26px 14px 56px;
    }

    .card {
        padding: 18px;
    }

    .field-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .progress li {
        padding: 8px 8px;
        font-size: 10px;
    }
}

@media (max-width: 420px) {
    .header-actions .button {
        padding-inline: 10px;
        font-size: 12px;
    }

    .progress {
        gap: 4px;
    }
}
