/* Веб agro: каркас кабинета по бренду MidMillion (токены — /styles/tokens.css).
   Светлая тема, тонкие рамки вместо теней, одна главная кнопка (ink) на экран, индиго — активное
   состояние и фокус. Без градиентов, эмодзи и цветных полос. Телефон: меню в выдвижной панели, поля 16px. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.display { margin-bottom: var(--space-6); }
.caption { color: var(--ink-muted); }

.brand-word { font-weight: 600; color: var(--ink); }

/* Каркас: меню 240px слева на surface-sunken, контент с полями 32px. */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface-sunken); border-right: 1px solid var(--border); }
.content { padding: var(--space-8); min-width: 0; }
.drawer { display: none; }

.nav { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-6) var(--space-4); height: 100%; }
.nav-brand { display: block; padding: 0 var(--space-2) var(--space-6); color: var(--ink); }
.nav-brand:hover { text-decoration: none; }
.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2); border-radius: var(--radius-md);
  color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-hover); text-decoration: none; }
.nav-item.is-active { background: var(--surface-hover); color: var(--brand); }
.nav-button { width: 100%; border: 0; background: none; font-family: inherit; cursor: pointer; text-align: left; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-6); }
.nav-foot .caption { padding: 0 var(--space-2) var(--space-2); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-6); }
.empty { color: var(--ink-muted); display: flex; flex-direction: column; gap: var(--space-4); align-items: flex-start; max-width: 640px; }

/* Вход */
.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); background: var(--surface-sunken); }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--space-4); }
.login-brand { font-size: 17px; }
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.label { font-size: 14px; line-height: 20px; font-weight: 500; }
input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  padding: var(--space-2) 12px; min-height: 40px;
}
input:focus { border-color: var(--brand); outline: 2px solid var(--brand-tint); outline-offset: 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--border-control); background: var(--surface); color: var(--ink);
  font: 500 14px/20px var(--font-sans); cursor: pointer;
}
.button:hover { background: var(--surface-hover); text-decoration: none; }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: var(--ink-muted); border-color: var(--ink-muted); }
.notice { border-radius: var(--radius-sm); padding: var(--space-2) 12px; font-size: 14px; }
.notice-negative { color: var(--negative); border: 1px solid var(--negative); background: var(--surface); }
.lang-link { align-self: flex-start; }

/* Телефон: меню — выдвижная панель (details), поля 16px, одна колонна. */
@media (max-width: 768px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { display: none; }
  .drawer { display: block; background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
  .drawer-toggle {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px var(--space-4); cursor: pointer; list-style: none;
  }
  .drawer-toggle::-webkit-details-marker { display: none; }
  .drawer-label { font-size: 14px; font-weight: 500; color: var(--ink-muted); }
  .drawer .nav { padding-top: 0; }
  .drawer .nav-brand { display: none; }
  .content { padding: var(--space-4); }
  .display { font-size: 28px; line-height: 34px; }
}

/* ---------- Экран объёмов (PR B) ---------- */
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-family: var(--font-mono); font-size: 13px; line-height: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon-16 { width: 16px; height: 16px; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; margin-bottom: var(--space-6); }
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pill {
  display: inline-flex; flex-direction: column; justify-content: center;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500; background: var(--surface);
}
.pill:hover { background: var(--surface-hover); text-decoration: none; }
.pill.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.pill-note { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-muted); }
.notice { margin-bottom: var(--space-4); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.layout.has-panel { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.crop-title { margin: var(--space-6) 0 var(--space-4); display: flex; gap: var(--space-4); align-items: baseline; flex-wrap: wrap; }
.crop-title:first-child { margin-top: 0; }
.tree { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.region + .region { border-top: 1px solid var(--border); }
.region > summary {
  display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  padding: 12px var(--space-4); cursor: pointer; background: var(--surface-sunken); list-style: none;
}
.region > summary::-webkit-details-marker { display: none; }
.region > summary::before { content: "›"; margin-right: var(--space-2); color: var(--ink-muted); transition: transform .15s; }
.region[open] > summary::before { transform: rotate(90deg); }
.region > summary .label { flex: 1; }
.districts { list-style: none; margin: 0; padding: 0; }
.district > a {
  display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
  padding: 10px var(--space-4) 10px var(--space-8); color: var(--ink); border-top: 1px solid var(--border);
}
.district > a:hover { background: var(--surface-hover); text-decoration: none; }
.district.is-open > a { color: var(--brand); background: var(--brand-tint); }
.hint { margin-top: var(--space-4); }

.vrows { border-top: 1px solid var(--border); }
.vrow {
  display: grid; grid-template-columns: 40px 80px 90px minmax(0, 1.2fr) 80px minmax(0, 2fr);
  gap: var(--space-2); align-items: center; padding: 8px var(--space-4); border-bottom: 1px solid var(--border);
}
.vrow-head { background: var(--surface-sunken); color: var(--ink-muted); font-size: 13px; line-height: 18px; font-weight: 500; }
.vrow.is-selected { background: var(--brand-tint); }
.vrow .num { text-align: right; }
.status { color: var(--ink); }
.status-positive { color: var(--positive); }
.status-negative { color: var(--negative); }
.star-form { margin: 0; }
.star {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--ink-muted); cursor: pointer;
}
.star:hover { background: var(--surface-hover); }
.star.is-on { color: var(--brand); }
.star.is-on svg { fill: currentColor; }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; padding: 12px var(--space-4); }
.pager .caption { margin-right: auto; }

.panel {
  position: sticky; top: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); background: var(--surface);
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.panel-actions { display: flex; align-items: center; gap: var(--space-2); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--space-4); margin: 0; }
.facts dt { color: var(--ink-muted); font-size: 14px; }
.facts dd { margin: 0; }
.prices, .calls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.prices li { display: flex; flex-direction: column; padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.figure-sm { font-size: 17px; line-height: 24px; font-weight: 600; }
.deal { border-top: 1px solid var(--border); padding-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.deal-form { display: flex; gap: var(--space-2); flex-wrap: wrap; }

@media (max-width: 1024px) {
  .vrow { grid-template-columns: 40px 70px 80px minmax(0, 1fr) 70px; }
  .vrow > :last-child { grid-column: 2 / -1; }
  .vrow-head > :last-child { display: none; }
}
@media (max-width: 768px) {
  .layout.has-panel { grid-template-columns: minmax(0, 1fr); }
  .panel { position: fixed; inset: 0; z-index: 10; border: 0; border-radius: 0; max-height: none; padding: var(--space-4); }
  .vrow-head { display: none; }
  .vrow { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); padding: 10px var(--space-4); }
  .vrow > :nth-child(2) { grid-column: 2 / -1; }
  .vrow > :nth-child(n + 3) { grid-column: auto; }
  .vrow > :last-child { grid-column: 1 / -1; }
  .vrow .num { text-align: left; }
  .district > a { padding-left: var(--space-6); }
  .toolbar { flex-direction: column; }
}
