/* Дизайн-система веб-панели — design/design-guide.md, живой макет design/mockup.html */

:root {
    --ink: #0E0E0E;
    --paper: #FFFFFF;
    --mist: #C7D8D6;
    --sand: #EADFC4;
    --moss: #98A98F;
    --haze: #E9EEF0;
    --muted: #6B6B6B;
    --stage: #1A1A1A;
    --r-card: 24px;
    --r-big: 32px;
    --r-pill: 999px;
    --font: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--stage);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a {
    color: inherit;
}

/* Артборд: белая карточка на тёмном фоне — так задумано дизайн-гидом */
.board {
    max-width: 1180px;
    margin: 40px auto;
    background: var(--paper);
    border-radius: var(--r-big);
    padding: 40px 48px 48px;
    min-height: calc(100vh - 80px);
}

/* --- шапка --- */
.top {
    display: flex;
    align-items: center;
    gap: 12px 36px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.logo {
    font-style: italic;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -.02em;
    text-decoration: none;
    color: var(--ink);
}

.nav {
    display: flex;
    gap: 22px;
    font-size: 14px;
    margin-left: 8px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--ink);
    text-decoration: none;
    padding: 4px 0;
}

.nav a.on,
.nav a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.top-right {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.dot-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--r-pill);
    background: var(--ink);
    display: inline-block;
    flex-shrink: 0;
}

.pill-btn {
    border: 1px solid var(--ink);
    border-radius: var(--r-pill);
    padding: 9px 22px;
    font-size: 14px;
    background: none;
    color: var(--ink);
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-family: var(--font);
    white-space: nowrap;
}

.pill-btn:hover {
    background: var(--haze);
}

/* --- типографика --- */
.display {
    font-style: italic;
    font-weight: 700;
    font-size: 64px;
    line-height: .95;
    letter-spacing: -.03em;
    margin: 0;
}

.display--sm {
    font-size: 40px;
}

h1, h2 {
    font-style: italic;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0 0 8px;
}

h1 {
    font-size: 44px;
    line-height: 1;
}

h2 {
    font-size: 32px;
    line-height: 1.05;
}

h3, .h-card {
    font-style: normal;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: -.01em;
    margin: 0 0 8px;
}

p {
    font-size: 16px;
    line-height: 1.55;
    margin: 0 0 16px;
}

.caption {
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--muted);
}

.sup {
    font-size: 11px;
    vertical-align: super;
    color: var(--muted);
}

/* подпись, приклеенная к базовой линии заголовка */
.display-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

/* --- теги-пилюли --- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--ink);
    border-radius: var(--r-pill);
    padding: 6px 14px;
    font-size: 13px;
    background: var(--paper);
    color: var(--ink);
    white-space: nowrap;
}

.tag::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ink);
    flex-shrink: 0;
}

.tag--plain::before {
    display: none;
}

.tag--dashed {
    border-style: dashed;
    color: var(--muted);
    border-color: var(--muted);
}

/* --- круглая кнопка-стрелка --- */
.arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--paper);
    display: grid;
    place-items: center;
    font-size: 16px;
    border: 1px solid rgba(0, 0, 0, .12);
    text-decoration: none;
    color: var(--ink);
    flex-shrink: 0;
}

.arrow--ink {
    background: var(--ink);
    color: var(--paper);
    border: none;
}

/* --- кнопки --- */
.btn {
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: var(--r-pill);
    padding: 14px 30px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: opacity .15s;
}

.btn:hover {
    opacity: .82;
}

.btn-secondary {
    background: none;
    color: var(--ink);
    border: 1px solid var(--ink);
}

.btn-secondary:hover {
    background: var(--haze);
    opacity: 1;
}

.btn-secondary.on {
    background: var(--mist);
    color: var(--ink);
    border-color: var(--mist);
}

.btn-secondary.on:hover {
    background: #b3ccc9;
    border-color: #b3ccc9;
}

.btn-small {
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
}

/* --- формы --- */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group--row {
    flex-direction: row;
    align-items: center;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    border: 1px solid var(--ink);
    border-radius: var(--r-pill);
    padding: 13px 20px;
    font-size: 15px;
    font-family: var(--font);
    background: var(--paper);
    color: var(--ink);
    width: 100%;
}

textarea {
    border-radius: 20px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--moss);
    outline-offset: 1px;
}

input[type="checkbox"] {
    width: auto;
    accent-color: var(--ink);
}

label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

/* поле ввода для минимальной длины и весов в таблицах */
.input-min-length {
    width: 100px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    text-align: center;
    border: 1px solid var(--ink) !important;
    border-radius: var(--r-pill) !important;
    background: var(--paper) !important;
    color: var(--ink) !important;
}

input[type="number"].weight-input {
    width: 100px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    text-align: center;
    border: 1px solid var(--ink) !important;
    border-radius: var(--r-pill) !important;
    background: var(--paper) !important;
    color: var(--ink) !important;
}

/* иконка-кнопка сохранения */
.btn-icon {
    padding: 9px 20px !important;
    font-size: 16px !important;
    font-weight: 400;
    min-width: auto;
    width: auto;
    flex-shrink: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- карточки --- */
.card {
    border-radius: var(--r-card);
    padding: 24px;
    border: 1px solid var(--haze);
    background: var(--paper);
}

.card--mist { background: var(--mist); border-color: transparent; }
.card--sand { background: var(--sand); border-color: transparent; }
.card--moss { background: var(--moss); border-color: transparent; }
.card--haze { background: var(--haze); border-color: transparent; }

.card-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* --- сетки --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-topics {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- алерты --- */
.alert {
    border-radius: var(--r-card);
    padding: 16px 24px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-error {
    background: var(--sand);
}

.alert-success {
    background: var(--mist);
}

/* --- карточка со снимком ---
   Компонент «карточка материала» из дизайн-гайда: снимок сверху,
   заголовок и мета снизу. Снимок — приглушённых тонов, без ярких пятен,
   чтобы не создавать второй акцент рядом с --mist/--sand/--moss. */
.card-photo {
    border-radius: var(--r-card);
    overflow: hidden;
    position: relative;
    background: var(--haze);
}

.card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- форма входа --- */
.login-wrap {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    min-height: calc(100vh - 88px);
    padding: 24px 0;
}

.login-photo {
    flex: 1 1 0;
    max-width: 420px;
    border-radius: var(--r-big);
    overflow: hidden;
    position: relative;
    background: var(--mist);
}

.login-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-photo .notch {
    position: absolute;
    left: 24px;
    bottom: 24px;
    background: var(--paper);
    border-radius: var(--r-card);
    padding: 16px 20px;
    max-width: calc(100% - 48px);
}

.login-form-wrap {
    flex: 1 1 0;
    max-width: 380px;
    display: flex;
    align-items: center;
}

.login-form {
    width: 100%;
}

.login-form h2 {
    margin-bottom: 28px;
}

@media (max-width: 760px) {
    .login-wrap {
        flex-direction: column;
        gap: 0;
        min-height: 0;
        padding: 0;
    }
    .login-photo {
        max-width: none;
        height: 220px;
        border-radius: 0;
        flex: none;
        margin: -24px -20px 32px;
    }
    .login-photo .notch {
        display: none;
    }
    .login-form-wrap {
        max-width: 380px;
        margin: 0 auto;
    }
}

/* --- подвал --- */
.footer {
    text-align: left;
    padding-top: 32px;
    margin-top: 48px;
    border-top: 1px solid var(--haze);
    color: var(--muted);
    font-size: 13px;
}

/* --- таблицы --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--haze);
    font-size: 14px;
}

th {
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

tr:hover td {
    background: var(--haze);
}

code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: .92em;
}

/* модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 14, 14, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    margin: 40px auto;
    background: var(--paper);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--haze);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--ink);
    opacity: 0.6;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    font-size: 14px;
    line-height: 1.6;
}

.modal-body.monospace {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--haze);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--haze);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- адаптив --- */
@media (max-width: 900px) {
    .board {
        margin: 0;
        border-radius: 0;
        padding: 24px 20px 40px;
    }
}

@media (max-width: 720px) {
    .top {
        margin-bottom: 32px;
        row-gap: 14px;
    }

    .nav {
        order: 3;
        width: 100%;
        gap: 12px 16px;
        font-size: 13px;
    }

    .display { font-size: 36px; }
    .display--sm { font-size: 28px; }
    h1 { font-size: 32px; }
    h2 { font-size: 26px; }
    h3, .h-card { font-size: 19px; }

    .grid-2,
    .grid-topics {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }

    .card-foot .btn,
    .card-foot .btn-secondary {
        flex: 1 1 auto;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea,
    .btn {
        font-size: 16px;
    }

    /* таблицы складываются в карточки */
    table, thead, tbody, th, td, tr {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tr {
        border-bottom: 1px solid var(--haze);
        padding: 12px 0;
    }

    td {
        border: none;
        padding: 6px 0;
    }

    td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .04em;
        display: block;
        margin-bottom: 2px;
    }
}
