/* Jomi Studio — система студии. Фирменный стиль: графит, молочный, мятный; Unbounded + Manrope. */

@font-face { font-family: 'Unbounded'; src: url('/fonts/Unbounded.woff') format('woff'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/Manrope.woff') format('woff'); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #F6F1E9;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --surface-3: #F1ECE3;
  --line: #E6E3DD;
  --line-strong: #D6D1C8;
  --ink: #1F1D24;
  --ink-2: #57535F;
  --ink-3: #8A8692;
  --mint: #4FC59A;
  --mint-ink: #1E7A57;
  --mint-soft: #E2F4EB;
  --amber: #9A6510;
  --amber-soft: #FBEFD5;
  --violet: #5646C2;
  --violet-soft: #ECE9FB;
  --red: #B93A26;
  --red-soft: #FBE6E1;
  --blue: #2A64A3;
  --blue-soft: #E3EDF8;
  --btn: #1F1D24;
  --btn-ink: #FFFFFF;
  --chart-a: #2A9D72;
  --chart-b: #6B5BD6;
  --shadow: 0 1px 2px rgba(31, 29, 36, .04), 0 4px 16px rgba(31, 29, 36, .05);
  --shadow-lg: 0 12px 48px rgba(31, 29, 36, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --sidebar: 252px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #17161B;
    --surface: #211F26;
    --surface-2: #26242C;
    --surface-3: #2D2B33;
    --line: #34313B;
    --line-strong: #45414D;
    --ink: #F3EFE8;
    --ink-2: #BDB8C2;
    --ink-3: #8E8996;
    --mint-ink: #6FD6AE;
    --mint-soft: #1D3A2F;
    --amber: #E6B04F;
    --amber-soft: #3A2E17;
    --violet: #A99DF5;
    --violet-soft: #2D2848;
    --red: #F08A76;
    --red-soft: #43231E;
    --blue: #86B6EC;
    --blue-soft: #1D2E43;
    --btn: #F3EFE8;
    --btn-ink: #1F1D24;
    --chart-a: #33A67B;
    --chart-b: #8579E8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 0;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.display { font-family: var(--display); letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.stack.sm { gap: 6px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

/* ---------- Каркас ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 24px 16px 20px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--line); background: var(--bg); z-index: 20;
}
.sidebar .logo { display: block; padding: 4px 10px 22px; }
.sidebar .logo img { height: 34px; width: auto; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2);
  font-weight: 600; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.nav-item.active svg { color: var(--mint-ink); }
.nav-item .count { margin-left: auto; font-size: 12px; background: var(--red-soft); color: var(--red); padding: 1px 8px; border-radius: 99px; }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.sidebar .me:hover { border-color: var(--line-strong); }

.main { margin-left: var(--sidebar); padding: 32px 40px 64px; max-width: calc(1240px + var(--sidebar)); }
.topbar, .tabbar, .fab { display: none; }

@media (max-width: 959px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px 16px calc(var(--tabbar) + var(--safe-b) + 84px); }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar img { height: 26px; width: auto; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0 0; z-index: 30;
    height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em; min-width: 0; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tab.active { color: var(--ink); }
  .tab.active svg { color: var(--mint-ink); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(var(--tabbar) + var(--safe-b) + 16px); z-index: 25;
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--btn); color: var(--btn-ink); box-shadow: var(--shadow-lg); cursor: pointer;
  }
}

.demo-banner {
  background: repeating-linear-gradient(135deg, #F7D774, #F7D774 14px, #F3CC5A 14px, #F3CC5A 28px); color: #3B2F07;
  text-align: center; font-weight: 700; font-size: 13px; padding: 6px 12px; position: relative; z-index: 40;
}

/* ---------- Заголовки страниц ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-family: var(--display); font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }
@media (max-width: 959px) {
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }
}
.section-title { font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.back:hover { color: var(--ink); }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-family: var(--display); font-size: 15px; letter-spacing: -0.01em; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); } .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .grid.auto { grid-template-columns: minmax(0, 1fr); } }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .layout-2 { grid-template-columns: minmax(0, 1fr); } }

/* Показатели */
.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.stat .value { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .value.sm { font-size: 17px; }
.stat .value .alt { display: block; font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.stat .hint { font-size: 12.5px; color: var(--ink-3); }
.stat.good .value { color: var(--mint-ink); }
.stat.bad .value { color: var(--red); }
@media (max-width: 640px) { .stat .value { font-size: 18px; } .card { padding: 16px; } }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; }
.kpi .icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); margin-bottom: 10px; }
.kpi.alert .icon { background: var(--red-soft); color: var(--red); }
.kpi.ok .icon { background: var(--mint-soft); color: var(--mint-ink); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--btn); color: var(--btn-ink); font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); opacity: 1; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: transparent; padding: 0 10px; }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); opacity: 1; }
.btn.mint { background: var(--mint); color: #10261C; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-outline { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn.block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--mint-ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { font-size: 12.5px; color: var(--red); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 15px; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.textarea { height: auto; min-height: 88px; padding: 11px 14px; resize: vertical; line-height: 1.45; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238A8692' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 25%, transparent); }
.input.invalid { border-color: var(--red); }
.input[type='date'] { min-width: 0; }
.input.money { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--mint-ink); }

.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.lg button { padding: 9px 16px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); padding: 7px 13px; border-radius: 99px; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* Выбор источника денег — крупные карточки */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .choice-grid.three { grid-template-columns: 1fr; } }
.choice.on.payout .ico { background: var(--amber-soft); color: var(--amber); }
.tag-payout { background: var(--amber-soft); color: var(--amber); }
.choice {
  text-align: left; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start;
}
.choice .t { font-weight: 800; font-size: 14.5px; }
.choice .d { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.choice .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.choice.on { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 30%, transparent); }
.choice.on.company .ico { background: var(--blue-soft); color: var(--blue); }
.choice.on.personal .ico { background: var(--violet-soft); color: var(--violet); }
.choice.invalid { border-color: var(--red); }

/* Поиск и фильтры */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 40px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .select { height: 38px; width: auto; min-width: 140px; font-size: 14px; border-radius: 10px; padding-left: 12px; }
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .filters .select { min-width: 0; width: 100%; }
}

/* ---------- Статусы ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.5; border: 0; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
button.pill { cursor: pointer; }
.st-new { background: var(--surface-3); color: var(--ink-2); }
.st-in_progress { background: var(--blue-soft); color: var(--blue); }
.st-waiting_client { background: var(--amber-soft); color: var(--amber); }
.st-review { background: var(--violet-soft); color: var(--violet); }
.st-done { background: var(--mint-soft); color: var(--mint-ink); }
.st-cancelled { background: var(--surface-3); color: var(--ink-3); text-decoration: line-through; }
.pay-unpaid { background: var(--red-soft); color: var(--red); }
.pay-partial { background: var(--amber-soft); color: var(--amber); }
.pay-paid { background: var(--mint-soft); color: var(--mint-ink); }
.pay-overpaid { background: var(--violet-soft); color: var(--violet); }
.pay-no_price, .pay-cancelled { background: var(--surface-3); color: var(--ink-3); }
.tag-overdue { background: var(--red-soft); color: var(--red); }
.tag-soon { background: var(--amber-soft); color: var(--amber); }
.tag-void { background: var(--surface-3); color: var(--ink-3); }
.tag-company { background: var(--blue-soft); color: var(--blue); }
.tag-personal { background: var(--violet-soft); color: var(--violet); }
.tag-refund { background: var(--amber-soft); color: var(--amber); }

/* ---------- Карточки проектов ---------- */
.project-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; position: relative; min-width: 0;
}
.project-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.project-card.overdue { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.project-card.overdue::after { content: ''; position: absolute; left: -1px; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.project-card .title { font-weight: 800; font-size: 16px; line-height: 1.3; }
.project-card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--mint); border-radius: 99px; }
.progress.over > i { background: var(--violet); }

@media (max-width: 640px) {
  .kpi { padding: 12px 14px; }
  .kpi .icon { width: 28px; height: 28px; border-radius: 9px; margin-bottom: 6px; }
  .kpi .icon svg { width: 16px; height: 16px; }
  .project-row { flex-wrap: wrap; row-gap: 6px; }
  .project-row .grow { flex-basis: calc(100% - 40px); }
  .project-row > .right { margin-left: 34px; }
}

/* Списки */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item:last-child { padding-bottom: 0; }
a.list-item { text-decoration: none; color: inherit; }
a.list-item:hover .li-title { text-decoration: underline; }
.li-title { font-weight: 700; font-size: 14.5px; }
.li-sub { font-size: 13px; color: var(--ink-2); }
.li-amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.list-item.void { opacity: .55; }
.list-item.void .li-amount { text-decoration: line-through; }

/* Таблицы */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 800; border-top: 1px solid var(--line-strong); border-bottom: 0; }

/* Аватар */
.avatar { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; flex: none; }
.avatar.lg { width: 44px; height: 44px; border-radius: 14px; font-size: 16px; }
.avatar.sm { width: 22px; height: 22px; border-radius: 7px; font-size: 10.5px; }
.who { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }

/* Пустое состояние, загрузка, ошибки */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); margin: 0 auto 12px; color: var(--ink-3); }
.empty h3 { font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.empty p { margin: 0 auto 16px; max-width: 360px; }
.empty.sm { padding: 18px 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.alert.error { background: var(--red-soft); color: var(--red); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.alert.info { background: var(--blue-soft); color: var(--blue); }
.alert.ok { background: var(--mint-soft); color: var(--mint-ink); }
.alert svg { flex: none; margin-top: 1px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px 0; color: var(--ink-3); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Окна (снизу на телефоне, по центру на компьютере) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(23, 22, 27, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--surface); border-radius: 22px; width: 100%; max-width: 620px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: rise .2s cubic-bezier(.2, .8, .2, 1);
}
.sheet.sm { max-width: 440px; }
.sheet.lg { max-width: 860px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-family: var(--display); font-size: 17px; flex: 1; letter-spacing: -0.01em; }
.sheet-body { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; max-height: calc(100dvh - 24px); animation: up .25s cubic-bezier(.2, .8, .2, 1); }
  .sheet-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .sheet-foot .btn { flex: 1; }
  @keyframes up { from { transform: translateY(100%); } }
}

/* Уведомления */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 700; font-size: 14px; max-width: 380px; animation: rise .2s; }
.toast.error { background: var(--red); color: #fff; }
.toast .dot { width: 20px; height: 20px; border-radius: 50%; background: var(--mint); color: #10261C; display: grid; place-items: center; flex: none; }
@media (max-width: 640px) { .toasts { left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); } .toast { max-width: none; } }

/* Меню */
.menu-wrap { position: relative; }
.menu { position: absolute; z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu.up { bottom: calc(100% + 8px); left: 0; }
.menu.down { top: calc(100% + 6px); right: 0; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- Файлы ---------- */
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); cursor: pointer; padding: 0; display: grid; place-items: center; position: relative; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.sm { width: 40px; height: 40px; border-radius: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink); max-width: 240px; cursor: pointer; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploader { display: flex; flex-direction: column; gap: 8px; }
.drop {
  display: flex; align-items: center; justify-content: center; gap: 10px; border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 14px; cursor: pointer;
  color: var(--ink-2); font-weight: 700; font-size: 14px; background: var(--surface-2); text-align: center;
}
.drop:hover, .drop.over { border-color: var(--mint); color: var(--mint-ink); background: var(--mint-soft); }
.up-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 13.5px; }
.up-item.error { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: var(--red-soft); }
.up-item .bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.up-item .bar i { display: block; height: 100%; background: var(--mint); transition: width .2s; }
.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(12, 11, 14, .92); display: flex; flex-direction: column; animation: fade .15s; }
.lightbox .lb-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); color: #fff; }
.lightbox .lb-top .btn { background: rgba(255, 255, 255, .12); color: #fff; }
.lightbox .lb-img { flex: 1; display: grid; place-items: center; padding: 8px 16px 24px; min-height: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); object-fit: contain; border-radius: 8px; }

/* Лента материалов и история */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 10px; }
.feed-item .bubble { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.feed-item .bubble p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.history { display: flex; flex-direction: column; }
.history .h-item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.history .h-item::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.history .h-item:last-child::before { display: none; }
.history .h-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); margin-top: 4px; }
.history .h-item.money .h-dot { border-color: var(--mint); }
.history .changes { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }

/* Деньги проекта */
.money-rows { display: flex; flex-direction: column; gap: 10px; }
.money-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14.5px; }
.money-row b { font-variant-numeric: tabular-nums; font-size: 15.5px; }
.money-row.big b { font-family: var(--display); font-size: 22px; letter-spacing: -0.02em; }
.money-row.due b { color: var(--red); }
.money-row.ok b { color: var(--mint-ink); }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Диаграмма */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, -100%); z-index: 5; }

/* Вход */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; justify-content: center; margin-bottom: 26px; }
.auth-card .brand img { height: 46px; width: auto; }
.auth-card h1 { font-family: var(--display); font-size: 21px; text-align: center; letter-spacing: -0.01em; }
.auth-card .sub { text-align: center; color: var(--ink-2); margin: 6px 0 22px; }
.pin-input { font-size: 30px; letter-spacing: .6em; text-align: center; height: 60px; font-weight: 800; padding-left: .6em; font-family: var(--display); }
.code-input { font-size: 26px; letter-spacing: .3em; text-align: center; height: 58px; font-weight: 800; padding-left: .3em; font-variant-numeric: tabular-nums; }
.qr { width: 200px; height: 200px; margin: 0 auto; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-3); padding: 8px 10px; border-radius: 10px; word-break: break-all; text-align: center; letter-spacing: .05em; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 700; }
.codes span { background: var(--surface-3); border-radius: 10px; padding: 8px; text-align: center; }

/* Вкладки страницы */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button .n { font-size: 12px; color: var(--ink-3); margin-left: 4px; }

.note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 10px 12px; }
.money-lines { display: flex; flex-direction: column; gap: 2px; }
.hide-mobile { }
.only-mobile { display: none; }
@media (max-width: 959px) { .hide-mobile { display: none !important; } .only-mobile { display: initial; } }
