/* Шапка, пресеты и выбор модели по актуальным макетам Penpot. */
.app-header-inner { min-height: 94px; padding: 16px 22px; gap: 20px; }
.app-brand { gap: 48px; }
.app-brand-title { display: flex; flex-direction: column; gap: 5px; }
.app-brand-title h1 { margin: 0; font-size: clamp(20px, 1.5vw, 26px); line-height: 1.1; }
.app-brand-subtitle { color: var(--md-sys-color-on-surface-variant); font-size: 10px; font-weight: 700; letter-spacing: .01em; text-transform: uppercase; }
.app-brand-mobile-subtitle, .app-model-mobile-label { display: none; }
.app-header-actions { gap: 8px; }
.app-header-menu { display: none; }
.app-header-menu svg { width: 20px; height: 20px; }
.app-bottom-actions { display: none; }

.app-presets { position: relative; }
.app-presets > div:first-child { display: block; margin: 0 0 18px; padding-right: 38px; }
.app-presets h2 { margin: 0; line-height: 1.2; }
.app-presets p, .app-model-subtitle { margin: 4px 0 0; color: var(--md-sys-color-on-surface-variant); font-size: 12px; line-height: 1.3; }
.app-presets .app-top-corner-icon { position: absolute; top: 16px; right: 22px; width: 32px; height: 32px; }
.app-top-status { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.preset-mobile-description { display: none; }
#presetButtonsContainer { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
#presetButtonsContainer .m3-chip { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; min-width: 0; min-height: 46px; padding: 8px 9px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 7px; box-shadow: none; text-align: left; line-height: 1.1; }
.preset-name { font-size: 11px; font-weight: 700; white-space: nowrap; }
.preset-action { color: var(--md-sys-color-on-surface-variant); font-size: 10px; font-weight: 400; }

.app-model { display: flex; flex-direction: column; justify-content: flex-start; gap: 0; }
.app-model > :not([hidden]) ~ :not([hidden]) { margin-top: 0; }
.app-model-heading { display: block; margin: 0; padding: 0; border: 0; }
.app-model-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.app-model-choices .m3-selection-card { display: flex; align-items: center; gap: 9px; min-height: 56px; padding: 9px 12px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 9px; cursor: pointer; }
.app-model-choices input[type="radio"] { appearance: none; width: 12px; height: 12px; margin: 0; border: 1px solid var(--md-sys-color-outline); border-radius: 50%; background: var(--md-sys-color-surface-container-lowest); flex: none; }
.app-model-choices input[type="radio"]:checked { border-color: var(--md-sys-color-primary); background: var(--md-sys-color-primary); }
.app-model-choices .model-icon { font-size: 18px; }
.app-model-choices .card-title { font-size: 13px; line-height: 1.2; }
.app-model-choices .card-desc { margin-top: 4px; color: var(--md-sys-color-on-surface-variant); font-size: 11px; line-height: 1.2; }
.app-model #boxPoolModeModel, .app-model #boxPoolModeAnchor { margin-top: 12px !important; padding: 14px !important; border: 0 !important; border-radius: 11px; background: var(--md-sys-color-surface-container) !important; }
.app-model #boxPoolModeModel > :not([hidden]) ~ :not([hidden]), .app-model #boxPoolModeAnchor > :not([hidden]) ~ :not([hidden]) { margin-top: 0 !important; }
.app-model #boxPoolModeModel:not(.hidden), .app-model #boxPoolModeAnchor:not(.hidden) { display: flex; flex-direction: column; gap: 11px; }
.app-model-metrics { display: grid; grid-template-columns: minmax(120px, 175px) repeat(2, minmax(100px, 1fr)); gap: 14px 36px; }
.app-model-metric { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.app-model-metric > span, .app-model-metric > label, .app-anchor-field > span { color: var(--md-sys-color-on-surface-variant); font-size: 11px; font-weight: 600; }
.app-model-metric .app-model-value { color: var(--md-sys-color-on-surface); font-size: 13px; font-weight: 700; }
.app-model-metric.effective-metric .app-model-value { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 32px; text-align: center; }
.app-model .app-tariff-input { width: 100%; height: 32px; padding: 4px 8px; font-weight: 700; }
.app-model-formula { color: var(--md-sys-color-on-surface); font-size: 12px; font-weight: 700; line-height: 1.4; }
.app-model-info { color: var(--md-sys-color-on-surface-variant); font-size: 11px; line-height: 1.35; }
.app-model-info strong { font-weight: 600; }
.app-anchor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.app-anchor-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.app-anchor-field input, .app-anchor-field select { width: 100%; min-height: 34px; padding: 6px 8px; }
.app-anchor-explanation { margin: 0; color: var(--md-sys-color-on-surface-variant); font-size: 11px; line-height: 1.4; }

@media (min-width: 640px) and (max-width: 1199px) {
  #presetButtonsContainer { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .app-header-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'logo menu' 'title title' 'actions actions'; min-height: 0; padding: 16px 22px; gap: 12px; }
  .app-brand { display: contents; }
  .app-brand-logo { grid-area: logo; }
  .app-brand-title { grid-area: title; gap: 4px; }
  .app-brand-title h1 { font-size: 20px; }
  .app-brand-subtitle { font-size: 11px; font-weight: 400; text-transform: none; }
  .app-brand-desktop-subtitle, .app-model-desktop-label { display: none; }
  .app-brand-mobile-subtitle, .app-model-mobile-label { display: inline; }
  .app-header-menu { display: inline-flex; grid-area: menu; justify-content: center; align-items: center; }
  .app-header-actions { display: none; grid-area: actions; width: 100%; }
  .menu-open .app-header-actions { display: flex; }
  .app-bottom-actions { display: flex; flex-wrap: wrap; gap: 8px; order: 7; }
  .app-bottom-actions .m3-btn { min-height: 40px; }
  .app-presets, .app-model { padding: 16px 22px; }
  .app-presets > div:first-child { margin-bottom: 8px; }
  .preset-desktop-description { display: none; }
  .preset-mobile-description { display: inline; }
  #presetButtonsContainer { grid-template-columns: repeat(2, minmax(0, 101px)); gap: 6px 10px; }
  #presetButtonsContainer .m3-chip { min-height: 30px; padding: 7px 9px; }
  .preset-action { display: none; }
  .app-model-choices { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .app-model-choices .m3-selection-card { min-height: 54px; }
  .app-model-choices .card-desc { display: none; }
  .app-model-metrics { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; }
  .app-model-metric.base-metric { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 4px; }
  .app-model-formula { max-width: 245px; }
  .app-model-formula span:not(.app-model-formula-divider) { display: block; }
  .app-model-formula-divider { display: none; }
  .app-anchor-fields { grid-template-columns: 1fr; }
}
