/* Bakesoft.App — каркас приложения. Бренд «Ягоды и крем» (как лендинг). Токены — только в :root. Mobile-first. */
:root {
    --bg: #FBF6F0;
    --paper: #FFFFFF;
    --paper2: #F4ECE2;
    --ink: #2E2530;
    --ink2: #4A3F4C;
    --acc: #B4234E;
    --acch: #951B40;
    --accs: #F8E6EB;
    --sec: #E8B04B;
    --secs: #FBEFD6;
    --secink: #8A5A0B;
    --muted: #6E6470;
    --line: #E6DCD1;
    --ok: #2F7A4F;
    --oks: #E5F3EA;
    --bad: #B3261E;
    --bads: #FCE8E6;
    --ff-head: "Playfair Display", Georgia, "Times New Roman", serif;
    --ff-hand: Caveat, "Segoe Print", "Comic Sans MS", cursive;
    --ff-body: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --sb-w: 268px;
    --bn-h: 68px;
    --r-card: 20px;
    --r-btn: 14px;
    --shadow: 0 1px 2px rgba(46, 37, 48, .04), 0 8px 24px -16px rgba(46, 37, 48, .18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { font-family: var(--ff-body); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hand { font-family: var(--ff-hand); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acc) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { left: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons, chips ---------- */
.btn { min-height: 48px; border-radius: var(--r-btn); padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 15px; white-space: nowrap; cursor: pointer; border: 1.5px solid transparent; background: none; transition: background .15s, border-color .15s, color .15s; }
.btn.pri { background: var(--acc); color: #fff; box-shadow: 0 12px 22px -14px var(--acc); }
.btn.pri:hover { background: var(--acch); }
.btn.sec { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.btn.sec:hover { background: var(--paper2); }
.btn.ghost { color: var(--ink2); }
.btn.ghost:hover { background: var(--paper2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--paper); }
.btn.danger:hover { background: var(--bads); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; background: var(--paper2); color: var(--ink2); }
.chip.acc { background: var(--accs); color: var(--acch); }
.chip.sec { background: var(--secs); color: var(--secink); }
.chip.ok { background: var(--oks); color: var(--ok); }
.chip.bad { background: var(--bads); color: var(--bad); }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; }
.sb { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--bn-h) + 24px + env(safe-area-inset-bottom)); }
.tb { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.tb .bk { flex: 1; min-width: 0; }
.content { padding: 20px 16px 32px; max-width: 1240px; margin: 0 auto; }

.logo { display: flex; align-items: center; gap: 8px; font-family: var(--ff-head); font-weight: 700; font-size: 22px; letter-spacing: -.2px; }
.logo img { width: 30px; height: 30px; }

/* bakery switcher (details) */
.bk { position: relative; }
.bk > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px; border-radius: 14px; cursor: pointer; }
.bk > summary::-webkit-details-marker { display: none; }
.bk > summary:hover { background: var(--paper2); }
.bk .bmark { width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: var(--sec); display: grid; place-items: center; flex: none; }
.bk .bname { min-width: 0; flex: 1; }
.bk .bname b { display: block; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk .bname span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.bk .chev { color: var(--muted); transition: transform .15s; }
.bk[open] .chev { transform: rotate(180deg); }
.menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); min-width: 260px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px -18px rgba(46, 37, 48, .35); padding: 6px; }
.menu .mh { padding: 8px 10px 4px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.menu form { margin: 0; }
.menu .mi { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 0; background: none; cursor: pointer; text-align: left; font-weight: 700; font-size: 14.5px; }
.menu .mi:hover { background: var(--paper2); }
.menu .mi .ic { color: var(--muted); }
.menu .mi.cur { color: var(--acc); }
.menu .mi.cur .ic { color: var(--acc); }
.menu .mi small { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; letter-spacing: .3px; }
.tb .avatar-link { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }

/* bottom nav (mobile) */
.bn { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.bn a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.bn a.on { color: var(--acc); }
.bn a.plus { justify-self: center; width: 56px; height: 56px; min-height: 0; border-radius: 18px; background: var(--acc); color: #fff; box-shadow: 0 12px 22px -12px var(--acc); }
.bn a.plus:hover { background: var(--acch); }

/* sidebar (desktop) */
@media (min-width: 1024px) {
    .shell { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); background: linear-gradient(to right, color-mix(in srgb, var(--paper) 55%, var(--bg)) calc(var(--sb-w) - 1px), var(--line) calc(var(--sb-w) - 1px), var(--line) var(--sb-w), transparent var(--sb-w)); }
    .sb { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 16px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 55%, var(--bg)); }
    .tb, .bn { display: none; }
    .main { padding-bottom: 0; }
    .content { padding: 32px 40px 48px; }
}
.sb .logo { padding: 4px 8px 16px; }
.sb .bk { margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav h2 { font-family: var(--ff-body); font-size: 11.5px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; font-weight: 700; font-size: 15px; color: var(--ink2); }
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--paper2); }
.nav a.on { background: var(--accs); color: var(--acch); }
.nav a.on .ic { color: var(--acc); }
.sb .sp { flex: 1; min-height: 16px; }
.sb .foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.um { position: relative; }
.um > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px; border-radius: 14px; cursor: pointer; }
.um > summary::-webkit-details-marker { display: none; }
.um > summary:hover { background: var(--paper2); }
.um .who { min-width: 0; flex: 1; }
.um .who b { display: block; font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um .who span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.um .menu { top: auto; bottom: calc(100% + 6px); }

/* ---------- page header ---------- */
.ph { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.crumb { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
h1 { font-family: var(--ff-head); font-weight: 600; font-size: 28px; line-height: 1.15; letter-spacing: -.3px; }
.ph .acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 760px) { h1 { font-size: 34px; } .ph { margin-bottom: 26px; } }
h2 { font-size: 18px; font-weight: 800; line-height: 1.3; }
h3 { font-size: 15.5px; font-weight: 800; }
.lead { color: var(--muted); font-size: 15px; max-width: 640px; margin-top: 6px; }

/* ---------- cards, grids ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .card { padding: 22px 24px; } }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card > h2 { margin-bottom: 4px; }
.card > .lead { margin: 0 0 16px; font-size: 14px; }
.grid { display: grid; gap: 14px; }
.grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.g4 { gap: 14px; } }
@media (min-width: 1100px) { .grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .si { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accs); color: var(--acc); flex: none; }
.stat .si.sec { background: var(--secs); color: var(--secink); }
.stat b { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat span { display: block; font-size: 13.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 599px) {
    .grid.g4 .card { padding: 14px; }
    .grid.g4 .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
    .grid.g4 .stat .si { width: 38px; height: 38px; border-radius: 12px; }
    .grid.g4 .stat b { font-size: 24px; }
}
.stat.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.dark span { color: color-mix(in srgb, #fff 70%, transparent); }
.stat.dark .si { background: color-mix(in srgb, #fff 12%, transparent); color: var(--sec); }
a.card:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ei { width: 72px; height: 72px; border-radius: 24px; background: var(--accs); color: var(--acc); display: grid; place-items: center; margin-bottom: 6px; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--muted); max-width: 460px; }
.empty .note { font-family: var(--ff-hand); font-size: 22px; color: var(--secink); line-height: 1.1; margin-top: 4px; }
.empty .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ---------- lists (mobile-friendly instead of tables) ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 60px; }
.row:first-child { border-top: 0; }
.row .rm { min-width: 0; flex: 1; }
.row .rm b { display: block; font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.row .rm span { display: block; font-size: 13.5px; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.row .rr { text-align: right; flex: none; font-weight: 700; }
.row .rr small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.row.off { opacity: .6; }
.row .ra { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 599px) { .row.wrap .ra { width: 100%; } .row.wrap .ra form, .row.wrap .ra select { flex: 1; } }
.group-title { font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--acc); padding: 16px 0 4px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-size: 14px; font-weight: 700; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); font-size: 16px; transition: border-color .15s, box-shadow .15s; }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236E6470' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent); }
.input.input-validation-error, .select.input-validation-error { border-color: var(--bad); }
.field-validation-error, .err { color: var(--bad); font-size: 13.5px; font-weight: 700; }
.validation-summary-errors { background: var(--bads); color: var(--bad); border-radius: 12px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.validation-summary-errors ul { list-style: none; }
.validation-summary-valid { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-height: 44px; padding-top: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--acc); flex: none; margin-top: 1px; }
.check a { color: var(--acc); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.f2 { display: grid; gap: 16px; }
@media (min-width: 600px) { .f2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.suffix { position: relative; }
.suffix .input { padding-right: 56px; }
.suffix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.copyline { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.copyline .input { flex: 1 1 220px; font-size: 14px; }

/* ---------- flash ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 14.5px; margin-bottom: 18px; background: var(--oks); color: var(--ok); }
.flash.error { background: var(--bads); color: var(--bad); }
.trial { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-radius: 14px; padding: 10px 14px; margin-bottom: 18px; background: var(--secs); color: var(--secink); font-weight: 700; font-size: 14px; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; }
.auth .aside { display: none; }
.auth .pane { display: flex; flex-direction: column; padding: 20px 16px 40px; }
.auth .pane .logo { margin-bottom: 28px; }
.auth .box { width: 100%; max-width: 420px; margin: 0 auto; }
.auth .box > .card { margin-top: 18px; }
.auth h1 { font-size: 30px; }
.auth .alt { margin-top: 18px; text-align: center; font-size: 14.5px; color: var(--muted); }
.auth .alt a { color: var(--acc); font-weight: 800; }
@media (min-width: 960px) {
    .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .auth .aside { display: flex; flex-direction: column; justify-content: space-between; padding: 40px 56px; background: var(--paper2); border-right: 1px solid var(--line); }
    .auth .aside .big { font-family: var(--ff-head); font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -.4px; max-width: 520px; }
    .auth .aside .big em { color: var(--acc); font-style: italic; }
    .auth .aside .steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
    .auth .aside .hand { font-size: 26px; color: var(--secink); }
    .auth .pane { justify-content: center; padding: 40px; }
    .auth .pane .logo { display: none; }
}

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { font-weight: 700; }
.list-links { display: flex; flex-direction: column; }
.list-links a, .list-links button { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 4px; border-top: 1px solid var(--line); font-weight: 700; font-size: 16px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer; text-align: left; }
.list-links > :first-child, .list-links > form:first-child > button { border-top: 0; }
.list-links .ic { color: var(--muted); }
.list-links .go { margin-left: auto; }
.section-gap { margin-top: 24px; }
