/* app.css — оформление Безлико: плоское, светлая и тёмная тема по prefers-color-scheme, системные шрифты.
   Внешних шрифтов и значков нет (CSP style-src 'self'); атрибутов style и тегов <style> в разметке нет. */

:root {
    color-scheme: light dark;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1c222b;
    --muted: #5a6472;
    --border: #d5dae1;
    --hover: #eceff3;
    --accent: #1f5fae;
    --accent-text: #ffffff;
    --accent-soft: #e3edf9;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --focus: #1f5fae;
    --backdrop: rgba(15, 20, 28, 0.45);
    --radius: 6px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171c;
        --surface: #1c2027;
        --text: #e5e8ed;
        --muted: #9aa4b2;
        --border: #353c46;
        --hover: #262b33;
        --accent: #6ea6ec;
        --accent-text: #0e1218;
        --accent-soft: #1d2c40;
        --danger: #f0786c;
        --danger-soft: #3a1f1d;
        --focus: #8dbaf2;
        --backdrop: rgba(0, 0, 0, 0.6);
    }
}

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

[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.25;
}

p {
    margin: 0 0 0.75em;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- Кнопки ---------- */

button, .button {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.4em 0.9em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

button:hover, .button:hover {
    background: var(--hover);
}

button:disabled {
    cursor: default;
    opacity: 0.55;
}

button.danger {
    border-color: var(--danger);
    color: var(--danger);
}

button.danger:hover {
    background: var(--danger-soft);
}

.button {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-text);
}

.button:hover {
    background: var(--accent);
    opacity: 0.9;
}

/* ---------- Шапка ---------- */

.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.brand {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.mode-tabs {
    display: flex;
    gap: 0.25rem;
}

.mode-tabs [role="tab"] {
    border-color: transparent;
    background: transparent;
    font-weight: 600;
}

.mode-tabs [role="tab"]:hover {
    background: var(--hover);
}

.mode-tabs [role="tab"][aria-selected="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.privacy-badge {
    border-color: transparent;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.9em;
}

.privacy-badge:hover {
    background: var(--accent-soft);
    text-decoration: underline;
}

/* ---------- Основная часть ---------- */

.app-main {
    flex: 1;
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.mode-panel:focus-visible {
    outline-offset: 6px;
}

.steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

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

.steps button:hover {
    background: var(--hover);
}

.steps button[aria-current="step"] {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    border-radius: 50%;
    background: var(--hover);
    font-weight: 600;
}

.steps button[aria-current="step"] .step-num {
    background: var(--accent);
    color: var(--accent-text);
}

.step-panel {
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.step-panel h2 {
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.placeholder {
    margin: 1rem 0 0;
    padding: 2.5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* ---------- Строка состояния ---------- */

.status {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    max-width: calc(100% - 2rem);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    background: var(--text);
    color: var(--bg);
}

.status:empty {
    display: none;
}

/* ---------- Окна ---------- */

.app-dialog {
    width: min(44rem, calc(100% - 2rem));
    max-height: calc(100vh - 3rem);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}

.app-dialog[open] {
    display: flex;
    flex-direction: column;
}

.app-dialog-small {
    width: min(28rem, calc(100% - 2rem));
}

.app-dialog::backdrop {
    background: var(--backdrop);
}

.dialog-head, .dialog-foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
}

.dialog-head {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
    font-size: 1.15rem;
}

.dialog-x {
    padding: 0.1em 0.5em;
    border-color: transparent;
    font-size: 1.3rem;
    line-height: 1;
}

.dialog-body {
    overflow: auto;
    padding: 1rem 1.25rem;
}

.dialog-body h3 {
    margin: 1.25rem 0 0.5rem;
    font-size: 1rem;
}

.dialog-body ul {
    margin: 0 0 0.75em;
    padding-left: 1.25rem;
}

.dialog-body li + li {
    margin-top: 0.35em;
}

.dialog-body fieldset {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.85rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.dialog-body fieldset:disabled {
    color: var(--muted);
}

.dialog-body fieldset label {
    display: block;
    margin-top: 0.25rem;
}

.dialog-body select {
    padding: 0.3em 0.5em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

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

.dialog-foot {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
    .app-header, .app-main {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .header-actions {
        margin-left: 0;
    }
}
