/* ════════════════════════════════════════════════════════════
   Дизайн-система сервиса опросов «Просто Сайт»
   Палитра и компоненты повторяют стиль коммерческого предложения.
   ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --red: #C16860;
    --red-d: #A4514A;
    --cream: #EEF4FC;
    --cream-d: #DCE9F8;
    --blue-d: #C6DBF1;
    --teal: #CFE3F4;
    --pink: #F0CFC9;
    --dark: #2A2A2A;
    --muted: #6E6E6E;
    --line: #CDDCEC;
    --footer: #1B1B1B;
    --ok: #3F9A6B;
    --ok-bg: #EAF3EC;
    --warn: #C98A2E;
    --warn-bg: #FBF0E1;
    --danger: #C0504A;
    --danger-bg: #F7E7E5;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 12px 28px rgba(40,70,110,0.12);
    --shadow-lg: 0 16px 40px rgba(40,70,110,0.16);
}

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PT Sans", sans-serif;
    color: var(--dark);
    background: var(--cream);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; height: auto; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -0.2px; }
p { margin: 0 0 8px; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
input, button, textarea, select { font: inherit; color: inherit; }

/* ── Кнопки ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--line); background: #fff; color: var(--dark);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    text-align: center; line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 8px 20px rgba(193,104,96,0.30); }
.btn--primary:hover { background: var(--red-d); border-color: var(--red-d); }
.btn--ghost { background: var(--cream-d); border-color: transparent; }
.btn--soft { background: #fff; }
.btn--danger { color: var(--danger); border-color: var(--danger-bg); background: var(--danger-bg); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--lg { padding: 14px 24px; font-size: 15.5px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Карточки ───────────────────────────────────────────── */
.card {
    background: #fff; border-radius: var(--radius);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 14px rgba(40,70,110,0.06);
    padding: 22px 24px;
}
.card--pad-sm { padding: 16px 18px; }
.card__title { font-size: 16px; margin-bottom: 14px; }

/* ── Бейджи статусов ────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 99px;
    font-size: 12px; font-weight: 700; letter-spacing: .2px;
    background: var(--cream-d); color: var(--muted);
    white-space: nowrap;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--draft     { background: #EEF1F5; color: #7A8699; }
.badge--published { background: var(--cream-d); color: #3E6FB0; }
.badge--submitted { background: var(--warn-bg); color: var(--warn); }
.badge--in_review { background: var(--warn-bg); color: var(--warn); }
.badge--completed { background: var(--ok-bg); color: var(--ok); }

/* ── Чипы / теги ────────────────────────────────────────── */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 99px;
    background: var(--cream-d); color: var(--dark);
    font-size: 12.5px; font-weight: 600;
}
.chip--red { background: var(--pink); color: var(--red-d); }

/* ── Тултип ⓘ (как в КП) ────────────────────────────────── */
.tip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; margin-left: 5px; vertical-align: middle;
    border-radius: 50%; border: 1px solid var(--line);
    color: var(--muted); font-size: 10px; font-weight: 700; font-style: italic;
    line-height: 1; cursor: pointer; position: relative; flex-shrink: 0; user-select: none;
}
.tip::before { content: 'i'; }
.tip:hover, .tip:focus, .tip.open { background: var(--red); color: #fff; border-color: var(--red); outline: none; }
.tip .tip-bubble {
    position: absolute; left: 50%; bottom: calc(100% + 9px);
    transform: translateX(-50%) translateY(4px);
    width: max-content; max-width: 260px;
    background: var(--dark); color: #fff; font-size: 12px; font-weight: 400; font-style: normal;
    line-height: 1.45; text-align: left; padding: 9px 12px; border-radius: 9px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.22);
    opacity: 0; visibility: hidden; transition: opacity .15s, transform .15s;
    z-index: 60; pointer-events: none; white-space: normal;
}
.tip .tip-bubble::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--dark);
}
.tip:hover .tip-bubble, .tip:focus .tip-bubble, .tip.open .tip-bubble {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* ── Формы ──────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--dark); }
.field__hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.input, .textarea, .select {
    width: 100%; padding: 11px 13px;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none; border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(193,104,96,0.12);
}
.textarea { resize: vertical; min-height: 84px; }
.input--invalid { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

/* ── Таблицы / списки ───────────────────────────────────── */
.list { display: grid; gap: 10px; }
.row-card {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid rgba(0,0,0,0.05); border-radius: var(--radius);
    padding: 14px 18px; box-shadow: 0 3px 10px rgba(40,70,110,0.05);
    transition: transform .12s, box-shadow .15s;
}
.row-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.row-card__main { flex: 1; min-width: 0; }
.row-card__title { font-weight: 700; font-size: 15px; }
.row-card__meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.row-card__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Флэш-уведомления ───────────────────────────────────── */
.flash { position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
    z-index: 200; max-width: 92vw; }
.flash__item {
    padding: 12px 18px; border-radius: var(--radius-sm); margin-bottom: 8px;
    box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
}
.flash__item--success { background: var(--ok-bg); color: var(--ok); border: 1px solid #CDE6D6; }
.flash__item--error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #F0D2CF; }

/* ── Сетки ──────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid--2 { grid-template-columns: 1fr 1fr; }
.stat { background: #fff; border-radius: var(--radius); padding: 18px 20px; border: 1px solid rgba(0,0,0,0.05); }
.stat__num { font-size: 30px; font-weight: 800; color: var(--red); line-height: 1; }
.stat__label { color: var(--muted); font-size: 13px; margin-top: 6px; }

.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 16px; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { opacity: .5; margin-bottom: 12px; }

/* ════════════════════════════════════════════════════════
   Оболочка админки: сайдбар (десктоп) + нижняя навигация (моб.)
   ════════════════════════════════════════════════════════ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
    padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand { font-weight: 800; letter-spacing: 1.5px; color: var(--red); font-size: 16px; padding: 6px 10px 18px; }
.nav { display: grid; gap: 4px; }
.nav__link {
    display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; color: var(--dark); transition: background .12s, color .12s;
}
.nav__link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .8; }
.nav__link:hover { background: var(--cream); }
.nav__link.active { background: var(--red); color: #fff; }
.nav__link.active svg { opacity: 1; }
.sidebar__user { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: none; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
}
.topbar__brand { font-weight: 800; letter-spacing: 1px; color: var(--red); font-size: 15px; }
.content { padding: 26px 30px 40px; max-width: 1080px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; }
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.breadcrumbs a:hover { color: var(--red); }

.bottom-nav { display: none; }

@media (max-width: 860px) {
    .sidebar { display: none; }
    .topbar { display: flex; }
    .content { padding: 18px 16px 90px; }
    .page-head h1 { font-size: 21px; }
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
        background: #fff; border-top: 1px solid var(--line);
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
    }
    .bottom-nav__link {
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-radius: 10px;
        flex: 1; max-width: 80px;
    }
    .bottom-nav__link svg { width: 22px; height: 22px; }
    .bottom-nav__link.active { color: var(--red); }
    .grid--2 { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════
   Публичная страница опроса
   ════════════════════════════════════════════════════════ */
.survey-page { max-width: 720px; margin: 0 auto; padding: 0 16px 120px; }
.survey-hero { background: var(--red); color: #fff; padding: 26px 0 30px; margin-bottom: 22px; }
.survey-hero__wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.survey-hero__brand { font-weight: 800; letter-spacing: 1.5px; font-size: 13px; opacity: .9; }
.survey-hero h1 { font-size: 26px; margin: 12px 0 8px; }
.survey-hero p { opacity: .92; font-size: 14.5px; margin: 0; }

.progress { height: 8px; border-radius: 99px; background: var(--cream-d); overflow: hidden; margin-bottom: 6px; }
.progress__bar { height: 100%; background: var(--red); border-radius: 99px; transition: width .3s ease; }
.progress__label { font-size: 12.5px; color: var(--muted); text-align: right; margin-bottom: 18px; }

.q-card {
    background: #fff; border-radius: var(--radius); border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 14px rgba(40,70,110,0.06); padding: 20px 20px; margin-bottom: 14px;
}
.q-card__cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--red); margin-bottom: 8px; }
.q-card__title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.q-card__req { color: var(--red); margin-left: 3px; }
.q-card__help { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.q-card.is-missing { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192,80,74,0.10); }

/* Варианты-карточки (крупные тач-цели) */
.options { display: grid; gap: 10px; }
.option {
    display: flex; align-items: center; gap: 12px; padding: 13px 15px;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
    cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s;
}
.option:hover { border-color: var(--blue-d); background: var(--cream); }
.option.is-selected { border-color: var(--red); background: #FBF1EF; box-shadow: 0 0 0 2px rgba(193,104,96,0.12); }
.option__mark {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
    flex-shrink: 0; position: relative; transition: border-color .12s, background .12s;
}
.option--multi .option__mark { border-radius: 6px; }
.option.is-selected .option__mark { border-color: var(--red); background: var(--red); }
.option.is-selected .option__mark::after {
    content: ''; position: absolute; inset: 0; margin: auto;
    width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
    transform: translateY(-1px) rotate(-45deg);
}
.option__label { flex: 1; font-size: 14.5px; }

/* Варианты-картинки */
.options--images { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.option-img {
    position: relative; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden;
    cursor: pointer; background: #fff; transition: border-color .12s, box-shadow .12s; padding: 0;
}
.option-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.option-img__label { padding: 8px 10px; font-size: 13px; font-weight: 600; }
.option-img.is-selected { border-color: var(--red); box-shadow: var(--shadow); }
.option-img__check {
    position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
    background: var(--red); display: none; align-items: center; justify-content: center;
}
.option-img.is-selected .option-img__check { display: flex; }
.option-img__check::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }

/* Рейтинг (звёзды) */
.rating { display: flex; gap: 6px; }
.rating__star { font-size: 30px; color: var(--cream-d); cursor: pointer; transition: color .1s, transform .1s; line-height: 1; }
.rating__star:hover { transform: scale(1.1); }
.rating__star.is-on { color: var(--red); }

/* Sticky CTA внизу формы */
.survey-cta {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    background: rgba(255,255,255,0.96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.survey-cta__inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }

/* «Свой вариант» поле */
.other-field { margin-top: 8px; }

/* Read-only ответы */
.answer-block { background: var(--cream); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 10px; font-size: 14.5px; }
.answer-block__label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 4px; }
.manager-comment {
    margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--warn-bg); border-left: 3px solid var(--warn);
}
.manager-comment__label { font-size: 12px; font-weight: 700; color: var(--warn); margin-bottom: 4px; }

/* Сообщение об успехе */
.thanks { text-align: center; padding: 50px 20px; }
.thanks__icon { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }

@media (max-width: 520px) {
    .survey-hero h1 { font-size: 22px; }
    .q-card { padding: 16px 15px; }
    .card { padding: 18px 16px; }
}
