/* Дизайн-система портала паблишера ROSA Market.
   Источник — макет docs/design/web/01.png: боковая навигация, карточки на
   светлом фоне, синий акцент, статус-пилюли. Из макета взята система, а не
   набор экранов: разделы без данных в бэкенде не рисуются (DEC-017).
   Внешних зависимостей нет — ни шрифтов, ни CDN, ни JS. */

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e6eaf0;
    --border-strong: #d5dbe5;
    --text: #101828;
    --muted: #667085;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff4ff;
    --ok-bg: #dcfce7;
    --ok-text: #15803d;
    --warn-bg: #fef3c7;
    --warn-text: #b45309;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --neutral-bg: #f1f5f9;
    --neutral-text: #475569;
    --radius-card: 14px;
    --radius-control: 10px;
    --sidebar-width: 232px;
    --gap: 20px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Каркас ────────────────────────────────────────────────────────── */

.shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 13px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-control);
    color: var(--neutral-text);
    font-weight: 500;
}
.nav-link:hover { background: var(--neutral-bg); text-decoration: none; }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 16px; }
.account { display: flex; align-items: center; gap: 12px; padding: 0 6px 12px; }
.account-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.account-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.account-role { color: var(--muted); font-size: 12px; }

.content {
    margin-left: var(--sidebar-width);
    padding: 26px 30px 40px;
    max-width: 1180px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: var(--gap);
}
.page-title { font-size: 27px; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }

.footer {
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

/* ── Карточки ──────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 20px 22px;
    margin-bottom: var(--gap);
}
.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.card-title { font-size: 17px; font-weight: 700; margin: 0; }
.card-note { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }

/* ── Управляющие элементы ──────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--neutral-text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--neutral-bg); }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; font-weight: 500; cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--neutral-text); margin-bottom: 6px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="file"],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--primary-soft);
    border-color: var(--primary);
}
.field-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* ── Состояния ─────────────────────────────────────────────────────── */

.alert {
    border-radius: var(--radius-control);
    padding: 12px 14px;
    margin-bottom: 16px;
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 14px;
}
.alert-warn { background: var(--warn-bg); color: var(--warn-text); }
.empty { color: var(--muted); }

.pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral-text); }
/* Заведены заранее под статусы модерации Epic 07; сейчас не используются. */
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-danger { background: var(--danger-bg); color: var(--danger-text); }

/* ── Таблица приложений ────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-name { font-weight: 600; }
.table-sub { color: var(--muted); font-size: 13px; }

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--neutral-bg);
    flex: none;
}
.app-cell { display: flex; align-items: center; gap: 12px; }
.app-icon-fallback {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--neutral-bg);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: none;
}

.media-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.media-grid img { border-radius: 10px; border: 1px solid var(--border); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ── Страницы входа ────────────────────────────────────────────────── */

.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 28px;
    width: 100%;
    max-width: 400px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-title { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.auth-note { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ── Узкий экран ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
        inset: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .sidebar-foot { margin-top: 0; border-top: none; padding-top: 0; margin-left: auto; }
    .account { padding: 0; gap: 8px; }
    .account-name, .account-role { display: none; }
    .content { margin-left: 0; padding: 18px 16px 32px; }
    .page-title { font-size: 23px; }
    .card { padding: 16px; }
}
