:root {
  --bg: #FDF6EC;
  --surface: #FFFDF9;
  --surface-2: #F7EDDD;
  --line: #EADCC6;
  --text: #3A2E24;
  --muted: #7A6A5A;
  --accent: #D97724;
  --accent-dark: #B85F14;
  --green: #5C7A3E;
  --green-soft: #E6EEDB;
  --mustard: #D9A93C;
  --mustard-soft: #F8EBCB;
  --sky: #8EC3DE;
  --sky-soft: #E1F0F7;
  --danger-soft: #FBE1D0;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(122, 90, 50, .08);
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-weight: 800; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 250px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; }
.brand-name { font-weight: 900; font-size: 1.3rem; color: var(--accent); letter-spacing: -.01em; }
.brand-name b { color: var(--green); }
.brand-sub { font-size: .75rem; color: var(--muted); line-height: 1.2; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 700; font-size: .95rem; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; font-weight: 800; }
.side-foot { margin-top: auto; padding-top: 16px; font-size: .72rem; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 24px 32px 100px; max-width: 1100px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar .spacer { flex: 1; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 16px 16px 96px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 700; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav svg { width: 22px; height: 22px; }
  h1 { font-size: 1.4rem; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.green { background: var(--green-soft); border-color: #CFDDBD; box-shadow: none; }
.card.mustard { background: var(--mustard-soft); border-color: #EBD69E; box-shadow: none; }
.card.sky { background: var(--sky-soft); border-color: #C3DFEC; box-shadow: none; }
.card.warn { background: var(--danger-soft); border-color: #F0C3A4; box-shadow: none; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; background: var(--accent); color: #fff; font-weight: 800; padding: 12px 22px; border-radius: 999px; cursor: pointer; text-decoration: none; font-size: 1rem; min-height: 46px; transition: background .15s, transform .1s; }
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(.98); }
.btn.green { background: var(--green); } .btn.green:hover { background: #4A6531; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 14px; min-height: 36px; font-size: .88rem; }
.btn:disabled { opacity: .45; cursor: default; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--danger-soft); color: var(--accent-dark); }
.chip.mid { background: var(--mustard-soft); color: #8A6A16; }
.chip.si { background: #FBE3CF; color: #A55A15; }
.chip.afk { background: var(--green-soft); color: var(--green); }
.chip.neuro { background: var(--sky-soft); color: #2F6C8C; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.input, textarea.input, select.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; min-height: 46px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); }

.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { padding: 10px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; min-height: 44px; }
.opt:hover { border-color: var(--accent); }
.opt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt.on.green { background: var(--green); border-color: var(--green); }

.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--mustard), var(--accent)); border-radius: 999px; transition: width .3s; }

.disclaimer { font-size: .8rem; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 28px; padding-top: 12px; }

.module-card { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: inherit; transition: transform .15s; }
.module-card:hover { transform: translateY(-2px); }
.module-num { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--accent); flex-shrink: 0; font-size: 1.15rem; }

.icon-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.icon-badge svg { width: 22px; height: 22px; }

/* Questionnaire */
.q-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.q-item:last-child { border-bottom: none; }
.q-item .q-text { flex: 1; }
.yn { display: flex; gap: 6px; flex-shrink: 0; }
.yn .opt { padding: 6px 14px; min-height: 38px; }
.q-num { font-weight: 800; color: var(--muted); margin-right: 6px; }

/* Bogdashina grid */
.bq { display: grid; grid-template-columns: 54px 1fr; gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bq .opts .opt { padding: 4px 12px; min-height: 34px; font-size: .85rem; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .75rem; }
.heat th { font-weight: 800; color: var(--muted); padding: 2px 4px; }
.heat td { width: 30px; height: 22px; border-radius: 5px; text-align: center; }
.heat-wrap { overflow-x: auto; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 16px; border-radius: 999px; background: var(--surface-2); font-weight: 800; cursor: pointer; border: none; font-size: .9rem; }
.tab.on { background: var(--text); color: #fff; }

/* Pyramid */
.pyramid svg { width: 100%; max-width: 520px; display: block; margin: 0 auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: .85rem; margin-top: 10px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* Exercise */
.ex { display: flex; gap: 14px; align-items: flex-start; }
.ex-check { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); background: #fff; cursor: pointer; flex-shrink: 0; display: grid; place-items: center; transition: all .15s; }
.ex-check.on { background: var(--green); border-color: var(--green); }
.ex-check svg { width: 18px; height: 18px; }
.ex.done h3 { text-decoration: line-through; color: var(--muted); }
details summary { cursor: pointer; font-weight: 700; color: var(--accent-dark); margin-top: 6px; }
details ol { padding-left: 20px; margin: 8px 0; }
.swap { background: var(--green-soft); border-radius: 12px; padding: 8px 12px; font-size: .9rem; margin: 8px 0; }

.stat { text-align: center; }
.stat b { display: block; font-size: 1.8rem; font-weight: 900; color: var(--accent); line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 700; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: .75rem; font-weight: 800; color: var(--muted); }
.day.full { background: var(--green); color: #fff; }
.day.part { background: var(--mustard-soft); color: #8A6A16; }
.day.today { outline: 2px solid var(--accent); }

.mascot { width: 92px; height: 92px; flex-shrink: 0; }
.hero { display: flex; gap: 20px; align-items: center; }
@media (max-width: 560px) { .hero { flex-direction: column; text-align: center; } }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 20px; border-radius: 999px; font-weight: 700; z-index: 50; animation: pop .25s; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px); } }

.stage { border-left: 4px solid var(--accent); padding-left: 12px; margin-bottom: 14px; }
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.plain td, table.plain th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

/* Photos */
.banner { display: block; width: 100%; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); aspect-ratio: 5 / 2; object-fit: cover; }
.brand-banner img { display: block; width: 100%; border-radius: 14px; aspect-ratio: 5 / 2; object-fit: cover; }
.brand-banner { margin-bottom: 4px; }
.brand { padding: 4px 6px 12px; }
.author-photo { width: 180px; height: 220px; object-fit: cover; object-position: center 30%; border-radius: var(--radius); flex-shrink: 0; cursor: zoom-in; }
.poster-thumb { width: 150px; border-radius: 12px; flex-shrink: 0; cursor: zoom-in; box-shadow: var(--shadow); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.photo { margin: 0; }
.photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; cursor: zoom-in; display: block; }
.photo figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.user-box { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: .9rem; overflow-wrap: anywhere; }
.mobile-inline { display: none; }
@media (max-width: 860px) { .mobile-inline { display: inline-flex; } }
.mobile-only { display: none; }
@media (max-width: 860px) { .banner.mobile-only { display: block; } }
.lightbox { position: fixed; inset: 0; background: rgba(40, 30, 20, .85); z-index: 100; display: grid; place-items: center; padding: 16px; cursor: zoom-out; animation: pop .2s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

@media print {
  .side, .bottom-nav, .topbar, .no-print { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
