:root {
  color-scheme: dark;
  --glass: rgba(38, 31, 24, .60);
  --glass-strong: rgba(30, 24, 18, .90);
  --glass-soft: rgba(255, 255, 255, .09);
  --line: rgba(255, 235, 205, .17);
  --line-soft: rgba(255, 235, 205, .10);
  --text: #fff8ee;
  --muted: #d9cfc0;
  --green: #62d99a;
  --green-deep: #144d37;
  --amber: #ffbe5c;
  --blue: #6eaaf7;
  --violet: #aa8df5;
  --berry: #ef6f91;
  --danger: #ff857d;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32), inset 0 1px rgba(255, 255, 255, .12);
  --radius: 22px;
  --focus: 0 0 0 3px rgba(110, 170, 247, .5);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: #0c100b; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text);
  line-height: 1.48;
}
body::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 0;
  height: 100lvh;
  background:
    radial-gradient(70% 55% at 78% 8%, rgba(255, 170, 80, .17), transparent 70%),
    radial-gradient(60% 50% at 8% 96%, rgba(255, 140, 60, .12), transparent 70%),
    linear-gradient(180deg, rgba(9, 9, 6, .66), rgba(8, 9, 6, .83)),
    url("bg-desktop.jpg") center / cover no-repeat;
}
.background-veil { display: none; }
::selection { color: #102018; background: var(--green); }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 0; box-shadow: var(--focus); }
.skip-link { position: fixed; z-index: 1000; left: 12px; top: 8px; transform: translateY(-160%); padding: 10px 14px; color: #102018; background: white; border-radius: 12px; }
.skip-link:focus { transform: none; }
.icon { width: 21px; height: 21px; flex: none; }

.glass-panel, .side-nav, .top-bar, .mobile-nav, .mobile-more-menu, .mobile-add > div {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
}
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .glass-panel, .side-nav, .top-bar, .mobile-nav, .mobile-more-menu, .mobile-add > div { background: rgba(24, 30, 26, .96); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass-panel, .side-nav, .top-bar, .mobile-nav, .mobile-more-menu, .mobile-add > div { background: rgba(24, 30, 26, .96); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.top-bar {
  position: fixed;
  z-index: 40;
  top: 12px;
  left: 96px;
  right: 18px;
  min-height: 56px;
  border-radius: 999px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 7px 10px 7px 18px;
}
.top-brand { font-size: .9rem; font-weight: 800; letter-spacing: .04em; text-decoration: none; text-transform: uppercase; }
.top-pills { display: flex; gap: 4px; }
.top-pills .nav-item { min-height: 40px; padding: 9px 15px; border-radius: 999px; }
.top-pills .nav-item .icon { width: 17px; height: 17px; }
.top-user { justify-self: end; display: flex; align-items: center; gap: 9px; font-size: .84rem; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-soft); border-radius: 50%; background: rgba(255,255,255,.06); }
.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; text-decoration: underline; }

.app-shell { min-height: 100dvh; }
.side-nav {
  position: fixed;
  z-index: 50;
  left: 14px;
  top: 84px;
  bottom: 18px;
  width: 64px;
  border-radius: 32px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .24s ease, border-radius .24s ease;
}
body.nav-expanded .side-nav { width: 242px; border-radius: 26px; }
.main-content { width: min(1600px, calc(100% - 88px)); min-width: 0; margin-left: 88px; padding: 96px clamp(20px, 3vw, 50px) 70px; }
.main-content > footer { margin: 62px 0 0; padding: 18px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .84rem; }
.main-content > footer a { min-height: 44px; display: inline-flex; align-items: center; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 20ch; margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.02; letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 1.25rem; line-height: 1.2; letter-spacing: -.02em; }
h3 { margin-bottom: 7px; font-size: 1rem; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-head { margin-bottom: 26px; }
.page-head > p:last-child, .dashboard-head > div > p:last-child, .section-head p, .work-panel > p { color: var(--muted); }

.dashboard-head { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.period-tools { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.period-tabs { display: flex; padding: 4px; background: rgba(255,255,255,.09); border: 1px solid var(--line-soft); border-radius: 999px; }
.period-tabs button { min-height: 44px; padding: 8px 13px; border: 0; color: var(--muted); background: transparent; border-radius: 999px; cursor: pointer; }
.period-tabs button.active { color: #14251e; background: white; font-weight: 750; }
.custom-period { display: none; gap: 7px; align-items: end; }
.custom-period.visible { display: flex; }
.custom-period label { color: var(--muted); font-size: .75rem; font-weight: 700; }
.custom-period input { display: block; margin-top: 3px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--line); color: var(--text); background: rgba(255,255,255,.09); border-radius: 12px; text-decoration: none; font-weight: 720; cursor: pointer; }
.button:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: #10231b; background: white; border-color: white; }
.button-primary:hover { color: #0d2118; background: #dff8e9; }
.button-danger { color: white; background: rgba(188, 48, 50, .8); }
.button-quiet { background: transparent; border-style: dashed; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.work-panel, .data-section { position: relative; margin-bottom: 22px; padding: clamp(18px, 2.6vw, 28px); border-radius: var(--radius); overflow: hidden; }
.work-panel::before, .data-section::before, .kpi-card::before, .chart-panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); }
.work-panel > h2, .data-section > h2 { padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.section-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.section-head p { margin-bottom: 0; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 15px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .auth-form label { font-size: .84rem; font-weight: 720; }
.field small { color: var(--muted); font-size: .76rem; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .custom-period input, .auth-form input, #bank-file {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); color: white; background: rgba(9, 20, 15, .46); border-radius: 12px;
}
.field input::placeholder, .field textarea::placeholder { color: #bfc6c0; }
.field textarea { resize: vertical; }
.field select option { color: #102018; background: white; }
.form-submit { grid-column: 1 / -1; justify-self: start; min-width: 180px; }
.product-lines, .sale-lines { display: grid; gap: 10px; }
.product-line, .sale-line { display: grid; grid-template-columns: 2fr 1fr 1.2fr 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line-soft); background: rgba(255,255,255,.055); border-radius: 16px; }
.split-work { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.draft-review { margin-top: 20px; padding: 18px; color: #10251c; background: rgba(232, 255, 241, .93); border-radius: 15px; }
.warning-list { margin: 12px 0; padding: 12px 12px 12px 34px; color: #3b2b05; background: #ffe9a8; border-radius: 12px; }
.confirm-warning { display: flex; align-items: start; gap: 8px; margin: 12px 0; font-weight: 700; }
.confirm-warning input { width: 20px; height: 20px; }

.dashboard { display: grid; gap: 18px; }
.data-list { display: grid; }
.data-row { display: grid; grid-template-columns: minmax(100px,.7fr) minmax(140px,1fr) minmax(130px,1fr) minmax(110px,.7fr); gap: 14px; align-items: center; padding: 13px 3px; border-bottom: 1px solid var(--line-soft); }
.data-row:last-child { border-bottom: 0; }.data-row small { display: block; color: var(--muted); }
.badge { display: inline-flex; width: max-content; max-width: 100%; padding: 4px 9px; border-radius: 999px; color: #133526; background: #b9f0d0; font-size: .76rem; font-weight: 760; }
.badge.bad { color: #4a1111; background: #ffb9b5; }.badge.warn { color: #3e2c03; background: #ffe6a0; }
.pending-card { margin-bottom: 12px; padding: 20px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.pending-card header { display: flex; justify-content: space-between; gap: 10px; }.pending-card time { color: var(--muted); font-size: .8rem; }.pending-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.empty-state { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }.empty-state strong { display: block; color: white; }
.loading-block { min-height: 180px; display: grid; place-items: center; border-radius: var(--radius); }
.table-scroll { max-width: 100%; overflow-x: auto; }
.stock-table, .refs-table, .report-table { width: 100%; border-collapse: collapse; }
.stock-table th, .stock-table td, .refs-table th, .refs-table td, .report-table th, .report-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.stock-table th, .refs-table th, .report-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }.negative { color: var(--danger); font-weight: 800; }
.report-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; margin-bottom: 20px; }
.report-card { min-height: 180px; display: flex; flex-direction: column; align-items: start; padding: 20px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.report-card span { color: var(--muted); }.report-card strong { margin: 8px 0 auto; font-size: 1.45rem; }.gradient-0 { background: linear-gradient(140deg,#725116,#231c10); }.gradient-1 { background: linear-gradient(140deg,#174f83,#101d31); }.gradient-2 { background: linear-gradient(140deg,#245c31,#102217); }.gradient-3 { background: linear-gradient(140deg,#523681,#1c142d); }.gradient-4 { background: linear-gradient(140deg,#762e48,#2b131c); }
#report-screen button { min-height: 44px; padding: 8px 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }.settings-grid .work-panel { margin: 0; }.settings-wide { grid-column: 1 / -1; }
.alert { margin: 10px 0; padding: 12px 14px; border-radius: 12px; }.alert-danger { color: #4a1111; background: #ffb9b5; }.alert-success { color: #113d27; background: #b9f0d0; }.alert-warning { color: #3e2c03; background: #ffe6a0; }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }.toast { padding: 13px 16px; color: #102018; background: white; border-radius: 12px; box-shadow: var(--shadow); animation: toast-in .25s ease both; } @keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.auth-body { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }.auth-card { width: min(100%, 430px); padding: clamp(26px,6vw,44px); border-radius: 24px; }.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 1.2rem; font-weight: 780; }.auth-form { display: grid; gap: 16px; margin: 24px 0; }.auth-form label { display: grid; gap: 7px; }
.mobile-nav { display: none; }

@media (max-width: 1199px) {
  body::before { background-image: linear-gradient(180deg, rgba(9,9,6,.66), rgba(8,9,6,.84)), url("bg-tablet.jpg"); }
  .top-bar { grid-template-columns: 1fr auto; }.top-pills { display: none; }
  .form-grid { grid-template-columns: repeat(2, minmax(140px,1fr)); }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .split-work { grid-template-columns: 1fr; }
  .product-line, .sale-line { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 699px) {
  body::before { background-image: radial-gradient(80% 40% at 80% 0, rgba(255,170,80,.18), transparent 70%), linear-gradient(180deg, rgba(9,9,6,.62), rgba(8,9,6,.86)), url("bg-phone.jpg"); }
  .top-bar, .side-nav { display: none; }
  .main-content { width: 100%; max-width: 100vw; margin: 0; padding: calc(22px + env(safe-area-inset-top)) 14px calc(104px + env(safe-area-inset-bottom)); }
  .dashboard-head { display: block; }.dashboard-head h1 { font-size: 2.25rem; }.period-tools { display: grid; justify-content: stretch; margin-top: 16px; }.period-tabs { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); }.period-tabs button { padding: 7px 5px; font-size: .78rem; }.export-button { display: none; }.custom-period.visible { display: grid; grid-template-columns: 1fr 1fr; }.custom-period .button { grid-column: 1 / -1; }
  .mobile-nav { position: fixed; z-index: 70; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); align-items: end; padding: 7px; border-radius: 24px; }
  .mobile-item, .mobile-more > summary { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; color: var(--muted); border-radius: 16px; text-decoration: none; list-style: none; font-size: .65rem; text-align: center; }
  .mobile-item.active { color: #12251d; background: white; }.mobile-item .icon, .mobile-more .icon { width: 20px; height: 20px; }
  .mobile-add { position: relative; height: 59px; }.mobile-add > summary { width: 58px; height: 58px; display: grid; place-items: center; margin: -21px auto 0; color: #10231b; background: white; border: 6px solid rgba(25,32,28,.9); border-radius: 50%; list-style: none; box-shadow: 0 9px 25px rgba(0,0,0,.3); }.mobile-add > summary .icon { width: 25px; height: 25px; }.mobile-add > div { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); width: min(280px,calc(100vw - 28px)); display: grid; gap: 6px; padding: 12px; border-radius: 18px; transform: translateX(-50%); }.mobile-add:not([open]) > div { display: none; }.mobile-add a { min-height: 44px; display: flex; align-items: center; padding: 8px 12px; text-decoration: none; border-radius: 12px; background: rgba(255,255,255,.08); }
  .mobile-more > summary::-webkit-details-marker, .mobile-add > summary::-webkit-details-marker { display: none; }.mobile-more-menu { position: fixed; right: 8px; bottom: calc(88px + env(safe-area-inset-bottom)); width: min(270px, calc(100vw - 16px)); display: grid; gap: 3px; padding: 10px; border-radius: 18px; }.mobile-more:not([open]) .mobile-more-menu { display: none; }.mobile-more-menu .nav-item { min-height: 44px; }
  .form-grid { grid-template-columns: minmax(0,1fr); }.field-wide, .form-submit { grid-column: 1; }.work-panel, .data-section { padding: 17px; }.product-line, .sale-line { grid-template-columns: minmax(0,1fr); padding: 12px; }.data-row { grid-template-columns: 1fr 1fr; }.settings-grid, .report-cards { grid-template-columns: 1fr; }.settings-wide { grid-column: auto; }.report-card { min-height: 145px; }
  input, select, textarea { font-size: 16px !important; }
}

@media (max-width: 359px) {
  .kpi-grid, .block-cards, .data-row { grid-template-columns: minmax(0,1fr); }
  .main-content { padding-left: 10px; padding-right: 10px; }
  .mobile-nav { left: 4px; right: 4px; padding-left: 3px; padding-right: 3px; }
  .mobile-item, .mobile-more > summary { font-size: .58rem; }
  h1 { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  :root { color-scheme: light; }
  body { color: #17352e; background: white; }
  .background-veil, .top-bar, .side-nav, .mobile-nav, .button, .period-tools { display: none !important; }
  .main-content { width: 100%; margin: 0; padding: 0; }
  .glass-panel, .pending-card { color: #17352e; background: white; border: 1px solid #b6c7c0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Приёмка 29.11 */
.draft-review .button:not(.button-primary), .pending-card .button:not(.button-primary) { color: #10251c; background: #fff; border: 1px solid #3d5b4d; }
.draft-review .button-primary, .pending-card .button-primary { color: #fff; background: #17523a; border: 1px solid #17523a; }
.matrix-panel { margin-bottom: 20px; }
.matrix-panel .button { margin-top: 8px; }

/* ===== Боковое меню ===== */
.side-nav nav { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.side-nav nav::-webkit-scrollbar { display: none; }
.nav-item { position: relative; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 13px; color: var(--muted); border-radius: 999px; text-decoration: none; white-space: nowrap; font-weight: 650; transition: background .2s ease, color .2s ease; }
.nav-item:hover { color: #fff; background: rgba(255,240,215,.10); }
.nav-item.active { color: #221708; background: #fff6e8; box-shadow: 0 6px 22px rgba(255, 190, 92, .30); }
/* свёрнутое меню: каждый пункт ровный кружок */
.side-nav .nav-item { flex: none; width: 46px; height: 46px; padding: 0; justify-content: center; gap: 0; transition: width .3s cubic-bezier(.2,.8,.2,1), background .2s ease; }
.side-nav .nav-item span { width: 0; overflow: hidden; opacity: 0; transition: opacity .18s ease; }
body.nav-expanded .side-nav .nav-item { width: 100%; padding: 0 14px; justify-content: flex-start; gap: 12px; }
body.nav-expanded .side-nav .nav-item span { width: auto; opacity: 1; }
.side-nav .user-block { display: none; margin-top: auto; padding: 12px; border-top: 1px solid var(--line-soft); white-space: nowrap; }
body.nav-expanded .side-nav .user-block { display: grid; }
.user-block span { font-weight: 750; }.user-block small { color: var(--muted); }
/* три полоски превращаются в слово «Меню» */
.nav-toggle { position: relative; flex: none; width: 46px; height: 46px; margin: 0 0 10px; padding: 0; border: 1px solid var(--line); color: var(--text); background: rgba(255,240,215,.09); border-radius: 23px; cursor: pointer; overflow: hidden; transition: width .34s cubic-bezier(.2,.8,.2,1), background .25s ease, color .25s ease; }
body.nav-expanded .nav-toggle { width: 100%; color: #221708; background: linear-gradient(120deg, #ffd48f, #fff1dc); border-color: transparent; }
.burger { position: absolute; left: 50%; top: 50%; width: 20px; height: 14px; transform: translate(-50%, -50%); }
.burger i { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .22s ease; }
.burger i:nth-child(1) { top: 0; }.burger i:nth-child(2) { top: 6px; transition-delay: .04s; }.burger i:nth-child(3) { top: 12px; transition-delay: .08s; }
body.nav-expanded .burger i { opacity: 0; transform: translateX(26px) scaleX(.2); }
.nav-word { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.02rem; letter-spacing: .16em; text-transform: uppercase; pointer-events: none; }
.nav-word b { opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .32s cubic-bezier(.2,1.4,.4,1); }
body.nav-expanded .nav-word b { opacity: 1; transform: none; }
body.nav-expanded .nav-word b:nth-child(1) { transition-delay: .10s; }body.nav-expanded .nav-word b:nth-child(2) { transition-delay: .15s; }body.nav-expanded .nav-word b:nth-child(3) { transition-delay: .20s; }body.nav-expanded .nav-word b:nth-child(4) { transition-delay: .25s; }
.nav-scrim { position: fixed; z-index: 45; inset: 0; background: rgba(5, 4, 2, .45); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
body.nav-expanded .nav-scrim { opacity: 1; pointer-events: auto; }
body.nav-expanded .side-nav { background: var(--glass-strong); }

/* ===== Живые дашборды ===== */
.tone-amber { --tone: #ffbe5c; }.tone-green { --tone: #7ddc8f; }.tone-blue { --tone: #7db8ff; }.tone-violet { --tone: #bb9cff; }.tone-berry { --tone: #ff8597; }
.dashboard, .insights { display: grid; gap: 16px; }
.insights { margin-bottom: 20px; }
.dashboard > *, .insights > * { min-width: 0; animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.dashboard > :nth-child(2), .insights > :nth-child(2) { animation-delay: .08s; }.dashboard > :nth-child(3), .insights > :nth-child(3) { animation-delay: .16s; }.dashboard > :nth-child(4), .insights > :nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.hero { position: relative; display: flex; align-items: center; gap: 22px; padding: 20px 26px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-wait { background: linear-gradient(115deg, rgba(120, 45, 36, .92), rgba(86, 52, 22, .80) 58%, rgba(38, 31, 24, .68)); }
.hero-calm { background: linear-gradient(115deg, rgba(38, 82, 47, .90), rgba(82, 66, 24, .76) 62%, rgba(38, 31, 24, .66)); }
.hero::after { content: ""; position: absolute; width: 320px; height: 320px; right: -80px; top: -190px; border-radius: 50%; background: rgba(255, 190, 92, .24); filter: blur(46px); animation: breathe 7s ease-in-out infinite; pointer-events: none; }
@keyframes breathe { 50% { transform: translate(-60px, 34px) scale(1.18); opacity: .65; } }
.hero > div:not(.ring) { flex: 1; min-width: 0; }
.hero h2 { margin: 4px 0; font-size: clamp(1.25rem, 2.2vw, 1.8rem); }
.hero p { margin: 0; color: var(--muted); }
.hero > * { position: relative; z-index: 1; }
.hero-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); font-size: .82rem; font-weight: 750; }
.hero-tag svg { width: 16px; height: 16px; }
.hero-orb { flex: none; display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; color: #2b1c06; background: radial-gradient(circle at 35% 30%, #ffe3ac, #ffb24a); box-shadow: 0 0 34px rgba(255, 178, 74, .45); }
.hero-orb svg { width: 34px; height: 34px; }

.ring { position: relative; flex: none; width: 112px; height: 112px; --tone: #ffbe5c; }
.ring svg, .donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring > div, .donut > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.9rem; }.ring span { max-width: 78px; font-size: .7rem; color: var(--muted); }
.ring-unknown { --tone: #ff8597; }
.donut-bg { fill: none; stroke: rgba(255,240,215,.12); stroke-width: 4.2; }
.donut-arc { fill: none; stroke: var(--tone); stroke-width: 4.2; stroke-linecap: round; stroke-dasharray: var(--share) 100; animation: arc 1.2s cubic-bezier(.3,.8,.2,1) both; }
@keyframes arc { from { stroke-dasharray: 0 100; } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }.kpi-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 168px; padding: 18px 18px 52px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 17%, transparent), transparent 62%), var(--glass); box-shadow: var(--shadow); transition: transform .25s ease, border-color .25s ease; }
.kpi-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tone) 55%, transparent); }
.kpi-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 12px; color: var(--tone); background: color-mix(in srgb, var(--tone) 20%, transparent); }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-label { color: var(--muted); font-size: .86rem; }
.kpi-card strong { font-size: clamp(1.55rem, 2.7vw, 2.3rem); line-height: 1.15; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.count { font-weight: inherit; font-variant-numeric: tabular-nums; }
.kpi-card small { position: relative; z-index: 1; color: var(--tone); font-size: .8rem; }.kpi-card small.bad { color: var(--danger); }
.spark { display: block; color: var(--tone); animation: reveal 1.4s cubic-bezier(.4,.1,.2,1) .25s both; }
.kpi-card .spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 48px; }
.spark-big { width: 100%; height: 86px; margin: 10px 0 4px; }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.viz-grid { display: grid; gap: 16px; }
.viz-main { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .75fr); }
.viz-half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.viz-panel { min-width: 0; padding: 20px 22px; border-radius: var(--radius); }
.viz-head h2 { margin-bottom: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); }
.legend i, .donut-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 4px; background: var(--tone); }
.bar-readout { min-height: 1.4em; margin: 8px 0 4px; font-size: .86rem; color: var(--amber); }
.bars { touch-action: pan-y; display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: clamp(2px, .55vw, 8px); height: 250px; }
.bar-col { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 18px; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.bar-space { display: flex; align-items: flex-end; justify-content: center; min-height: 0; border-radius: 10px; }
.bar-stack { display: flex; flex-direction: column-reverse; gap: 2px; width: min(100%, 34px); overflow: hidden; border-radius: 9px 9px 5px 5px; transform-origin: bottom; animation: grow .85s cubic-bezier(.2,.9,.25,1.12) both; transition: filter .2s ease; }
.bar-stack i { display: block; min-height: 2px; background: linear-gradient(180deg, var(--tone), color-mix(in srgb, var(--tone) 55%, #2a1c0c)); opacity: .74; }
.bar-col:hover .bar-stack, .bar-col.picked .bar-stack, .bar-col.last .bar-stack { filter: brightness(1.22) drop-shadow(0 0 9px rgba(255,190,92,.45)); }
.bar-col:hover i, .bar-col.picked i, .bar-col.last i { opacity: 1; }
.bar-zero { width: min(100%, 34px); height: 4px; border-radius: 4px; background: rgba(255,240,215,.15); }
.bar-col small { justify-self: center; color: var(--muted); font-size: .66rem; white-space: nowrap; align-self: end; }
@keyframes grow { from { transform: scaleY(0); } }

.donut-wrap { display: grid; justify-items: center; gap: 16px; }
.donut { position: relative; width: 190px; height: 190px; }
.donut > div b { font-size: 1.7rem; }.donut > div span { color: var(--muted); font-size: .8rem; }
.donut-legend { width: 100%; margin: 0; padding: 0; list-style: none; }
.donut-legend li { display: grid; grid-template-columns: auto 1fr auto 44px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.donut-legend i { margin: 0; }.donut-legend small { color: var(--muted); text-align: right; }

.meters { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.meters li > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: .92rem; }
.meters .count { font-weight: 750; white-space: nowrap; }
.meter { display: block; height: 10px; overflow: hidden; border-radius: 99px; background: rgba(255,240,215,.10); }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 55%, #2a1c0c), var(--tone)); transform-origin: left; animation: stretch 1s cubic-bezier(.2,.85,.2,1) both; }
@keyframes stretch { from { transform: scaleX(0); } }

.today-list { display: grid; gap: 10px; }
.today-item { display: block; padding: 12px 14px; text-decoration: none; border: 1px solid color-mix(in srgb, var(--tone, #7ddc8f) 40%, transparent); background: color-mix(in srgb, var(--tone, #7ddc8f) 13%, transparent); border-radius: 15px; animation: slide .55s ease both; transition: transform .2s ease; }
.today-item:hover { transform: translateX(4px); }
.today-item.warn { --tone: #ffbe5c; }.today-item.bad { --tone: #ff8597; }
.today-item strong, .today-item small { display: block; }.today-item small { color: var(--muted); }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }
.feed { margin: 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); animation: slide .55s ease both; }
.feed li:last-child { border-bottom: 0; }.feed strong, .feed small { display: block; }.feed small, .feed time { color: var(--muted); font-size: .8rem; }
.feed-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--tone); background: color-mix(in srgb, var(--tone) 18%, transparent); }
.feed-icon svg { width: 18px; height: 18px; }

.block-states { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.block-state { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 20px; text-align: center; border-radius: var(--radius); background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 18%, transparent), transparent 70%), var(--glass); }
.block-state h2 { justify-self: start; }.block-state p { margin: 8px 0 0; font-weight: 700; }.block-state small { color: var(--muted); }
.block-state .hero-orb { margin: 22px 0 10px; }

.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.gauge { padding: 18px; border-radius: 20px; background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 17%, transparent), transparent 65%), var(--glass); animation: rise .6s ease both; }
.gauge header { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }.gauge header small, .gauge footer { color: var(--muted); font-size: .78rem; font-weight: 500; }
.gauge strong { display: block; margin-top: 8px; font-size: 2.4rem; line-height: 1.1; }.gauge em { margin-left: 6px; color: var(--muted); font-size: 1rem; font-style: normal; font-weight: 500; }
.gauge footer { display: flex; justify-content: space-between; gap: 6px; }

/* кнопка, открывающая форму ввода */
.drawer-bar { display: flex; flex-wrap: wrap; margin-bottom: 20px; }
.drawer-bar > .drawer { flex: 1 1 100%; }
.work-panel.drawer { padding: 0; margin-bottom: 0; }
.drawer-button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 10px 20px; border: 0; background: linear-gradient(100deg, rgba(255,190,92,.20), transparent 70%); font-size: 1.1rem; font-weight: 750; text-align: left; cursor: pointer; }
.drawer-plus { position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #ffd48f, #ffad45); box-shadow: 0 6px 18px rgba(255,173,69,.4); transition: transform .3s cubic-bezier(.2,1.4,.4,1); }
.drawer-plus::before, .drawer-plus::after { content: ""; position: absolute; left: 11px; top: 18px; width: 16px; height: 2.5px; border-radius: 2px; background: #2b1c06; }
.drawer-plus::after { transform: rotate(90deg); }
.drawer.open .drawer-plus { transform: rotate(135deg); }
.drawer > .section-head, .drawer > .record-form { display: none; }
.drawer.open > .section-head { display: flex; margin: 0; padding: 14px 24px 0; border: 0; }
.drawer.open > .section-head h2 { display: none; }
.drawer.open > .record-form { display: grid; padding: 14px 24px 24px; animation: rise .4s ease both; }
.drawer > .draft-review { margin: 0 24px 24px; }
.split-work .drawer-bar { margin: 0; }
.split-work { align-items: start; margin-bottom: 20px; }

.data-section, .report-card, .pending-card, .page-head, .dashboard-head, .report-cards, .settings-grid { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.data-section { animation-delay: .22s; }
.report-card { transition: transform .25s ease; }.report-card:hover { transform: translateY(-6px); }
.report-card:nth-child(2) { animation-delay: .07s; }.report-card:nth-child(3) { animation-delay: .14s; }.report-card:nth-child(4) { animation-delay: .21s; }.report-card:nth-child(5) { animation-delay: .28s; }.report-card:nth-child(6) { animation-delay: .35s; }
.page-head { margin-bottom: 18px; }.dashboard-head { margin-bottom: 18px; }
.page-head h1, .dashboard-head h1 { margin-bottom: 0; }
.gap-top { margin-top: 24px; }
.button { border-radius: 999px; }
.button-primary { color: #2b1c06; background: linear-gradient(120deg, #ffd48f, #fff1dc); border-color: transparent; }
.button-primary:hover { color: #2b1c06; background: #fff1dc; }
.period-tabs button.active { color: #221708; background: #fff1dc; }
.mobile-item.active { color: #221708; background: #fff1dc; }
.mobile-add > summary { color: #2b1c06; background: linear-gradient(135deg, #ffd48f, #ffad45); }

/* Плавная смена разделов: меню остаётся на месте и сворачивается, содержимое перетекает */
@view-transition { navigation: auto; }
.side-nav { view-transition-name: side-nav; }
.top-bar { view-transition-name: top-bar; }
.mobile-nav { view-transition-name: mobile-nav; }
::view-transition-old(root) { animation: vt-out .18s ease both; }
::view-transition-new(root) { animation: vt-in .38s cubic-bezier(.2,.8,.2,1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1199px) {
  .kpi-grid, .kpi-three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .viz-main, .viz-half { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: stretch; }
}
@media (max-width: 699px) {
  .nav-scrim { display: none; }
  .hero { flex-wrap: wrap; gap: 14px; padding: 18px; }
  .hero > div:not(.ring) { flex: 1 1 150px; }.hero > .button { width: 100%; }
  .ring { width: 96px; height: 96px; }.hero-orb { width: 56px; height: 56px; }
  .kpi-grid { gap: 10px; }.kpi-card { min-height: 160px; padding: 14px 14px 46px; }.kpi-card .spark { height: 40px; }
  .viz-panel { padding: 16px 14px; }.bars { height: 200px; gap: 2px; }
  .bar-col.last small { justify-self: end; }
  .donut-wrap { grid-template-columns: minmax(0,1fr); justify-items: center; }
  .drawer.open > .section-head { padding: 12px 16px 0; }.drawer.open > .record-form { padding: 12px 16px 18px; }
}
@media (max-width: 359px) {
  .kpi-grid, .kpi-two, .kpi-three, .gauges { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-delay: 0s !important; transition-delay: 0s !important; }
  @view-transition { navigation: none; }
}

/* Всплывающие меню телефона лежат внутри нижней панели, где размытие не работает, поэтому фон плотный */
.mobile-nav .mobile-more-menu, .mobile-nav .mobile-add > div { background: linear-gradient(170deg, #342a1d, #1d1811); border: 1px solid rgba(255, 214, 160, .30); box-shadow: 0 22px 60px rgba(0, 0, 0, .70); -webkit-backdrop-filter: none; backdrop-filter: none; }
.mobile-nav .mobile-more-menu .nav-item, .mobile-nav .mobile-add a { color: #fff8ee; background: rgba(255, 240, 215, .07); border-radius: 14px; font-size: 1rem; }
.mobile-nav .mobile-more-menu .nav-item.active { color: #221708; background: #fff1dc; }
.mobile-nav .mobile-more-menu { max-height: calc(100dvh - 130px - env(safe-area-inset-bottom)); overflow-y: auto; }
@media (max-width: 699px) {
  body:has(.mobile-more[open], .mobile-add[open]) .nav-scrim { display: block; opacity: 1; pointer-events: auto; background: rgba(5, 4, 2, .66); }
}


/* Архив старого учёта */
.facts { margin: 18px 0 0; }.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }.facts dt { color: var(--muted); }.facts dd { margin: 0; font-weight: 750; white-space: nowrap; }
.hint, .found { color: var(--muted); font-size: .85rem; }
.price-list { margin: 8px 0 0; padding: 0; list-style: none; }.price-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.checks summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
#history-results { margin-top: 16px; }

/* новая модель учёта */
.check-field{display:flex;align-items:center;gap:10px;min-height:44px;align-self:end;font-size:.92rem}
.check-field input{width:22px;height:22px;flex:none;accent-color:#e0a04a}
.form-stack{display:grid;gap:14px}
.cut-lines{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.cut-line{border:1px solid rgba(255,255,255,.16);border-radius:18px;padding:10px 12px 12px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0;min-width:0}
.cut-line legend{padding:0 6px;font-weight:700}
.cut-line legend output{font-weight:400;opacity:.75;font-size:.85rem}
.cut-line .field{justify-content:space-between}
.mark-lines{display:grid;gap:8px;grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
.mark-line{display:grid;grid-template-columns:minmax(0,1fr) 170px;align-items:center;gap:10px}
.people-lines{display:grid;gap:10px}
.people-line{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;align-items:end}
.live-total{margin:0;font-weight:700;min-height:1.4em}
.preview-list{margin:8px 0;padding:10px 12px 10px 28px;border-radius:14px;background:rgba(255,255,255,.07)}
.view-tools{display:flex;flex-wrap:wrap;gap:10px;align-items:end;margin-bottom:12px}
.view-tools label{display:grid;gap:4px;font-size:.85rem}
.op-row{display:grid;grid-template-columns:110px minmax(0,1fr) auto;gap:12px;align-items:center;padding:11px 0;border-bottom:1px solid rgba(255,255,255,.1)}
.op-row p{margin:0;overflow-wrap:anywhere}.op-row p small{display:block;opacity:.7}
.op-row.cancelled p{text-decoration:line-through;opacity:.55}
.link-button{background:none;border:0;color:inherit;font:inherit;font-size:.85rem;text-decoration:underline;opacity:.75;cursor:pointer;min-height:44px;padding:0 6px}
.link-button:hover,.link-button:focus-visible{opacity:1}
.two-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
.plan-list{display:grid;gap:10px}
.plan-item{border:1px solid rgba(255,255,255,.14);border-radius:16px;padding:12px 14px;background:rgba(255,255,255,.05)}
.plan-item header{display:flex;justify-content:space-between;gap:10px}.plan-item time{white-space:nowrap;opacity:.8}
.plan-item p{margin:6px 0 0;overflow-wrap:anywhere}.plan-item small{opacity:.75}
.plan-item.today{border-color:#e0a04a}.plan-item.late{border-color:#e2736b;background:rgba(226,115,107,.12)}
.data-row.out{background:rgba(240,196,70,.16);border-radius:12px}
.attendance-table th,.attendance-table td{padding:6px 4px;text-align:center;min-width:24px}
.attendance-table td:first-child,.attendance-table th:first-child{text-align:left;position:sticky;left:0;background:#241b14;padding-right:10px;min-width:96px}
.mark-full{color:#8fd19e}.mark-half{color:#f0c446}.mark-absent{color:#ee8f86}
.stock-table tr.total td{font-weight:700}
.stock-table td small{display:block;opacity:.7}
.meters.targets small{display:block;margin-top:4px;opacity:.7}
.debt-list,.debt-list ul{list-style:none;margin:0;padding:0}
.debt-list>li{border-bottom:1px solid rgba(255,255,255,.1)}
.debt-list summary{display:flex;justify-content:space-between;gap:12px;align-items:center;min-height:46px;cursor:pointer}
.debt-list ul li{display:grid;grid-template-columns:52px minmax(0,1fr) auto;gap:8px;padding:4px 0;font-size:.88rem}
.debt-list p{margin:2px 0 6px;font-size:.85rem;opacity:.75}
.debt-list .up{color:#f0c446}.debt-list .down{color:#8fd19e}
.report-screen{overflow-x:auto}
.report-screen h1{font-size:1.15rem}.report-screen h2{font-size:1rem;margin:16px 0 6px}
.report-screen table{width:100%;border-collapse:collapse;font-size:.9rem}
.report-screen th,.report-screen td{border:1px solid rgba(255,255,255,.18);padding:6px 8px;text-align:left}
.report-screen th{background:rgba(255,255,255,.1)}.report-screen .n{text-align:right;white-space:nowrap}
.report-screen tr.total td{font-weight:700;background:rgba(255,255,255,.07)}
.report-screen svg text{font-size:10px;fill:currentColor}
.report-screen .legend i{display:inline-block;width:10px;height:10px;margin-right:4px}.report-screen .legend span{margin-right:14px}.report-screen .legend i.target{height:2px;background:#e2736b;vertical-align:middle}
@media (max-width:900px){.two-columns{grid-template-columns:minmax(0,1fr)}}
@media (max-width:640px){
.cut-lines{grid-template-columns:minmax(0,1fr)}
.cut-line{grid-template-columns:repeat(3,minmax(0,1fr))}
.mark-line{grid-template-columns:minmax(0,1fr) 160px}
.op-row{grid-template-columns:minmax(0,1fr) auto;gap:2px 8px}.op-row strong{grid-column:1/-1}
}

.view-tools input{min-height:44px;font-size:16px}
.drawer-bar.chips{gap:10px}.drawer-bar.chips>.drawer:not(.open){flex:0 1 auto}.drawer-bar.chips>.drawer.open{order:99;flex:1 1 100%}
@media (max-width:640px){.drawer-bar.chips>.drawer:not(.open){flex:1 1 calc(50% - 10px)}}
.drawer-bar.chips>.drawer:not(.open) .drawer-button{height:100%;min-height:54px;gap:10px;padding:8px 14px;font-size:.95rem;line-height:1.2}
.drawer-bar.chips>.drawer:not(.open) .drawer-plus{width:28px;height:28px}.drawer-bar.chips>.drawer:not(.open) .drawer-plus::before,.drawer-bar.chips>.drawer:not(.open) .drawer-plus::after{left:7px;top:13px;width:14px}
@media (max-width:640px){.drawer-bar.chips>.drawer:not(.open) .drawer-button{padding:8px 10px;font-size:.84rem;gap:8px}}
.report-screen h1,.report-screen h2{max-width:none;line-height:1.3;letter-spacing:0}
/* графики со шкалой */
.kpi-card{padding-bottom:18px;min-height:0}
.chart{position:relative;padding-left:52px;margin-top:10px}
.chart-grid{position:absolute;left:0;right:0;top:0;bottom:18px;pointer-events:none}
.chart-grid span{position:absolute;left:0;right:0;border-top:1px solid rgba(255,240,215,.13)}
.chart-grid span em{position:absolute;left:0;top:-.75em;font-style:normal;font-size:.68rem;color:var(--muted);white-space:nowrap}
.chart-grid span.chart-target{border-top:2px dashed #e2736b}
.legend .target-key{width:14px;height:0;border-top:2px dashed #e2736b;border-radius:0}
.chart .bar-col.picked .bar-stack{filter:brightness(1.3)}
.linechart{display:grid;grid-template-columns:64px minmax(0,1fr);gap:6px;margin-top:8px;color:#ffc66e}
.line-scale,.line-area{position:relative;height:130px}
.line-scale em{position:absolute;right:0;transform:translateY(-50%);font-style:normal;font-size:.68rem;color:var(--muted);white-space:nowrap}
.line-area{touch-action:pan-y;cursor:crosshair;border-left:1px solid rgba(255,240,215,.18);border-bottom:1px solid rgba(255,240,215,.18);margin-right:6px}
.line-area svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.norm-band{position:absolute;left:0;right:0;background:rgba(143,209,158,.16);border-block:1px dashed rgba(143,209,158,.55)}
.line-area .dot{position:absolute;width:7px;height:7px;margin:-3.5px;border-radius:50%;background:currentColor}
.line-area .dot.out{background:#e2736b;width:9px;height:9px;margin:-4.5px}
.line-area .dot.picked{box-shadow:0 0 0 4px rgba(255,255,255,.35)}
.line-dates{display:flex;justify-content:space-between;gap:8px;margin-left:70px;font-size:.7rem;color:var(--muted)}
.line-panel .facts+.bar-readout{margin-top:14px}
.facts dt small{display:block;font-size:.76rem;opacity:.7}
.viz-panel .stock-table td,.viz-panel .stock-table th{vertical-align:top}
.viz-wide{margin-bottom:14px}
@media (max-width:640px){.chart{padding-left:44px}.linechart{grid-template-columns:52px minmax(0,1fr)}.line-dates{margin-left:58px}}
.kpi-card strong.long{white-space:nowrap;font-size:clamp(1.05rem,2.1vw,1.9rem)}
.debtors .phone-only{display:none}
@media (max-width:640px){.kpi-card strong.long{font-size:clamp(.98rem,4.3vw,1.5rem)}.debtors table{min-width:0;width:100%}.debtors th:nth-child(2),.debtors th:nth-child(3),.debtors td:nth-child(2),.debtors td:nth-child(3){display:none}.debtors td:last-child{white-space:nowrap;text-align:right}.debtors .phone-only{display:block}}

/* правки 30.11 */
.guide{margin:0 0 16px;border:1px solid rgba(255,240,215,.16);border-radius:16px;background:rgba(0,0,0,.22);padding:0 16px}
.guide summary,.fold>summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:700}
.guide summary::before{content:"?";display:inline-grid;place-items:center;width:24px;height:24px;margin-right:10px;border-radius:50%;background:#ffc66e;color:#2b1c06}
.guide dl,.help-list{margin:0 0 14px}.guide dt,.help-list dt{font-weight:700;margin-top:10px}.guide dd,.help-list dd{margin:2px 0 0;opacity:.85}
.fold>summary{justify-content:center;border:1px solid rgba(255,240,215,.22);border-radius:99px;margin:10px 0;list-style:none;background:rgba(255,255,255,.05)}
.fold>summary::-webkit-details-marker{display:none}
.fold-hide{display:none}.fold[open]>summary .fold-show{display:none}.fold[open]>summary .fold-hide{display:inline}
.bar-readout.stacked{white-space:pre-line;line-height:1.55;padding:10px 14px;border-radius:14px;background:rgba(255,255,255,.06);color:inherit;font-size:.92rem}
.bar-readout.stacked::first-line{font-weight:700;color:#ffc66e}
.chart.tall .bars{height:340px}
.chart.tall{margin-top:14px}
.bar-group{display:flex;align-items:flex-end;justify-content:center;gap:1px;width:100%;height:100%}
.bar-group i{display:block;flex:1;max-width:9px;border-radius:3px 3px 0 0;background:var(--tone)}
.bar-col.picked .bar-group{background:rgba(255,255,255,.10)}
.day-stack{list-style:none;margin:0;padding:0;display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(250px,1fr))}
.day-stack li{display:grid;gap:3px;padding:10px 12px;border-radius:14px;background:rgba(255,255,255,.06);font-size:.9rem}
.cut-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.cut-col{border:1px solid rgba(255,240,215,.16);border-radius:16px;padding:12px 14px}
.cut-col.all{background:rgba(255,190,92,.12);border-color:rgba(255,190,92,.45)}
.cut-col h3{margin:0 0 6px;font-size:1rem}.cut-col p{display:flex;justify-content:space-between;gap:10px;margin:0;padding:6px 0;border-top:1px solid rgba(255,240,215,.1)}
.cut-col p b{font-size:1.15rem;white-space:nowrap}.cut-col p.sum{flex-wrap:wrap}.cut-col p.sum b{font-size:.95rem}
.cold-row{display:grid;grid-template-columns:minmax(0,1fr) auto 150px;gap:12px;align-items:baseline;padding:12px 0;border-bottom:1px solid rgba(255,240,215,.14)}
.cold-row b{font-size:1.5rem;white-space:nowrap}.cold-row small{opacity:.75;text-align:right}
.share-block h3{margin:14px 0 6px;font-size:1rem}
.work-grid{display:grid;gap:10px;grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
.work-col{border-radius:16px;padding:12px 14px;border:1px solid rgba(255,240,215,.16)}
.work-col h3{display:flex;justify-content:space-between;margin:0 0 8px;font-size:.95rem}.work-col h3 b{font-size:1.4rem}
.work-col ul{list-style:none;margin:0;padding:0}.work-col li{padding:6px 0;border-top:1px solid rgba(255,240,215,.1)}.work-col li small{display:block;opacity:.75}
.work-col.done{background:rgba(143,209,158,.12)}.work-col.late{background:rgba(226,115,107,.14)}.work-col.next{background:rgba(240,196,70,.10)}
.explain-grid{display:grid;gap:14px;grid-template-columns:repeat(3,minmax(0,1fr))}
.explain-grid h3{margin:0;font-size:1rem;display:grid;gap:2px}.explain-grid h3 b{font-size:1.5rem}.explain-grid p{font-size:.88rem;opacity:.85}
.money-lines{list-style:none;margin:0;padding:0;font-size:.9rem}.money-lines li{display:flex;justify-content:space-between;gap:10px;padding:5px 0;border-top:1px solid rgba(255,240,215,.1)}.money-lines b{white-space:nowrap}
.three-flows{display:grid;gap:10px;grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:12px}
.three-flows>div{display:grid;gap:3px;padding:12px 14px;border-radius:16px;border:2px solid var(--tone);background:color-mix(in srgb,var(--tone) 14%,transparent)}
.three-flows b{font-size:1.4rem;color:var(--tone)}.three-flows small{opacity:.75}
.debt-list li.plain{display:flex;flex-wrap:wrap;justify-content:space-between;gap:6px 12px;align-items:center;min-height:46px}.debt-list li.plain a{flex-basis:100%;font-size:.82rem;min-height:30px}
.brigade{border:1px solid rgba(255,240,215,.18);border-radius:18px;padding:14px 16px;margin-bottom:14px}
.brigade>header{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px;align-items:center}.brigade h3{margin:0}.brigade>header strong{font-size:1.35rem}
.brigade h4,.person h4{margin:14px 0 6px;font-size:.95rem}
.owe{color:#ffc66e}
.person{border-top:1px solid rgba(255,240,215,.14)}
.person summary{display:flex;justify-content:space-between;gap:12px;align-items:center;min-height:52px;cursor:pointer}
.person summary small{display:block;opacity:.7;font-size:.8rem}
.person-body{padding:0 0 14px}
.day-strip{display:grid;grid-template-columns:repeat(auto-fill,minmax(34px,1fr));gap:4px}
.day-strip span{display:grid;justify-items:center;padding:4px 0;border-radius:8px;background:rgba(255,255,255,.05)}.day-strip small{font-size:.66rem;opacity:.65}
.pay-list{list-style:none;margin:0;padding:0}.pay-list li{display:grid;grid-template-columns:110px minmax(0,1fr) auto;gap:10px;padding:6px 0;border-top:1px solid rgba(255,240,215,.1)}
.pay-cash{color:#8fd19e}.pay-bank{color:#8fb9ff}
.advice{border:1px solid rgba(255,198,110,.45);background:rgba(255,198,110,.08);border-radius:16px;padding:14px 16px;margin-bottom:12px}
.advice.closed{border-color:rgba(255,240,215,.14);background:none}
.advice header{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px}.advice h3{margin:0}.advice time{opacity:.75;font-size:.85rem}
.advice p{overflow-wrap:anywhere}
.advice-plan{list-style:none;margin:0 0 10px;padding:0}.advice-plan li{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-top:1px solid rgba(255,240,215,.12)}.advice-plan li.done b{color:#8fd19e}
.advice-panel{margin-bottom:14px}
.linked{margin:0;padding:10px 14px;border-radius:14px;background:rgba(143,209,158,.14)}
@media (min-width:901px){.kpi-grid.kpi-five{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media (max-width:900px){.cut-grid,.explain-grid,.three-flows{grid-template-columns:minmax(0,1fr)}}
@media (max-width:640px){.cold-row{grid-template-columns:minmax(0,1fr) auto}.cold-row small{grid-column:1/-1;text-align:left}.chart.tall .bars{height:300px}.pay-list li{grid-template-columns:92px minmax(0,1fr) auto}.guide{padding:0 12px}}
.viz-panel .hint a,.debt-list li.plain a{display:inline-flex;align-items:center;min-height:44px;min-width:44px}

/* Настройки: плашки «Почта» и «Ключи для ChatGPT» */
.settings-grid + .settings-grid{margin-top:18px}
.settings-grid .work-panel{display:flex;flex-direction:column;gap:12px;min-width:0}
.settings-grid .work-panel h2,.settings-grid .work-panel p{margin:0}
.settings-grid .check-field{align-self:stretch;align-items:flex-start;min-height:0}
.settings-grid .check-field input{margin-top:1px}
.token-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 0;border-bottom:1px solid var(--line-soft)}
.token-row strong{flex:1 1 140px;min-width:0;overflow-wrap:anywhere}.token-row span{flex:1 1 160px;min-width:0}.token-row small{display:block;color:var(--muted)}
.token-row .button{flex:none}
#token-result code{display:block;margin-top:6px;overflow-wrap:anywhere;user-select:all}
