/**
 * KENVARA UI foundation.
 * Файл: app/assets/css/app.css
 * Базовая версия: 2026-09-09-ui-reset.6
 *
 * Правило:
 * - здесь хранится вся общая основа интерфейса KENVARA;
 * - модульные CSS содержат только уникальную композицию конкретного модуля;
 * - базовые правила не переопределяются в модульных CSS без объективной причины.
 */

:root {
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    /* Canonical UI type scale */
    --font-size-accent-heading: 17px;
    --font-size-base: 15px;
    --font-size-secondary: 15px;
    --font-size-caption: 14px;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Colors */
    --color-page: #f4f6f9;
    --color-surface: #ffffff;
    --color-surface-soft: #f8fafc;
    --color-border: #e1e6ee;
    --color-border-strong: #d6dce6;
    --color-text: #172033;
    --color-text-secondary: #687386;
    --color-text-muted: #8a94a6;
    --color-primary: #5b43d6;
    --color-primary-hover: #4933bc;
    --color-primary-soft: #f0edff;
    --color-success: #137249;
    --color-success-bg: #effbf5;
    --color-success-border: #bfe9d7;
    --color-danger: #b82e3d;
    --color-danger-bg: #fff0f2;
    --color-danger-border: #f2c9cf;

    /* Geometry */
    --workspace-width: 90%;
    --radius-control: 4px;
    --radius-card: 4px;
    --radius-panel: 4px;

    /* Effects */
    --focus-ring: 0 0 0 3px rgba(91, 67, 214, 0.12);
    --shadow-panel: 0 10px 28px rgba(31, 41, 55, 0.06);
}

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

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    display: flex;
    min-height: 100vh;
    margin: 0;
    flex-direction: column;
    background: var(--color-page);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: 1.45;
    text-rendering: optimizeLegibility;
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

button,
select {
    cursor: pointer;
}

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

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

/* --------------------------------------------------------------------------
   AUTH FOUNDATION
   Общие элементы страниц входа, регистрации и восстановления доступа.
   -------------------------------------------------------------------------- */

body.kenvara-auth-page {
    min-height: 100vh;
}

.kenvara-auth-logo {
    display: block;
    width: fit-content;
    line-height: 0;
    text-decoration: none;
}

.kenvara-auth-logo img {
    width: 300px;
    height: auto;
}

.kenvara-auth-card {
    width: 100%;
}

.kenvara-auth-heading {
    margin-bottom: 24px;
}

.kenvara-auth-heading h1 {
    margin: 0;
    color: var(--color-text);
    font-size: 30px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.kenvara-auth-heading p {
    margin: 8px 0 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.4;
}

.kenvara-auth-alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-control);
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-size: var(--font-size-base);
    line-height: 1.45;
}

.kenvara-auth-alert--success {
    border-color: var(--color-success-border);
    background: var(--color-success-bg);
    color: var(--color-success);
}

.kenvara-auth-field {
    margin-bottom: 19px;
}

.kenvara-auth-field label,
.kenvara-auth-label {
    display: block;
    margin: 0 0 8px;
    color: #344159;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.35;
}

.kenvara-auth-control {
    display: block;
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    border: 1px solid #dce2eb;
    border-radius: var(--radius-control);
    outline: none;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-base);
    line-height: 1.35;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.kenvara-auth-control::placeholder {
    color: #9aa3b2;
}

.kenvara-auth-control:hover {
    border-color: var(--color-border-strong);
}

.kenvara-auth-control:focus {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.kenvara-auth-control--error {
    border-color: var(--color-danger);
}

.kenvara-auth-error,
.kenvara-auth-hint {
    margin-top: 6px;
    font-size: var(--font-size-base);
    line-height: 1.4;
}

.kenvara-auth-error {
    color: var(--color-danger);
}

.kenvara-auth-hint {
    color: var(--color-text-muted);
}

.kenvara-auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    padding: 12px 18px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--color-primary);
    color: #ffffff;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.kenvara-auth-submit:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 8px 20px rgba(91, 67, 214, 0.20);
}

.kenvara-auth-submit:active {
    transform: translateY(1px);
}

.kenvara-auth-submit:focus-visible {
    outline-color: var(--color-primary);
}

.kenvara-auth-button-link {
    text-decoration: none;
}

.kenvara-auth-links {
    margin-top: 19px;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    text-align: center;
}

.kenvara-auth-links a,
.kenvara-auth-inline-link {
    color: var(--color-primary);
    font-size: inherit;
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
}

.kenvara-auth-links a:hover,
.kenvara-auth-inline-link:hover {
    text-decoration: underline;
}

.kenvara-auth-secondary-row {
    display: flex;
    justify-content: flex-end;
    margin: -6px 0 18px;
    font-size: var(--font-size-base);
    line-height: 1.4;
}

input.kenvara-auth-control:-webkit-autofill,
input.kenvara-auth-control:-webkit-autofill:hover,
input.kenvara-auth-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text);
    -webkit-box-shadow: 0 0 0 1000px var(--color-surface) inset;
    transition: background-color 9999s ease-out 0s;
}

/* --------------------------------------------------------------------------
   CANONICAL PRODUCT PAGE HEADER
   Единая компактная шапка рабочих продуктовых страниц KENVARA.
   -------------------------------------------------------------------------- */

.kenvara-page-head {
    display: flex;
    width: 100%;
    min-height: 62px;
    margin: 0 0 10px;
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.kenvara-page-head-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.kenvara-page-kicker {
    margin: 0;
    color: var(--color-primary);
    font-size: var(--font-size-accent-heading);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
}

.kenvara-page-description {
    max-width: 760px;
    margin: 3px 0 0;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: 1.35;
}

.kenvara-page-head-side {
    display: flex;
    min-width: 0;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.kenvara-page-head-summary {
    display: flex;
    min-width: 0;
    align-items: stretch;
    justify-content: flex-end;
    gap: 6px;
}

.kenvara-page-head-stat {
    display: flex;
    min-width: 88px;
    min-height: 42px;
    padding: 5px 9px;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-soft);
    color: inherit;
    text-decoration: none;
}

.kenvara-page-head-stat:hover {
    border-color: #d3cdf1;
    background: #fbfaff;
}

.kenvara-page-head-stat small {
    color: var(--color-text-muted);
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-regular);
    line-height: 1.15;
    white-space: nowrap;
}

.kenvara-page-head-stat strong {
    margin-top: 2px;
    color: var(--color-text);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.kenvara-page-head-stat.is-danger {
    border-color: var(--color-danger-border);
}

.kenvara-page-head-stat.is-danger small,
.kenvara-page-head-stat.is-danger strong {
    color: var(--color-danger);
}

.kenvara-page-head-stat.is-warning strong {
    color: #956313;
}

.kenvara-page-primary-action,
.kenvara-page-secondary-action {
    display: inline-flex;
    min-height: 42px;
    padding: 8px 13px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-control);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.kenvara-page-primary-action {
    border: 1px solid var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.kenvara-page-primary-action:hover {
    border-color: var(--color-primary-hover);
    background: var(--color-primary-hover);
}

.kenvara-page-secondary-action {
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-secondary);
}

.kenvara-page-secondary-action:hover {
    border-color: #c8c0ef;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

@media (max-width: 1180px) {
    .kenvara-page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .kenvara-page-head-side {
        width: 100%;
        justify-content: space-between;
    }

    .kenvara-page-head-summary {
        flex: 1 1 auto;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 700px) {
    .kenvara-page-head {
        padding: 10px;
    }

    .kenvara-page-head-side {
        align-items: stretch;
        flex-direction: column;
    }

    .kenvara-page-head-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kenvara-page-head-stat {
        min-width: 0;
    }

    .kenvara-page-primary-action,
    .kenvara-page-secondary-action {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   APPLICATION FOOTER
   Единый footer клиентской части KENVARA.
   -------------------------------------------------------------------------- */

.app-footer {
    display: flex;
    width: var(--workspace-width);
    margin: auto auto 0;
    padding: 13px 0 18px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: var(--font-size-caption);
    font-weight: var(--font-weight-regular);
    line-height: 1.4;
}

.app-footer-brand,
.app-footer-meta,
.app-footer-telegram {
    display: inline-flex;
    align-items: center;
}

.app-footer-brand {
    min-width: 0;
    gap: 7px;
}

.app-footer-name {
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
}

.app-footer-separator {
    color: #b4bcc9;
}

.app-footer-tagline {
    color: var(--color-text-muted);
}

.app-footer-meta {
    flex: 0 0 auto;
    gap: 14px;
}

.app-footer-telegram {
    gap: 6px;
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: color 0.15s ease;
}

.app-footer-telegram:hover {
    color: var(--color-primary);
}

.app-footer-telegram-icon {
    display: inline-flex;
    width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.app-footer-telegram-icon svg {
    width: 17px;
    height: 17px;
}

.app-footer-year {
    color: var(--color-text-muted);
    white-space: nowrap;
}

@media (max-width: 650px) {
    .app-footer {
        width: calc(100% - 28px);
        margin-top: auto;
        padding: 11px 0 14px;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .app-footer-meta {
        width: 100%;
        justify-content: space-between;
    }
}

