:root {
  /* ── Brand palette — снято с sushandco.ru (зелёный/оранжевый совпали с brief точно,
     бежевый — реальный кремовый тон сайта, светлее прежнего) ── */
  --orange: #f86a2f;
  --green:  #243e1f;
  --beige:  #f5f0e8;
  --white:  #ffffff;

  /* ── Derived brand tones ── */
  --orange-hover: #e05a20;
  --orange-active: #c9501f;
  --green-dark: #162b13;
  --green-light: #33532c;
  --beige-light: #faf7f0;
  --beige-dark: #e3ddd0;
  --black: #15170f;

  /* ── Indicator trio (admin dots, table) ── */
  --red: #c62828;
  --yellow: #e6a800;

  /* ── Signature traffic-light backgrounds (насыщенные, тёмные) ── */
  --signal-green: #1a6b1a;
  --signal-yellow: #c49200;
  --signal-red: #b02020;

  /* ── UI tokens ── */
  --text: var(--black);
  --text-secondary: #4d4736;
  --bg: var(--beige);
  --border: rgba(21,23,15,0.14);
  --radius: 20px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.18);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.28);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.4);

  /* ── Шрифт сайта: "VasekInter" в их вёрстке — это переименованный Inter ── */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --nav-height: 60px;
  --header-height: 64px;
  --max-width: 1060px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Shell ─── */
.app {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--beige);
  overflow: hidden;
}

/* ─── Header (как на sushandco.ru: белая шапка + зелёная линия снизу —
   их лого тёмно-зелёное и нечитаемо на сплошной зелёной плашке) ── */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--white);
  border-bottom: 3px solid var(--green);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.logo-img--lg {
  height: 48px;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Content ─── */
.app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 8px;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .app-content {
    padding: 24px 24px 8px;
  }
}

/* ─── Bottom Nav ─── */
.bottom-nav {
  height: var(--nav-height);
  display: flex;
  background: var(--green);
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
  z-index: 1;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  color: #a9c89c;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 0;
  transition: color 0.2s;
  min-height: 44px;
  position: relative;
}

.nav-btn svg { width: 22px; height: 22px; }

.nav-btn.active {
  color: var(--orange);
}

.nav-btn.active::after {
  content: '';
  background: var(--orange);
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 2px;
  border-radius: 0 0 2px 2px;
}

.nav-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -2px;
  border-radius: 4px;
}

/* ─── Screen visibility ─── */
.screen { display: none; }
.screen.active { display: block; }

@media (min-width: 768px) {
  .screen.active {
    display: block;
    min-height: calc(100vh - var(--header-height) - var(--nav-height) - 56px);
  }
}

/* ============================================================ */
/*                    2‑COLUMN DESKTOP LAYOUT                   */
/* ============================================================ */
.calc-columns {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .calc-columns {
    flex-direction: row;
    align-items: flex-start;
  }

  .calc-col-form {
    flex: 0 0 48%;
    max-width: 480px;
  }

  .calc-col-result {
    flex: 1;
    position: sticky;
    top: 24px;
    min-width: 0;
  }
}

/* ─── Calc mode toggle (pill) ─── */
.mode-toggle {
  display: flex;
  gap: 6px;
  background: rgba(248,106,47,0.15);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.mode-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  background: transparent;
  color: var(--orange);
  transition: all 0.2s;
  min-height: 44px;
}

.mode-btn.active {
  background: var(--orange);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.mode-btn:active {
  transform: scale(0.97);
}

/* ─── Collapsible section — белая карточка с зелёным акцентом сверху,
   как карточки лотов "Бразилия / Индия / Эфиопия" на sushandco.ru ─── */
.collapsible {
  background: var(--white);
  border-radius: var(--radius);
  border-top: 5px solid var(--green);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  min-height: 48px;
  background: transparent;
  transition: background 0.15s;
}

.collapsible-header:hover {
  background: rgba(36,62,31,0.05);
}

.collapsible-header .icon {
  width: 28px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--green);
}

.collapsible-header .icon svg {
  width: 19px;
  height: 19px;
}

.collapsible-header .arrow svg {
  width: 14px;
  height: 14px;
  display: block;
}

.collapsible-header .title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  flex: 1;
  color: var(--green);
}

.collapsible-header .arrow {
  color: var(--text-secondary);
  transition: transform 0.25s;
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapsible.open .collapsible-header .arrow {
  transform: rotate(180deg);
}

.collapsible-body {
  display: none;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.2s ease-out;
}

.collapsible.open .collapsible-body {
  display: block;
}

/* ─── Stepper Input ─── */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stepper-btn {
  width: 31px;
  height: 31px;
  min-height: 31px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background 0.1s, transform 0.1s;
}

.stepper-btn:hover {
  background: var(--beige-dark);
}

.stepper-btn:active {
  transform: scale(0.9);
}

.stepper-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.stepper-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.stepper-input {
  flex: 1 1 0%;
  min-width: 0;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
  background: var(--bg);
  outline: none;
  min-height: 42px;
  padding: 0 4px;
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stepper-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36,62,31,0.15);
}

.stepper-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stepper-row {
  display: flex;
  gap: 8px;
}

.stepper-row + .stepper-row {
  margin-top: 12px;
}

.stepper-row .stepper-wrap {
  flex: 1;
  min-width: 0;
}

/* select styled as button */
.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--black);
  min-height: 42px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.select-wrap select:focus {
  border-color: var(--green);
  outline: none;
}

.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.8rem;
  pointer-events: none;
}

/* ─── Calculate button ─── */
.calc-btn {
  background: var(--orange);
  color: var(--white);
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 52px;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.calc-btn:hover {
  background: var(--orange-hover);
}

.calc-btn:active {
  transform: scale(0.98);
  background: var(--orange-active);
}

.calc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.calc-btn:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ─── Loading ─── */
.loading {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: none;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.loading.visible {
  display: flex;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ─── Error ─── */
.error {
  padding: 12px 16px;
  background: var(--white);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 12px;
  display: none;
  font-weight: 600;
}

.error.visible {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

/* ─── Min price banner ─── */
.min-price-banner {
  padding: 18px;
  background: var(--white);
  border-radius: var(--radius);
  border-top: 5px solid var(--green);
  text-align: center;
  margin-bottom: 12px;
  display: none;
  box-shadow: var(--shadow-sm);
}

.min-price-banner.visible {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.min-price-banner .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}

.min-price-banner .price {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--orange);
}

/* ─── Result signal (SIGNATURE) ─── */
.signal-card {
  display: none;
  width: 100%;
  padding: 32px 24px 22px;
  border-radius: 20px 20px 0 0;
  text-align: center;
  color: var(--white);
}

.signal-card.visible {
  display: block;
  animation: signalSlideIn 0.3s ease-out;
}

.signal-card.green { background: var(--signal-green); }
.signal-card.yellow { background: var(--signal-yellow); }
.signal-card.red { background: var(--signal-red); }

.signal-card .emoji {
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  font-size: 0;
  color: transparent;
}

.signal-card .emoji::before {
  content: '';
  display: block;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.signal-card.green .emoji::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1.2 14.4l-4.4-4.4 1.4-1.4 3 3 6-6 1.4 1.4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1.2 14.4l-4.4-4.4 1.4-1.4 3 3 6-6 1.4 1.4z'/%3E%3C/svg%3E");
}

.signal-card.yellow .emoji::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15.2a1.2 1.2 0 1 1 0-2.4 1.2 1.2 0 0 1 0 2.4zm1.15-4.7h-2.3L10.4 6.8h3.2l-.45 5.7z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15.2a1.2 1.2 0 1 1 0-2.4 1.2 1.2 0 0 1 0 2.4zm1.15-4.7h-2.3L10.4 6.8h3.2l-.45 5.7z'/%3E%3C/svg%3E");
}

.signal-card.red .emoji::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.3 13.1l-1.3 1.3-3-3-3 3-1.3-1.3 3-3-3-3 1.3-1.3 3 3 3-3 1.3 1.3-3 3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.3 13.1l-1.3 1.3-3-3-3 3-1.3-1.3 3-3-3-3 1.3-1.3 3 3 3-3 1.3 1.3-3 3z'/%3E%3C/svg%3E");
}

.signal-card .text {
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ─── Result metrics row (merged visually onto signal-card) ─── */
.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.signal-card.visible + .metrics-row {
  border-radius: 0 0 20px 20px;
  padding: 0 20px 24px;
  margin-top: -1px;
  box-shadow: none;
}

.signal-card.green.visible + .metrics-row { background: var(--signal-green); }
.signal-card.yellow.visible + .metrics-row { background: var(--signal-yellow); }
.signal-card.red.visible + .metrics-row { background: var(--signal-red); }

.metric-card {
  flex: 1 1 110px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  animation: cardFadeIn 0.3s ease-out;
  animation-fill-mode: backwards;
}

.metric-card:nth-child(1) { animation-delay: 0.05s; }
.metric-card:nth-child(2) { animation-delay: 0.1s; }
.metric-card:nth-child(3) { animation-delay: 0.15s; }

.metric-card .value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--white) !important;
}

.metric-card .label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Result details ─── */
.result-details {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease-out;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
}

.detail-row + .detail-row {
  border-top: 1px solid var(--border);
}

.detail-row .dl {
  color: var(--text-secondary);
}

.detail-row .dv {
  font-weight: 700;
  color: var(--green);
}

.detail-toggle {
  width: 100%;
  border: none;
  background: none;
  padding: 10px 8px 4px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
}

.detail-toggle:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── History ─── */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  text-align: center;
  gap: 8px;
}

.history-empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.5;
}

.history-empty p {
  font-size: 0.9rem;
}

.history-item {
  background: var(--white);
  border-radius: var(--radius);
  border-top: 5px solid var(--green);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#panel-calc-history .history-item {
  border-top: 5px solid var(--beige);
}

.history-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 48px;
}

.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-dot.green { background: var(--green); }
.history-dot.yellow { background: var(--yellow); }
.history-dot.red { background: var(--red); }

.history-info { flex: 1; min-width: 0; }
.history-info .hi-date { font-size: 0.76rem; font-weight: 500; color: var(--text-secondary); }
.history-info .hi-summary { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.history-metrics { text-align: right; flex-shrink: 0; }
.history-metrics .hm-profit { font-size: 0.88rem; font-weight: 700; color: var(--green); }
.history-metrics .hm-rent { font-size: 0.76rem; font-weight: 500; color: var(--text-secondary); }

.history-arrow {
  font-size: 0.72rem;
  color: var(--text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.history-item-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.history-item.open .history-item-body { display: block; }
.history-item.open .history-arrow { transform: rotate(180deg); }

/* ─── Admin tab ─── */
.admin-login {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
}

.admin-login.visible {
  display: flex;
}

/* app.js toggles only the .visible class; #admin-content also carries
   an inline style="display:none" from the original markup, which beats
   a plain class selector — !important is required to win the cascade */
#admin-content.visible {
  display: block !important;
}

.admin-login h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.admin-login p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}

.admin-login input {
  width: 100%;
  max-width: 280px;
  padding: 12px;
  font-size: 1rem;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

.admin-login input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36,62,31,0.15);
}

.admin-login .login-btn {
  background: var(--orange);
  color: var(--white);
  width: 100%;
  max-width: 280px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

.admin-login .login-btn:hover {
  background: var(--orange-hover);
}

.admin-login .login-btn:active {
  opacity: 0.85;
}

.admin-login .login-btn:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.admin-login .login-error {
  color: var(--red);
  font-size: 0.8rem;
  display: none;
}

.admin-login .login-error.visible {
  display: block;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-toolbar h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.admin-toolbar .logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-family: var(--font);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s;
}

.admin-toolbar .logout-btn:hover {
  background: rgba(198,40,40,0.1);
}

.admin-subtabs {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-subtab {
  flex: 0 1 auto;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font);
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
  min-height: 36px;
}

.admin-subtab.active {
  background: var(--green);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.admin-section {
  background: var(--white);
  border-radius: var(--radius);
  border-top: 5px solid var(--green);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.admin-section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}

.admin-stepper {
  margin-bottom: 10px;
}

.history-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.history-filter select {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  min-height: 36px;
  -webkit-appearance: none;
  appearance: none;
}

.history-filter .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-family: var(--font);
  border: 1.5px solid var(--orange);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--orange);
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s;
}

.history-filter .btn-outline svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.history-filter .btn-outline:hover {
  background: rgba(248,106,47,0.1);
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.admin-table th,
.admin-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.admin-table tr:nth-child(even) {
  background: var(--beige-light);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  color: var(--white);
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 999;
  display: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  max-width: 90vw;
}

.toast.visible { display: block; }
.toast.success { background: var(--signal-green); }
.toast.error { background: var(--signal-red); }

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes signalSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .signal-card {
    animation: none;
  }

  .metric-card {
    animation: none;
  }

  .loading.visible {
    animation: none;
    opacity: 0.7;
  }
}

/* ─── Focus visible ─── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.stepper-input:focus-visible,
.select-wrap select:focus-visible,
.admin-login input:focus-visible {
  outline: none;
}




  to { opacity: 1; transform: translateY(0); }
}

/* ─── Formula panel ─── */
.formula-section {
  margin-bottom: 20px;
}
.formula-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 4px;
}
.formula-section h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 12px 0 8px;
}
.formula-section > p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.formula-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.formula-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  background: var(--beige-light);
  border-radius: 8px;
  border-left: 3px solid var(--orange);
}
.formula-item .formula-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.formula-item .formula-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange);
  min-width: 24px;
  flex-shrink: 0;
}
.formula-item code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--black);
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
}
.formula-item .formula-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-left: 32px;
}
.formula-example {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--white);
  border: 1.5px solid var(--orange);
  border-radius: 8px;
  font-size: 0.85rem;
}
.formula-example .example-title {
  font-weight: 700;
  color: var(--green);
  margin-bottom: 6px;
}
.formula-example .example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.formula-example .example-row span {
  white-space: nowrap;
}
.formula-example .example-row .ex-val {
  font-weight: 700;
  color: var(--orange);
}
.formula-warn {
  font-size: 0.82rem;
  color: var(--yellow);
  margin-top: 2px;
  padding-left: 32px;
}
.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 8px;
}
.formula-table th,
.formula-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.formula-table th {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
}
.formula-table td {
  background: var(--white);
}
.formula-rule {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--beige-light);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--green);
  line-height: 1.5;
}

/* ─── Client input ─── */
.client-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  min-height: 42px;
}
.client-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36,62,31,0.15);
}

/* ─── Settings Log ─── */
.settings-log {
  margin-top: 12px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.settings-log-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.settings-log-title:hover {
  background: var(--beige-light);
}
.settings-log .settings-log-entries {
  display: none;
  padding: 0 12px 8px;
}
.settings-log.open .settings-log-entries {
  display: block;
}
.log-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.72rem;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}
.log-entry:first-child {
  border-top: none;
}
.log-ts {
  color: var(--text-secondary);
  white-space: nowrap;
  margin-right: 6px;
}
.log-arrow {
  color: var(--text-secondary);
  font-size: 0.7rem;
}
.log-old {
  color: var(--red);
  font-weight: 500;
}
.log-new {
  color: var(--green);
  font-weight: 600;
}
.log-detail {
  color: var(--text-secondary);
  font-style: italic;
}
.log-empty {
  font-size: 0.72rem;
  color: var(--text-secondary);
  padding: 8px 0;
  text-align: center;
}

/* ─── Formula inline input ─── */
.fml-stepper {
  display: inline-block;
  vertical-align: middle;
}
.fml-input {
  width: auto;
  min-width: 48px;
  max-width: 90px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--black);
  background: var(--bg);
  outline: none;
  padding: 1px 6px;
  font-family: var(--font);
  line-height: 1.3;
}
.fml-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(36,62,31,0.15);
}

/* ─── Formula toolbar ─── */
.formula-toolbar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

/* ─── Utility ─── */
.hidden { display: none !important; }
.visible { display: block; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Scrollbar ─── */
.app-content::-webkit-scrollbar {
  width: 4px;
}

.app-content::-webkit-scrollbar-track {
  background: transparent;
}

.app-content::-webkit-scrollbar-thumb {
  background: rgba(36,62,31,0.2);
  border-radius: 2px;
}

/* ─── Selection ─── */
::selection {
  background: #c8c4bb;
  color: var(--black);
}

.hi-client {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hi-comment {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#admin-hist-refresh.spinning svg {
  animation: spin 0.7s linear infinite;
  transform-origin: center;
  display: block;
}
#cb-rate-icon.spin {
  animation: spin 0.8s linear infinite;
}

/* ── P3: компактный список оборудования (1 тип = 1 строка, поле справа) ── */
/* build marker: sushco-calc-v1 */
#screen-calc .eq-compact { display: flex; flex-direction: column; gap: 4px; }
#screen-calc .eq-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
}
#screen-calc .eq-row .eq-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.2;
  color: var(--text, #1a1a1a);
}
#screen-calc .eq-row .stepper { flex: 0 0 auto; }
/* компактнее высота степперов в менеджерской форме */
#screen-calc .stepper-input { padding-top: 8px; padding-bottom: 8px; }

/* P3 fix: на мобиле поле количества фиксируем узким, чтобы имя оборудования не дробилось */
#screen-calc .eq-row { gap: 8px; }
#screen-calc .eq-row .eq-name { flex: 1 1 auto; font-size: 0.85rem; }
#screen-calc .eq-row .stepper { flex: 0 0 auto; width: auto; gap: 6px; }
#screen-calc .eq-row .stepper-input { flex: 0 0 54px; width: 54px; min-width: 54px; }
