/* Fonts (локально: Oswald cyrillic + latin + ext; Great Vibes) */
@font-face {
    font-family: 'Oswald';
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/oswald-cyrillic.woff2) format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Oswald';
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/oswald-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Oswald';
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/oswald-latin-ext.woff2) format('woff2');
    unicode-range: U+20BD;
}
@font-face {
    font-family: 'Great Vibes';
    font-weight: 400;
    font-display: swap;
    src: url(fonts/greatvibes-cyrillic.woff2) format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Great Vibes';
    font-weight: 400;
    font-display: swap;
    src: url(fonts/greatvibes-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Фирменный стиль «Бон Аппетит» (DESIGN.md) */
:root {
    --primary-orange: #FF8000;
    --secondary-navy: #0B254D;
    --orange-text: #B35600;
    --bg-neutral: #F2F2F2;
    --white: #FFFFFF;
    --muted: #4a5b78;
    --error: #B00020;
    --green: #108A44;
    --green-bg: #ECFDF5;
    --border-radius: 20px;
    --bold-outline: 3px solid var(--secondary-navy);
    --orange-outline: 3px solid var(--primary-orange);
    --comic-shadow: 4px 4px 0px var(--secondary-navy);
    --comic-shadow-hover: 2px 2px 0px var(--secondary-navy);
    --comic-shadow-lift: 6px 6px 0px var(--secondary-navy);

    /* Алиасы */
    --orange: var(--primary-orange);
    --navy: var(--secondary-navy);
    --bg: var(--bg-neutral);
    --radius: var(--border-radius);
    --outline: var(--bold-outline);
    --shadow: var(--comic-shadow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Oswald', system-ui, -apple-system, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--secondary-navy);
    background: var(--bg-neutral);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Заголовки по DESIGN.md: капсом, жирным Oswald 700 */
h1, h2, h3, h4 {
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: var(--secondary-navy);
    text-wrap: balance;
}
h1 { font-size: 2rem; margin-bottom: 24px; }
h2 { font-size: 1.375rem; margin-bottom: 14px; }
h3 { font-size: 1.1875rem; margin-bottom: 10px; }
h3.sub { font-size: 1.125rem; margin-top: 24px; }

p { text-wrap: pretty; }
p + p, p + form, ul + form { margin-top: 16px; }

a {
    color: var(--secondary-navy);
    text-decoration: none;
    text-underline-offset: 3px;
    font-weight: 600;
}
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }
.warn { color: var(--orange-text); font-weight: 600; }
.ok { color: var(--green); font-weight: 700; }
.big { font-size: 2.125rem; font-weight: 700; line-height: 1.15; color: var(--secondary-navy); }
.script { font-family: 'Great Vibes', cursive; text-transform: none; font-size: 1.75rem; color: var(--primary-orange); font-weight: 400; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
.wrap-wide { max-width: 1440px; }

/* Шапка панели (base.html) */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 24px;
    background: var(--white);
    border-bottom: var(--bold-outline);
    box-shadow: 0 4px 0 rgba(11, 37, 77, 0.04);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--secondary-navy);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.brand img {
    border-radius: 50%;
    border: 2px solid var(--secondary-navy);
    background: var(--white);
}
.brand-text small {
    display: block;
    font-size: 0.75rem;
    color: var(--primary-orange);
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-top: -2px;
}

.top nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}
.top nav a {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9375rem;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 10px;
    border: 2px solid transparent;
    color: var(--secondary-navy);
    text-decoration: none;
    transition: all 0.15s ease;
}
.top nav a:hover {
    background: rgba(11, 37, 77, 0.06);
    border-color: var(--secondary-navy);
    text-decoration: none;
}
.top nav a[aria-current="page"] {
    background: var(--secondary-navy);
    color: var(--white);
    border-color: var(--secondary-navy);
    box-shadow: 2px 2px 0 var(--primary-orange);
}

/* Карточки комикс-стиля (DESIGN.md) */
.card {
    background: var(--white);
    border: var(--bold-outline);
    border-radius: var(--border-radius);
    box-shadow: var(--comic-shadow);
    padding: 24px;
}
.card + .card,
.grid + .card,
.grid-2 + .card,
.card + .grid,
.card + .grid-2,
.grid + .grid,
.grid + .grid-2,
.grid-2 + .grid,
.grid-2 + .grid-2 {
    margin-top: 24px;
}

/* Сетки */
.grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid .card + .card { margin-top: 0; }

.grid-2 {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
.grid-2 .card + .card { margin-top: 0; }

/* Страница входа (auth) */
.auth {
    max-width: 480px;
    margin: 32px auto 48px;
    text-align: center;
    padding: 32px 28px;
}
.auth .chef {
    display: block;
    margin: 0 auto 20px;
    width: 192px;
    max-width: 100%;
    height: auto;
}
.auth h1 {
    font-size: 2rem;
    margin-bottom: 20px;
}
.auth .login-form { text-align: left; }
.auth label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 700;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

/* Кнопки комикс-стиля (DESIGN.md) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 22px;
    font: inherit;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 1rem;
    color: var(--secondary-navy);
    background: var(--white);
    border: var(--bold-outline);
    border-radius: 12px;
    box-shadow: var(--comic-shadow);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover {
    box-shadow: var(--comic-shadow-hover);
    transform: translate(2px, 2px);
    text-decoration: none;
}
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--primary-orange);
    outline-offset: 2px;
}
.btn-primary {
    background: var(--primary-orange);
    color: var(--secondary-navy);
}
.btn-ghost {
    min-height: 40px;
    padding: 6px 14px;
    box-shadow: none;
    border-width: 2px;
    background: transparent;
}
.btn-ghost:hover {
    transform: none;
    box-shadow: none;
    background: var(--bg-neutral);
}
.btn-mini {
    min-height: 32px;
    padding: 2px 10px;
    font-size: 0.8125rem;
    box-shadow: 2px 2px 0 var(--secondary-navy);
}
.btn-mini:hover {
    box-shadow: 1px 1px 0 var(--secondary-navy);
    transform: translate(1px, 1px);
}
.btn-wide { width: 100%; margin-top: 16px; }

/* Поля ввода и формы */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    text-align: left;
}
.field label, label {
    font-weight: 700;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    color: var(--secondary-navy);
}

input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    font: inherit;
    font-size: 1.0625rem;
    color: var(--secondary-navy);
    border: 2px solid var(--secondary-navy);
    border-radius: 12px;
    background: var(--white);
    transition: border-color 0.15s;
}
input[type="file"] {
    min-height: 0;
    padding: 10px;
    border-style: dashed;
    background: var(--bg-neutral);
    cursor: pointer;
}
input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-height: 0;
    accent-color: var(--primary-orange);
    cursor: pointer;
}
input.link { font-family: ui-monospace, monospace; font-size: .875rem; }
.form-compact { margin-top: 16px; }

.status { min-height: 1.5em; margin-top: 12px; }
.status.is-error, .error { color: var(--error); }
.backup { margin-top: 24px; text-align: left; }
.backup summary {
    cursor: pointer;
    color: var(--muted);
    text-align: center;
    font-weight: 600;
}

.codes {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0;
    font-family: ui-monospace, monospace;
    font-size: 1.125rem;
}
.codes li {
    padding: 8px;
    background: var(--bg-neutral);
    border: 1px solid #d7dbe3;
    border-radius: 8px;
    text-align: center;
}

/* Списки строк */
.rows { list-style: none; }
.rows + form { margin-top: 16px; }
.rows li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #d7dbe3;
}
.rows li div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.rows .muted { font-size: .9375rem; }
.rows.compact li { padding: 8px 0; }
.rows.log li { padding: 10px 0; }

/* Бейджи (badges) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: 999px;
    border: 2px solid var(--secondary-navy);
    white-space: nowrap;
}
.badge-success {
    background: var(--green-bg);
    color: #065F46;
    border-color: #065F46;
}
.badge-warn {
    background: #FEF3C7;
    color: #92400E;
    border-color: #92400E;
}
.badge-error {
    background: #FEE2E2;
    color: var(--error);
    border-color: var(--error);
}

/* KPI метрики */
.kpi-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin: 20px 0;
}
.kpi {
    background: var(--bg-neutral);
    border: 2px solid var(--secondary-navy);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi span {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.kpi strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-navy);
    line-height: 1.2;
}

/* Таблицы со скроллом (.table-scroll, .table-wrap, .schedule, .data, .table) */
.table-scroll, .table-wrap {
    position: relative;
    overflow-x: auto;
    margin: 16px 0;
    border: 2px solid var(--secondary-navy);
    border-radius: 14px;
    background: var(--white);
    box-shadow: 2px 2px 0 var(--secondary-navy);
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
    text-align: left;
}
.table th {
    background: var(--bg-neutral);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    padding: 10px 14px;
    border-bottom: 2px solid var(--secondary-navy);
    color: var(--secondary-navy);
    white-space: nowrap;
}
.table td {
    padding: 10px 14px;
    border-bottom: 1px solid #d7dbe3;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255, 128, 0, 0.04); }

table.data { border-collapse: collapse; margin-top: 12px; min-width: 260px; width: 100%; }
table.data th, table.data td { padding: 8px 12px 8px 0; text-align: left; border-bottom: 1px solid #d7dbe3; }
table.data td:last-child { text-align: right; white-space: nowrap; }

/* График смен */
.schedule { border-collapse: collapse; font-size: .9375rem; width: 100%; }
.schedule th, .schedule td { padding: 6px; text-align: center; border-bottom: 1px solid #d7dbe3; border-left: 1px solid #eceef2; min-width: 34px; }
.schedule thead th { position: sticky; top: 0; background: var(--white); font-weight: 700; line-height: 1.1; }
.schedule thead th small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.schedule .name { position: sticky; left: 0; z-index: 1; min-width: 150px; text-align: left; padding: 6px 10px; background: var(--white); border-left: none; }
.schedule .name .btn-mini { margin-left: 8px; }
.schedule .weekend { background: var(--bg-neutral); }
.schedule .today { box-shadow: inset 0 -3px 0 var(--primary-orange); }
.schedule .total { font-weight: 700; min-width: 48px; }

/* Заголовки разделов и панели */
.head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.head h1, .head h2 { margin-bottom: 0; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head-row h2 { margin-bottom: 0; }
.head-row + .big { margin-top: 12px; }

.month-nav { display: flex; align-items: center; gap: 12px; font-size: 1.125rem; }
.month-nav strong { min-width: 9em; text-align: center; }
.plain { list-style: none; margin-top: 8px; }

/* Уведомления и алерты */
.alert, .notice {
    margin-bottom: 24px;
    padding: 14px 18px;
    border: var(--bold-outline);
    border-radius: 14px;
    box-shadow: 3px 3px 0 var(--secondary-navy);
    background: var(--white);
}
.alert {
    border-color: var(--error);
    color: var(--error);
    box-shadow: 3px 3px 0 var(--error);
}
.warn-box {
    border-color: var(--secondary-navy);
    background: #FFFBEB;
}
.warn-box a { font-weight: 700; color: var(--orange-text); }

/* Прогресс-бары и бюджет */
.bars { list-style: none; margin-top: 16px; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(8em, 1fr) 2fr auto; align-items: center; gap: 12px; }
.bars strong { text-align: right; white-space: nowrap; }
.bars li small { grid-column: 1 / -1; margin-top: -6px; color: var(--muted); font-size: .875rem; }
.bars li.is-near small { color: var(--orange-text); font-weight: 600; }
.bars li.is-over small { color: var(--error); font-weight: 700; }
.bars li.is-over progress::-webkit-progress-value { background: var(--error); }
.bars li.is-over progress::-moz-progress-bar { background: var(--error); }

progress {
    width: 100%;
    height: 14px;
    appearance: none;
    border: 2px solid var(--secondary-navy);
    border-radius: 999px;
    background: var(--bg-neutral);
    overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--bg-neutral); }
progress::-webkit-progress-value { background: var(--primary-orange); }
progress::-moz-progress-bar { background: var(--primary-orange); }
progress.be { height: 16px; margin: 8px 0; }
.be-line { margin-top: 20px; }

.budget-grid { max-width: none; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.budget-grid p, .budget-grid button { grid-column: 1 / -1; }

.chart { display: block; width: 100%; margin-top: 8px; overflow: visible; font-family: 'Oswald', system-ui, sans-serif; }
.chart .axis { stroke: #c9cfdb; stroke-width: 1; }
.chart .bar { fill: #7A8AA6; }
.chart .bar-current { fill: var(--orange-text); }
.chart .hit { fill: transparent; }
.chart .bar-link:hover .bar { fill: var(--secondary-navy); }
.chart .bar-link:focus-visible { outline: none; }
.chart .bar-link:focus-visible .hit { fill: var(--bg-neutral); }
.chart text { font-size: 14px; fill: var(--muted); }
.chart .label-current { fill: var(--secondary-navy); font-weight: 700; }
.chart .value { fill: var(--secondary-navy); font-weight: 600; font-size: 15px; }

.deltas { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }
.delta { color: var(--secondary-navy); font-weight: 600; }

.row-end {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-direction: row !important;
}
.row-end strong { white-space: nowrap; }
.row-end input[type="date"] { width: auto; }
.rows li > div:first-child { flex: 1; }
.rows li.muted { display: block; }

.inline { position: relative; }
.inline[open] { flex-basis: 100%; }
.inline form { margin-top: 12px; }
.add { margin-top: 16px; }
.add > summary, .inline > summary { list-style: none; cursor: pointer; }
.add > summary::-webkit-details-marker, .inline > summary::-webkit-details-marker { display: none; }
.add[open] > summary { margin-bottom: 8px; }

.form-grid { display: grid; gap: 4px 16px; max-width: 520px; }
.form-grid label { display: grid; gap: 6px; margin-top: 8px; font-weight: 700; }
.form-grid > label[for] { margin-bottom: -2px; }
.form-grid button { margin-top: 16px; justify-self: start; }

/* Выручка и статистика */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 24px; margin-top: 16px; }
.stats dt { color: var(--muted); font-size: .9375rem; text-transform: uppercase; font-weight: 700; }
.stats dd { font-size: 1.375rem; font-weight: 700; }
.stats small { font-size: .9375rem; font-weight: 400; }
.stats + p { margin-top: 16px; }

.revenue-form { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-width: none; }
.revenue-form button { grid-column: 1 / -1; }
.revenue-form .check { flex-direction: row; display: flex; align-items: center; gap: 10px; align-self: end; min-height: 48px; }

table.days { width: 100%; margin-top: 0; }
table.days th, table.days td { text-align: right; white-space: nowrap; padding: 10px 12px; }
table.days th:first-child, table.days td:first-child { text-align: left; }
table.days td small { display: block; white-space: normal; max-width: 220px; }

.row-actions div { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { display: inline; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips a {
    padding: 6px 14px;
    border: 2px solid var(--secondary-navy);
    border-radius: 999px;
    color: var(--secondary-navy);
    text-decoration: none;
    background: var(--white);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
}
.chips a[aria-current="page"] {
    background: var(--secondary-navy);
    color: var(--white);
    box-shadow: 2px 2px 0 var(--primary-orange);
}

.files { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.file { display: inline-flex; align-items: center; gap: 4px; font-size: .9375rem; }
.file form { display: inline; }
.link-btn { min-width: 32px; min-height: 32px; font: inherit; font-size: 1.125rem; color: var(--muted); background: none; border: none; cursor: pointer; border-radius: 8px; }
.link-btn:hover { color: var(--error); background: var(--bg-neutral); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Мобильная адаптивность */
@media (max-width: 680px) {
    h1 { font-size: 1.625rem; }
    .card { padding: 18px; border-radius: 16px; }
    .top { padding: 10px 14px; gap: 10px; }
    .brand-text small { display: none; }
    .top nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
    .top nav a { padding: 6px 10px; white-space: nowrap; font-size: 0.875rem; }
    .grid, .grid-2 { grid-template-columns: 1fr; }
    .auth { padding: 24px 16px; margin: 16px auto; }
    .auth .chef { width: 160px; }
    .rows li { flex-direction: column; align-items: stretch; }
    .row-end { justify-content: flex-start; }
    .bars li { grid-template-columns: 1fr auto; }
    .bars progress { grid-column: 1 / -1; order: 3; }
}

@media (max-width: 480px) {
    .chart text { font-size: 12px; }
    .chart .value { font-size: 13px; }
}
