/* Кабинет клиента — продолжение сайта agavaconsult.ru: палитра «Строгий изумруд», Inter.
   Токены взяты из site/src/styles/tokens.css (менять значения там и здесь одинаково). */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/static/fonts/inter-cyrillic-400.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/static/fonts/inter-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193, U+2212; }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/static/fonts/inter-cyrillic-600.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/static/fonts/inter-latin-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193, U+2212; }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/static/fonts/inter-cyrillic-700.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/static/fonts/inter-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193, U+2212; }
@font-face { font-family: 'Inter'; font-weight: 800; font-display: swap; src: url('/static/fonts/inter-cyrillic-800.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-weight: 800; font-display: swap; src: url('/static/fonts/inter-latin-800.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-2193, U+2212; }

:root {
  --forest: #0B2724; --forest-2: #123B36; --forest-deep: #071D1B;
  --paper: #FFFFFF; --cream: #EEF2F0; --mint: #E3EFEA;
  --ink: #1B2422; --ink-2: #465A57; --muted: #5B6B68;
  --line: rgba(16, 35, 33, 0.12); --line-strong: rgba(16, 35, 33, 0.28);
  --lime: #CDE85D; --green: #2B8C72; --green-dark: #1F715C; --accent: #1F715C; --accent-dark: #175847;
  --on-dark: #FFFFFF; --on-dark-muted: rgba(255, 255, 255, 0.72); --on-dark-line: rgba(255, 255, 255, 0.14);
  --danger: #B42318; --danger-soft: #FDF0EE; --warn: #8A5A00; --warn-soft: #FFF5DB;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --radius-s: 10px; --radius-m: 16px; --radius-lg: 22px;
  --shadow: 0 24px 70px rgba(11, 39, 36, 0.10);
  --side: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-weight: 800; line-height: 1.15; margin: 0 0 16px; color: var(--ink); text-wrap: balance; overflow-wrap: break-word; }
h1 { font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2.25rem); letter-spacing: -0.035em; }
h2 { font-size: 1.3125rem; letter-spacing: -0.02em; }
h3 { font-size: 1.0625rem; letter-spacing: -0.01em; font-weight: 700; }
p { margin: 0 0 14px; color: var(--ink-2); }
a { color: var(--green-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green); }
small, .small { font-size: 0.875rem; color: var(--muted); }
.tiny { font-size: 0.8125rem; color: var(--muted); }
ul, ol { margin: 0 0 14px; padding-left: 1.25em; color: var(--ink-2); }
li + li { margin-top: 6px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 20px; }
.mb0 { margin-bottom: 0; }

/* Каркас: тёмная боковая панель «лес» и светлая рабочая область */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; color: var(--on-dark); padding: 22px 16px; display: flex; flex-direction: column; gap: 18px;
  background: radial-gradient(circle at 90% 6%, rgba(205, 232, 93, 0.16), transparent 30%), radial-gradient(circle at 0% 100%, rgba(43, 140, 114, 0.34), transparent 36%), linear-gradient(160deg, var(--forest), var(--forest-deep) 70%, #12352F); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 4px 8px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand b { display: block; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.brand span { display: block; font-size: 0.75rem; color: var(--on-dark-muted); }
.brand:hover { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; color: var(--on-dark-muted); text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav a.is-active { background: rgba(205, 232, 93, 0.12); color: #fff; box-shadow: inset 3px 0 0 var(--lime); }
.nav .count { font-size: 0.75rem; font-weight: 800; background: var(--lime); color: var(--forest); border-radius: 999px; padding: 1px 8px; }
.nav-label { font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); padding: 10px 12px 4px; font-weight: 700; }
.side-foot { margin-top: auto; border-top: 1px solid var(--on-dark-line); padding: 14px 8px 0; font-size: 0.8125rem; color: var(--on-dark-muted); }
.side-foot b { display: block; color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.side-foot a { color: var(--on-dark-muted); }
.side-foot a:hover { color: var(--lime); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.side-foot .linklike { color: var(--on-dark-muted); }
.side-foot .linklike:hover { color: var(--lime); }
.main { padding: 28px clamp(16px, 3vw, 44px) 64px; max-width: 1240px; width: 100%; }
.topbar { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; max-width: 70ch; }
.eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--green-dark); margin-bottom: 8px; }
.crumbs { font-size: 0.8125rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; display: none; }
  .side.is-open { display: flex; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--forest); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; }
  .menu-btn { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; min-height: 40px; padding: 0 14px; font: inherit; font-weight: 700; }
}

/* Карточки и сетки */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 18px; }
.card > :last-child { margin-bottom: 0; }
.card--mint { background: var(--mint); border-color: transparent; }
.card--dark { background: var(--forest); color: #fff; border-color: var(--forest); }
.card--dark h2, .card--dark h3 { color: #fff; }
.card--dark p, .card--dark .small { color: var(--on-dark-muted); }
.card--warn { background: var(--warn-soft); border-color: rgba(138, 90, 0, 0.25); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid, .card + .grid { margin-top: 18px; }
@media (max-width: 1100px) { .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); } }
.stat { display: block; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 1.875rem; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 0.875rem; color: var(--muted); }
a.stat:hover b { color: var(--green-dark); }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; font-family: var(--font); font-weight: 700; font-size: 0.9375rem; line-height: 1.2; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 10px 24px rgba(31, 113, 92, .2); }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn--dark { background: var(--forest); color: #fff; border-color: var(--forest); }
.btn--dark:hover { background: var(--forest-2); color: #fff; }
.btn--outline { background: transparent; color: var(--forest); border-color: var(--line-strong); }
.btn--outline:hover { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn--lime { background: var(--lime); color: var(--forest); border-color: var(--lime); }
.btn--lime:hover { background: #dbf07a; color: var(--forest); }
.btn--danger { background: transparent; color: var(--danger); border-color: rgba(180, 35, 24, .4); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: 0.8125rem; border-radius: 11px; }
td .btn { white-space: nowrap; }
td .actions .btn { white-space: normal; text-align: left; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }

/* Формы */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 600; font-size: 0.875rem; color: var(--ink); }
.field input, .field select, .field textarea, .input { min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 1rem; width: 100%; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 3px solid rgba(43, 140, 114, .35); outline-offset: 0; border-color: var(--green-dark); }
.field input[readonly] { background: var(--cream); color: var(--ink-2); }
.field .hint, .hint { font-size: 0.8125rem; color: var(--muted); font-weight: 400; }
.field--check { flex-direction: row; align-items: flex-start; gap: 10px; }
.field--check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--green-dark); flex: none; }
.field--check label { font-weight: 400; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.input--num { text-align: right; font-variant-numeric: tabular-nums; max-width: 130px; min-height: 38px; padding: 6px 10px; }
.input--sm { min-height: 38px; padding: 6px 10px; font-size: 0.9375rem; }

/* Сообщения */
.flash { border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; border: 1px solid transparent; font-weight: 500; overflow-wrap: anywhere; }
.flash--ok { background: var(--mint); color: var(--forest); border-color: rgba(31, 113, 92, .25); }
.flash--warn { background: var(--warn-soft); color: #5F3E00; border-color: rgba(138, 90, 0, .25); }
.flash--error { background: var(--danger-soft); color: var(--danger); border-color: rgba(180, 35, 24, .25); }
.note { border-left: 4px solid var(--green); background: var(--mint); padding: 12px 16px; border-radius: 0 12px 12px 0; margin-bottom: 14px; color: var(--forest); }
.note--warn { border-left-color: var(--warn); background: var(--warn-soft); color: #5F3E00; }
.note--danger { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.note p { color: inherit; margin-bottom: 6px; }
.note > :last-child { margin-bottom: 0; }

/* Метки статусов */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; background: #EEF0EF; color: var(--ink-2); }
.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag--ok { background: var(--mint); color: var(--green-dark); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.tag--plain::before { display: none; }
.soon { display: inline-block; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 2px 9px; }
.code { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }

/* Таблицы */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); margin-bottom: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--ink); background: var(--paper); font-size: 0.8125rem; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.is-total td { font-weight: 700; background: var(--cream); }
.table--form td { vertical-align: middle; }
.table--dense th, .table--dense td { padding: 6px 8px; font-size: 0.75rem; }
.table--dense th { white-space: normal; min-width: 62px; }

/* Задачи и списки */
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.task:first-child { padding-top: 0; }
.task:last-child { border-bottom: 0; padding-bottom: 0; }
.task h3 { margin: 0 0 4px; }
.task p { margin: 0; font-size: 0.9375rem; }
.task--warn h3::before { content: '!'; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 0.75rem; margin-right: 8px; vertical-align: 2px; }
@media (max-width: 760px) { .task { grid-template-columns: minmax(0, 1fr); } }
.dl { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr); gap: 8px 18px; margin: 0 0 14px; }
.dl dt { color: var(--muted); font-size: 0.875rem; }
.dl dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 640px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 10px; } }
.due { font-weight: 700; white-space: nowrap; }
.due--soon { color: var(--warn); }
.due--late { color: var(--danger); }
.meter { height: 8px; border-radius: 999px; background: var(--cream); overflow: hidden; margin: 8px 0 12px; display: flex; }
.meter i { display: block; flex: 1; background: var(--green); margin-right: 3px; border-radius: 999px; }
.meter i.is-empty { background: rgba(16, 35, 33, 0.14); }
.meter i:last-child { margin-right: 0; }
.months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 4px; }
@media (max-width: 760px) { .months { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.month { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--paper); color: var(--ink); }
.month:hover { border-color: var(--green-dark); color: var(--ink); }
.month b { display: block; text-transform: capitalize; }
.month span { font-size: 0.8125rem; color: var(--muted); }
.month--closed { background: var(--mint); border-color: transparent; }
.month--open { border-color: rgba(138, 90, 0, .45); }
.month--future { opacity: .45; pointer-events: none; }
details.block { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; background: var(--paper); }
details.block > summary { cursor: pointer; font-weight: 700; }
details.block[open] > summary { margin-bottom: 12px; }
.waste-name { display: inline-block; font-weight: 600; color: var(--ink); }
.waste-name::first-letter { text-transform: uppercase; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.qa { border-top: 1px solid var(--line); padding: 16px 0; }
.qa:first-of-type { border-top: 0; padding-top: 0; }
.qa .answer { background: var(--mint); border-radius: 14px; padding: 12px 16px; margin-top: 10px; color: var(--forest); }

/* Страницы входа */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; color: #fff;
  background: radial-gradient(circle at 82% 18%, rgba(205, 232, 93, 0.16), transparent 26%), radial-gradient(circle at 8% 92%, rgba(43, 140, 114, 0.34), transparent 30%), linear-gradient(135deg, var(--forest), var(--forest-deep) 68%, #12352F); }
.auth-box { width: 100%; max-width: 460px; }
.auth-box--wide { max-width: 760px; }
.auth .brand { margin-bottom: 18px; padding: 0; }
.auth .card { box-shadow: var(--shadow); padding: 28px; }
.auth-foot { margin-top: 14px; font-size: 0.8125rem; color: var(--on-dark-muted); text-align: center; }
.auth-foot a { color: var(--on-dark-muted); }
.prose { max-width: 76ch; }
.prose h2 { margin-top: 28px; }

@media print {
  .side, .topbar, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .table-wrap { border-color: #999; break-inside: avoid; }
  .table-wrap { overflow: visible; }
}
