@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600;700&family=Space+Grotesk:wght@400;500;600&display=swap");

:root{
  --bg: #f5f5fb;
  --bg-card: #ffffff;
  --border-subtle: #e0e3ee;
  --accent: #2f6df2;
  --accent-soft: rgba(47, 109, 242, 0.08);
  --text-main: #1f2430;
  --text-muted: #6c7285;
  --danger: #e55353;
  --danger-soft: rgba(229, 83, 83, 0.08);
  --success: #28a745;
  --success-soft: rgba(40, 167, 69, 0.08);
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --transition-fast: 0.16s.ease-out;
}

/* Menu print: tighter spacing */
#section-menu-print .card{
  margin-bottom: 16px;
}

#section-menu-print .menu-print-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#section-menu-print .menu-print-header h2{
  margin: 0;
}

#section-menu-print .menu-print-header .btn-row{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

#section-menu-print .card-header{
  padding: 10px 14px 4px;
}

#section-menu-print .section-title{
  margin: 0 0 4px;
}

#section-menu-print .section-subtitle{
  margin: 2px 0 0;
}

#section-menu-print .menu-print-layout{
  padding: 6px 14px 14px;
}

#section-menu-print .menu-print-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* базовая разметка */

*, *::before, *::after{
  box-sizing: border-box;
}

body{
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #f8fbff 0, #eef1f7 42%, #e6e7f0 100%);
  color: var(--text-main);
}

.app-shell{
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

.app-header{
  margin-bottom: 24px;
}

.app-header-main{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.logo-block{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo-row{
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-compact{
  padding: 6px 12px;
  font-size: 13px;
}

.app-logo{
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app-subtitle{
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 0;
}

.app-badge{
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

.mode-toggle{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-toggle select{
  height: 32px;
}

.mode-hint{
  font-size: 12px;
  color: var(--text-muted);
}

.manual-body{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.manual-block{
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.manual-block h4{
  margin: 0 0 6px;
}

.manual-block ul{
  margin: 0;
  padding-left: 18px;
  color: var(--text-main);
}

.manual-block li{
  margin-bottom: 6px;
  line-height: 1.45;
}

.manual-lang{
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-nav{
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.admin-banner{
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-main);
}

.admin-banner-title{
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-size: 11px;
}

.admin-banner-scope{
  color: var(--text-muted);
}

.nav-tab{
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.nav-tab:hover{
  background: rgba(15, 23, 42, 0.04);
  transform: translateY(-1px);
}

.nav-tab-active{
  background: #1f2937;
  color: #ffffff;
}

.subnav{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: transparent;
  width: auto;
  margin: 0 0 14px 0;
}
.subnav-tab{
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.subnav-tab:hover{
  background: rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.subnav-tab-active{
  background: #111827;
  color: #fff;
}

.subview{
  display: none;
}

.subview-active{
  display: block;
}

.global-error{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.app-main{
  display: block;
}

.section-header{
  margin-bottom: 16px;
}

.section-header h2{
  margin: 0 0 6px;
  font-size: 22px;
}

.section-description{
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.view > .section-inner{
  max-width: 1200px;
  margin: 0 auto;
}
/* align direct children of section-inner consistently */
.view > .section-inner > *{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
/* unify left padding inside section bodies */
.view > .section-inner > .section-header, .view > .section-inner > .subnav, .view > .section-inner > .subview, .view > .section-inner > .card{
  padding-left: 0;
  padding-right: 0;
}

/* summary / hero */

.hero-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}



.turnover-body{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.turnover-card .card-body{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.turnover-controls{
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.turnover-controls .block{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.turnover-controls .block label{
  color: var(--accent);
  font-weight: 700;
}

.turnover-kpis{
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}
.turnover-kpis.two-col{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.turnover-kpis .kpi-group{
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}
.turnover-kpis .kpi-group .group-title{
  font-weight: 700;
  color: var(--text-main);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.turnover-kpis .big-number{
  font-size: 20px;
  font-weight: 700;
  min-width: 120px;
  text-align: left;
}
.kpi-group{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #f9fafb;
  width: 100%;
}
.kpi-group .group-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 4px;
  grid-column: 1 / -1;
}
.kpi-group > div:not(.group-title){
  display: flex;
  flex-direction: column;
  gap: 0px;
}
.kpi-row{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px;
}
.kpi-row span:first-child{
  font-size: 12px;
  color: var(--text-muted);
}
.kpi-badge{
  display: inline-block;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text-main);
  min-width: 110px;
}
.kpi-positive{
  background: var(--success-soft);
  color: var(--success);
}
.kpi-warn{
  background: rgba(255, 193, 7, 0.16);
  color: #b07800;
}
.kpi-negative{
  background: var(--danger-soft);
  color: var(--danger);
}
.kpi-row{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}
.kpi-row span:first-child{
  font-size: 12px;
  color: var(--text-muted);
}
.turnover-guest-list{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.turnover-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.turnover-item{
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  align-items: center;
}

.turnover-qty{
  width: 90px;
  min-width: 90px;
}
.guest-card{
  padding: 12px;
  width: 100%;
  border: 1px solid var(--border-subtle);
}
.guest-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.guest-card-head .small-note{
  font-weight: 700;
  color: var(--text-main);
}
.guest-kpis{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}



.turnover-summary{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 8px;
}
.turnover-summary-box{
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.turnover-summary-box .summary-title{
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-size: 12px;
}
.turnover-summary-box .summary-line{
  font-size: 13px;
  color: var(--text-main);
}
.turnover-msg{
  margin-top: 6px;
  color: var(--danger);
}

/* analytics what-if */
.whatif-grid{
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.whatif-controls, .whatif-results{
  padding: 12px;
}
.whatif-results{
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.whatif-results-col{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.whatif-results-col .chip{
  width: 100%;
}



.ai-suggestions{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-group{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.ai-group-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.ai-group-title{
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.ai-group-meta{
  font-size: 12px;
  color: var(--text-muted);
}
.ai-group-body{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-card{
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafafa;
}
.ai-card-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.ai-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.ai-impact{
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.ai-why{
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.ai-meta{
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-badge{
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
}
.ai-badge.ai-flag{
  background: #fef3c7;
  color: #92400e;
}
.ai-badge.ai-confidence-low{
  background: #fee2e2;
  color: #991b1b;
}
.ai-badge.ai-confidence-medium{
  background: #e0f2fe;
  color: #1e40af;
}
.ai-badge.ai-confidence-high{
  background: #dcfce7;
  color: #166534;
}
.ai-actions{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-toggle{
  margin-top: 8px;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  text-align: left;
}
.ai-impact-high{
  border-left: 3px solid #16a34a;
}
.ai-impact-medium{
  border-left: 3px solid #f59e0b;
}
.ai-impact-low{
  border-left: 3px solid #94a3b8;
}
.scope-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.whatif-scope-btn{
  border-radius: 8px;
}
.whatif-scope-active{
  background: var(--accent);
  color: #fff;
}
.preset-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.slider-row{
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
.slider-label{
  font-size: 13px;
  color: var(--text-muted);
}
.slider-input{
  width: 80px;
}
.whatif-actions{
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.budget-grid{
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.budget-panel{
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-panel-title{
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.budget-form{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-form-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px 12px;
}

.budget-form-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.budget-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 4px;
}

.budget-summary-card{
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-kpis{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.budget-kpis .chip{
  width: 100%;
}

.budget-table{
  margin-top: 6px;
}

.budget-hero{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(90deg, #fff7ed 0%, #f8fafc 100%);
  border: 1px solid var(--border-subtle);
}

.budget-hero-card{
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border-subtle);
}

.budget-hero-label{
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.budget-hero-value{
  font-size: 24px;
  font-weight: 700;
}

.budget-hero-value-row{
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.budget-hero-sub{
  font-size: 13px;
  color: var(--text-muted);
}

.budget-basis{
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.budget-model{
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(240px, 0.9fr);
  gap: 12px;
  margin-bottom: 12px;
}

.budget-input-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.budget-subhead{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 6px;
}

.budget-explain{
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.budget-example{
  font-style: italic;
}

.budget-output-grid{
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.budget-panel .btn-group{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.budget-output-card{
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.budget-output-card .metric-value{
  font-size: 18px;
  font-weight: 700;
}

.budget-output-card .metric-sub{
  font-size: 12.5px;
  color: var(--text-muted);
}

.budget-waterfall{
  margin: 12px 0;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
}

.budget-waterfall-bar{
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 16px;
  margin: 8px 0;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px;
}

.budget-waterfall-seg{
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
}

.budget-waterfall-seg.seg-in{
  background: #22c55e;
}

.budget-waterfall-seg.seg-out{
  background: #f59e0b;
}

.budget-waterfall-list{
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.budget-cogs-visual{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 10px 0;
}

.budget-cogs-bar{
  display: flex;
  align-items: stretch;
  height: 14px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.budget-cogs-seg{
  height: 100%;
  min-width: 2px;
}

.budget-cogs-legend{
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.budget-cogs-legend .legend-row{
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.budget-cogs-legend .legend-label{
  display: flex;
  align-items: center;
  gap: 6px;
}

.budget-cogs-legend .legend-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.budget-actions-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.budget-action-card{
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.budget-action-card .metric-label{
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.budget-stage{
  --budget-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --budget-sans: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
  --budget-ink: #1b1a16;
  --budget-muted: #6b6f76;
  --budget-accent: #b45309;
  --budget-accent-strong: #92400e;
  --budget-sand: #fff7ed;
  --budget-ice: #f8fafc;
  font-family: var(--budget-sans);
  color: var(--budget-ink);
  position: relative;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.92) 0%, rgba(248, 250, 252, 0.96) 65%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  animation: budget-fade 0.6s ease-out;
}

.budget-stage::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 6%, rgba(251, 191, 36, 0.18), transparent 48%),
    radial-gradient(circle at 82% 0%, rgba(14, 116, 144, 0.12), transparent 44%),
    repeating-linear-gradient(120deg, rgba(15, 23, 42, 0.04) 0 1px, transparent 1px 18px);
  opacity: 0.6;
  pointer-events: none;
}

.budget-stage > *{
  position: relative;
  z-index: 1;
}

.budget-stage .budget-hero-band{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(255, 247, 237, 0.95) 0%, rgba(254, 243, 199, 0.92) 48%, rgba(224, 242, 254, 0.92) 100%);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.budget-stage .budget-hero-card{
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  animation: budget-rise 0.7s ease-out both;
}

.budget-stage .budget-hero-card:nth-child(2){
  animation-delay: 0.08s;
}

.budget-stage .budget-hero-card:nth-child(3){
  animation-delay: 0.14s;
}

.budget-stage .budget-hero-label{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--budget-muted);
  font-weight: 600;
}

.budget-stage .budget-hero-value{
  font-family: var(--budget-serif);
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 600;
}

.budget-stage .budget-hero-sub{
  font-size: 13px;
  color: var(--budget-muted);
}

.budget-stage .budget-hero-card .chip{
  align-self: flex-start;
  margin-top: 4px;
}

.budget-stage .budget-meta-row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.budget-stage .budget-basis{
  font-size: 12.5px;
  color: var(--budget-muted);
}

.budget-stage .budget-columns{
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 0.9fr);
  gap: 16px;
}

.budget-stage .budget-column{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.budget-stage .budget-block{
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.budget-stage .budget-block-title{
  font-family: var(--budget-serif);
  font-size: 18px;
  font-weight: 600;
}

.budget-stage .budget-block-desc{
  font-size: 13.5px;
  color: var(--budget-muted);
}

.budget-stage .budget-block-note{
  font-size: 12.5px;
  color: var(--budget-muted);
  font-style: italic;
}

.budget-stage .budget-subhead{
  color: var(--budget-muted);
  margin-top: 6px;
}

.budget-stage .budget-input-row{
  padding: 6px 0;
}

.budget-stage .metric-label{
  font-size: 13px;
  color: var(--budget-muted);
}

.budget-stage .metric-value{
  font-weight: 600;
}

.budget-stage .budget-form-grid{
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.budget-stage .budget-output-grid{
  gap: 12px;
}

.budget-stage .budget-output-card{
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  padding: 12px;
  gap: 6px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.budget-stage .budget-output-card .metric-label{
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  color: var(--budget-muted);
}

.budget-stage .budget-output-card .metric-value{
  font-family: var(--budget-serif);
  font-size: 20px;
}

.budget-stage .budget-output-card .metric-sub{
  color: var(--budget-muted);
}

.budget-stage .budget-waterfall-bar{
  height: 18px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 4px;
}

.budget-stage .budget-waterfall-seg.seg-in{
  background: linear-gradient(120deg, #22c55e, #4ade80);
}

.budget-stage .budget-waterfall-seg.seg-out{
  background: linear-gradient(120deg, #f59e0b, #fbbf24);
}

.budget-stage .budget-actions-grid{
  gap: 12px;
}

.budget-stage .budget-action-card{
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(140deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.budget-stage .budget-card,
.budget-stage .budget-cogs-block{
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.budget-stage .budget-card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.budget-stage .budget-panel-title{
  font-size: 12px;
  color: var(--budget-muted);
}

.budget-stage .budget-cogs-bar{
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #f8fafc;
}

.budget-stage .budget-cogs-legend{
  color: var(--budget-muted);
}

.budget-stage .budget-row{
  margin-top: 16px;
}

@keyframes budget-fade{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

@keyframes budget-rise{
  from{ opacity: 0; transform: translateY(12px); }
  to{ opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce){
  .budget-stage,
  .budget-stage .budget-hero-card{
    animation: none;
  }
}

@media (max-width: 980px){
  .budget-stage .budget-columns{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px){
  .budget-stage{
    padding: 14px;
  }

  .budget-stage .budget-hero-band{
    padding: 12px;
  }

  .budget-stage .budget-hero-value{
    font-size: clamp(22px, 7vw, 30px);
  }
}

@media (max-width: 900px){
  .budget-model{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px){
  .budget-grid{
    grid-template-columns: 1fr;
  }
  .budget-form-grid{
    grid-template-columns: 1fr;
  }
}

.chip-budget-positive{
  background: rgba(16, 185, 129, 0.12);
  color: #0f9f6e;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.chip-budget-negative{
  background: rgba(239, 68, 68, 0.12);
  color: #d12c2c;
  border: 1px solid rgba(239, 68, 68, 0.35);
}










.summary-card.card-good{ border-color: rgba(16, 185, 129, 0.5); box-shadow: 0 6px 14px rgba(16, 185, 129, 0.18); }
.summary-card.card-warn{ border-color: rgba(251, 191, 36, 0.6); box-shadow: 0 6px 14px rgba(251, 191, 36, 0.2); }
.summary-card.card-bad{ border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 6px 14px rgba(239, 68, 68, 0.2); }





/* dashboard grid */
.dashboard-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.trust-grid{
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

@media (max-width: 1100px){
  .trust-grid{
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.health-list{
  display: grid;
  gap: 8px;
}

.health-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.health-label{
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}

.health-sub{
  font-size: 11px;
  color: var(--text-muted);
}

.health-value{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
}












.status-block{
  margin-bottom: 10px;
  display: grid;
  gap: 6px;
}

.status-title{
  font-weight: 600;
  font-size: 14px;
}

.status-bar{
  display: grid;
  gap: 8px;
}

.status-bar-track{
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.status-bar-fill{
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: #4ade80;
  transition: width 0.3s ease, background 0.2s ease;
}
.status-bar-fill.good{ background: #4ade80; }
.status-bar-fill.warn{ background: #fbbf24; }
.status-bar-fill.bad{ background: #f87171; }

.status-bar-current{
  position: absolute;
  top: -2px;
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: #111827;
  transform: translateX(-50%);
  left: 0%;
}

.status-bar-target{
  position: absolute;
  top: -22px;
  left: 30%;
  transform: translateX(-50%);
  font-size: 11px;
  background: #fff;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.status-bar-meta{
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.waste-control{
  display: grid;
  gap: 10px;
}
.waste-presets{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.waste-course-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  width: 100%;
}
.waste-course-grid label{
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}
.waste-course-grid input{
  width: 64px;
}

.waste-meta{
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.waste-note{
  font-size: 12px;
}

.waste-impact{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.impact-card{
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: #f8fafc;
}

.impact-label{
  font-size: 12px;
  color: var(--text-muted);
}

.impact-value{
  font-size: 16px;
  font-weight: 600;
}

.filter-row{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dashboard-toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dashboard-toolbar .filter-row{
  margin-bottom: 0;
}

.dashboard-quick-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-hidden{
  display: none !important;
}

.filter-label{
  font-size: 12px;
  color: var(--text-muted);
}

.filter-input{
  min-width: 120px;
  max-width: 180px;
  height: 32px;
}

#soft-form .form-row{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}














/* cards / таблицы */

.card{
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 18px 4px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.card-header.card-actions{
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.card-header.card-actions > :first-child{
  flex: 1;
  min-width: 0;
}

.card-header h3{
  margin: 0;
  font-size: 17px;
}

.card-description{
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.card-body{
  padding: 14px 18px 18px;
}

.card-collapsible.card-collapsed .card-body{
  display: none;
}

.card-collapsible.card-collapsed .card-header{
  border-bottom: none;
}

.card-header-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.table-wrapper{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper-small{
  max-height: 320px;
  overflow: auto;
}

.dashboard-grid .table-wrapper{
  box-shadow: none;
  border: 1px solid #e5e7eb;
  padding: 0;
}

/* wrap tables to avoid horizontal scroll on dashboard */
.wrap-table table{
  table-layout: auto;
  width: 100%;
  white-space: normal;
}

/* Dashboard refresh */
.filter-row{
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.snapshot-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 20px;
  margin: 12px 0 22px;
  width: 100%;
}

@media (max-width: 1100px){
  .snapshot-grid{
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}

@media (max-width: 720px){
  .snapshot-grid{
    grid-template-columns: 1fr;
  }
}
.snapshot-card .snapshot-body{
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 100px;
}
#card-shift-compact .card-body{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
}
.shift-mini-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
  align-items: start;
}
.shift-mini-line{
  font-size: 12px;
  line-height: 1.25;
  min-height: 18px;
}
.shift-mini-line.shift-mini-crit{
  color: var(--danger);
  font-weight: 600;
}
.shift-mini-line.shift-mini-ok{
  color: var(--success);
  font-weight: 600;
}
.shift-mini-box .small-note{
  font-weight: 700;
  color: var(--text-main);
}
.shift-mini-ok{
  color: var(--success);
  font-weight: 600;
}
.shift-mini-miss{
  color: var(--danger);
  font-weight: 600;
}
.shift-mini-detail{
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  min-height: 16px;
}
.shift-mini-row{
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 12px;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}
#shift-mini-today{
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shift-mini-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.snapshot-detail .chip-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}




.rev-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  align-items: flex-start;
}
.rev-inline{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.rev-inline-single{
  display: flex;
  flex-wrap: wrap;
}
.rev-actions-inline{
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  min-width: 140px;
}
.rev-form{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rev-panel{
  background: #f9fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.rev-stats-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.rev-stat{
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rev-stat .label{
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.rev-stat .value{
  font-weight: 700;
  color: var(--text-main);
}
.rev-stat .value.muted{
  color: var(--text-muted);
}

.rev-list{
  background: #f8f9fc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px;
  font-size: 14px;
  min-height: 40px;
}
.rev-item{
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.rev-item:last-child{
  border-bottom: none;
}
.rev-item:hover{
  background: rgba(47, 109, 242, 0.06);
}
.rev-item.rev-item-active{
  background: rgba(47, 109, 242, 0.12);
  font-weight: 700;
}

.rev-tracker{
  display: flex;
  flex-direction: column;
  gap: 8px;
}



.rev-tracker.alt-style{
  display: flex;
  flex-direction: column;
  gap: 10px;
}










.rev-tracker.alt-style2{
  display: flex;
  flex-direction: column;
  gap: 8px;
}







.rev-tracker.alt-style3{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rev-tracker.rev-compact{
  gap: 8px;
}


.rev-mini .big-number{
  font-size: 22px;
}

/* Toasts */
#toast-container{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast{
  background: #1f2937;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  opacity: 0.95;
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toast-hide{
  opacity: 0;
  transform: translateY(10px);
}
.toast-link{
  background: #2f6df2;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}
.toast-link:hover{
  background: #285bcc;
}







.ops-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}
.ops-block{
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #f9fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.ops-template-head{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ops-template-actions{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ops-workdays{
  font-size: 13px;
  color: var(--text-muted);
}

.ops-week-grid{
  display: grid;
  gap: 8px;
}

.ops-week-row{
  display: grid;
  grid-template-columns: 60px 90px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.ops-week-day{
  font-weight: 600;
  color: var(--text-main);
}

.ops-week-toggle{
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ops-week-time{
  display: flex;
  align-items: center;
  gap: 6px;
}

.ops-week-time .form-input{
  max-width: 120px;
}

@media (max-width: 720px){
  .ops-week-row{
    grid-template-columns: 1fr;
  }
}






.ops-day-item{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #f8fafc;
}
.ops-day-item .chip{
  margin-left: 6px;
}

@media (max-width: 900px){
  .rev-grid{
    grid-template-columns: 1fr;
  }
}






.snapshot-card h3{
  font-size: 14px;
  font-weight: 700;
}
.snapshot-card .big-number{
  font-size: 30px;
  font-weight: 800;
}
.snapshot-card .small-note{
  font-size: 12px;
  color: var(--text-muted);
}
.snapshot-card .big-number{
  font-size: 32px;
  font-weight: 700;
}
.stacked-bars{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.stacked-bar{
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stacked-label{
  font-weight: 600;
  color: #0f172a;
}
.stacked-track{
  position: relative;
  background: #e2e8f0;
  border-radius: 8px;
  height: 14px;
  overflow: hidden;
}
.stacked-target, .stacked-current{
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 999px;
  border: 2px solid #0f172a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stacked-target{
  border-color: #2563eb;
}
.stacked-current{
  border-color: #22c55e;
}
.stacked-current.is-negative{
  border-color: #ef4444;
}
.stacked-track-mix{
  height: 18px;
  display: flex;
}
.mix-segment{
  height: 18px;
}




.rev-track{
  position: relative;
  min-height: 18px;
}
.rev-target-today{
  position: absolute;
  top: 2px;
  width: 2px;
  height: 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
  z-index: 2;
}
.rev-today{
  border-color: var(--accent);
  background: #fff;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  box-shadow: 0 2px 6px rgba(47, 109, 242, 0.25);
}
.rev-week-dots{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.rev-week-dot{
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.rev-target{
  border-color: #0f172a;
  width: 12px;
  height: 12px;
  margin-top: -6px;
}
.rev-track .kpi-warn{
  background: linear-gradient(90deg, #f7b500 0%, #f59e0b 100%);
}
.rev-track-row{
  display: grid;
  grid-template-columns: 90px 1fr 210px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.card-actions{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.rev-label{
  font-weight: 600;
  color: #0f172a;
}
.rev-meta{
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}
.rev-last{
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}



.mix-legend .dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.waste-deltas{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.table-actions{
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.table-actions .btn{
  min-height: 32px;
}
.badge-row{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pnl-meta{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.pnl-driver-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.pnl-driver-card{
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pnl-driver-title{
  font-weight: 600;
  color: var(--text-main);
}
.pnl-driver-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.pnl-driver-actions{
  margin-top: 2px;
}
.stacked-fill{
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
  width: 0%;
}
.stacked-fill.good{
  background: #22c55e;
}
.stacked-fill.warn{
  background: #f59e0b;
}
.stacked-fill.bad{
  background: #ef4444;
}
.stacked-fill.is-negative{
  background: #ef4444;
  opacity: 0.7;
}
.stacked-fill[data-over="true"]{
  box-shadow: inset -6px 0 0 rgba(34, 197, 94, 0.6);
}
.stacked-target{
  position: absolute;
  top: -6px;
  width: 2px;
  bottom: -6px;
  background: #f59e0b;
}
.stacked-meta{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.stacked-gap{
  font-size: 12px;
  color: #6b7280;
}
.hero-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2px;
}
.hero-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hero-item{
  border: 1px solid #e5e7eb;
  border-left: 3px solid #cbd5e1;
  border-radius: 5px;
  padding: 3px 6px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  box-shadow: none;
}
.hero-meta{
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.hero-name{
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.2;
}
.hero-item .cell-muted{
  font-size: 11px;
}
.hero-item .chip{
  font-size: 11px;
  padding: 2px 6px;
}
.hero-item.hero-good{
  border-left-color: #22c55e;
  background: #f6fff9;
}
.hero-item.hero-bad{
  border-left-color: #ef4444;
  background: #fff6f7;
}
.hero-item .cell-muted{
  font-size: 11px;
}
.hero-item .chip{
  font-size: 11px;
  padding: 2px 6px;
}

.data-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.data-table thead{
  background: #f3f4f6;
}

.data-table th, .data-table td{
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  white-space: normal;
  word-break: break-word;
  vertical-align: middle;
}

.data-table.wine-table th, .data-table.wine-table td{
  white-space: normal;
}
.data-table th{
  font-weight: 600;
  font-size: 12px;
  color: #4b5563;
}

.data-table tbody tr:nth-child(even){
  background: #f9fafb;
}

.data-table tbody tr:hover{
  background: #eef2ff;
}

.wrap-table{
  width: 100%;
  overflow-x: auto;
}

.wrap-table .data-table th, .wrap-table .data-table td{
  white-space: nowrap;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table.wine-table{
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

#wine-table th, #wine-table td{
  white-space: normal;
  word-break: break-word;
  text-overflow: clip;
  padding: 6px 6px;
  font-size: 12px;
  vertical-align: middle;
  overflow: visible;
}

#wine-table{
  table-layout: fixed;
  width: 100%;
  min-width: 900px;
}

#wine-table th:nth-child(1), #wine-table td:nth-child(1){
  width: 30%;
}
#wine-table th:nth-child(2), #wine-table td:nth-child(2){
  width: 8%;
}
#wine-table th:nth-child(3), #wine-table td:nth-child(3){
  width: 10%;
  text-align: right;
}
#wine-table th:nth-child(4), #wine-table td:nth-child(4){
  width: 10%;
  text-align: right;
}
#wine-table th:nth-child(5), #wine-table td:nth-child(5){
  width: 10%;
  text-align: right;
}
#wine-table th:nth-child(6), #wine-table td:nth-child(6){
  width: 8%;
  text-align: right;
}
#wine-table th:nth-child(7), #wine-table td:nth-child(7){
  width: 8%;
  text-align: right;
}
#wine-table th:nth-child(8), #wine-table td:nth-child(8){
  width: 6%;
  text-align: center;
}
#wine-table th:nth-child(9), #wine-table td:nth-child(9){
  width: 10%;
  text-align: center;
}

#wine-table td:nth-child(3),
#wine-table td:nth-child(4),
#wine-table td:nth-child(5),
#wine-table td:nth-child(6),
#wine-table td:nth-child(7),
#wine-table td:nth-child(8),
#wine-table td:nth-child(9){
  white-space: nowrap;
}

.data-table.cocktail-table{
  table-layout: fixed;
  width: 100%;
  min-width: 860px;
}

#cocktail-table th:nth-child(1), #cocktail-table td:nth-child(1){
  width: 30%;
}
#cocktail-table th:nth-child(2), #cocktail-table td:nth-child(2){
  width: 10%;
}
#cocktail-table th:nth-child(3), #cocktail-table td:nth-child(3){
  width: 10%;
  text-align: right;
}
#cocktail-table th:nth-child(4), #cocktail-table td:nth-child(4){
  width: 10%;
  text-align: right;
}
#cocktail-table th:nth-child(5), #cocktail-table td:nth-child(5){
  width: 10%;
  text-align: right;
}
#cocktail-table th:nth-child(6), #cocktail-table td:nth-child(6){
  width: 10%;
  text-align: right;
}
#cocktail-table th:nth-child(7), #cocktail-table td:nth-child(7){
  width: 10%;
  text-align: center;
}
#cocktail-table th:nth-child(8), #cocktail-table td:nth-child(8){
  width: 10%;
  text-align: center;
}

.data-table.soft-table{
  table-layout: fixed;
  width: 100%;
  min-width: 900px;
}

#soft-table th, #soft-table td{
  vertical-align: middle;
}

#soft-table th:nth-child(1), #soft-table td:nth-child(1){
  width: 22%;
}
#soft-table th:nth-child(2), #soft-table td:nth-child(2){
  width: 8%;
}
#soft-table th:nth-child(3), #soft-table td:nth-child(3){
  width: 10%;
}
#soft-table th:nth-child(4), #soft-table td:nth-child(4){
  width: 14%;
}
#soft-table th:nth-child(5), #soft-table td:nth-child(5){
  width: 8%;
}
#soft-table th:nth-child(6), #soft-table td:nth-child(6){
  width: 8%;
}
#soft-table th:nth-child(7), #soft-table td:nth-child(7){
  width: 8%;
}
#soft-table th:nth-child(8), #soft-table td:nth-child(8){
  width: 8%;
}
#soft-table th:nth-child(9), #soft-table td:nth-child(9){
  width: 7%;
  text-align: center;
}
#soft-table th:nth-child(10), #soft-table td:nth-child(10){
  width: 7%;
  text-align: center;
}

.cell-numeric{
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-inactive{
  opacity: 0.55;
}







.cell-muted{
  text-align: center;
  color: var(--text-muted);
}

.chip{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}

.chip-okay{
  background: var(--success-soft);
  color: var(--success);
}

.chip-below{
  background: var(--danger-soft);
  color: var(--danger);
}

.chip-neutral{
  background: #e5e7eb;
  color: #4b5563;
}

.chip-warn{
  background: #fef3c7;
  color: #b45309;
}

.chip-good{
  background: var(--success-soft);
  color: var(--success);
}

.chip-bad{
  background: var(--danger-soft);
  color: var(--danger);
}

.text-warn{
  color: #b24b4b;
}

.input-warn{
  border-color: #d28a8a;
  background: #fff6f6;
}

.input-warn:focus{
  border-color: #c56a6a;
  box-shadow: 0 0 0 1px rgba(197, 106, 106, 0.25);
}



.insights-grid{
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  color: #111827;
}

.insight{
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  position: relative;
  overflow: hidden;
}

.insight::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #6366f1, #22c55e);
}







.insights-section{
  margin-bottom: 12px;
}

.insights-title{
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: #111827;
}

.forecast-metrics{
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.forecast-label{
  font-weight: 600;
  margin-right: 6px;
}

.bar-chart{
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.bar{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.bar-fill{
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
}

.bar-fill.bar-good{
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.bar-fill.bar-warn{
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.bar-fill.bar-bad{
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.bar-fill.bar-neutral{
  background: linear-gradient(90deg, #cbd5e1, #e2e8f0);
}

.bar-label{
  font-size: 12px;
  color: var(--text-muted);
}


.small-note{
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}


.table-input{
  width: 100%;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 12px;
}

.table-input-small{
  max-width: 64px;
}

.table-input:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* кнопки */

.btn{
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn-sm{
  padding: 4px 10px;
}

.btn-primary{
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover{
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-ghost{
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

.btn-ghost:hover{
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-ghost.btn-blue{
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn:disabled{
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-group-vertical{
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.btn-group-vertical .btn{
  width: 100%;
}

/* Staff summary */
.summary-block{
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 10px;
}
.summary-block.compact{
  padding: 10px 12px;
}
.summary-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.summary-title{
  font-weight: 600;
  font-size: 15px;
}
.summary-sub{
  color: var(--text-muted);
  font-size: 12px;
}
.summary-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.summary-stat{
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-stat span{
  color: var(--text-muted);
  font-size: 12px;
}
.summary-stat strong{
  font-size: 15px;
}
.bar-row{
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.bar-track{
  width: 100%;
  height: 8px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill{
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6fa7ff);
  border-radius: 999px;
}
.bar-label{
  color: var(--text-muted);
  font-size: 12px;
}
.bar-value{
  font-weight: 600;
  font-size: 12px;
}
.summary-table{
  margin-top: 8px;
}
.summary-table .mini-table{
  width: 100%;
  border-collapse: collapse;
}
.summary-table th, .summary-table td{
  padding: 6px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

/* layout */

.shopping-total{
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
}

.shopping-print-tables{
  display: none;
}

/* Print-friendly shopping list (only when body has .print-shopping) */
@media print{
  body{
    background: #fff;
    color: #111;
    font-size: 11px;
    line-height: 1.2;
  }
  /* apply only when body has print-shopping */
  body.print-shopping .app-header, body.print-shopping .app-nav, body.print-shopping .nav-tab, body.print-shopping .btn, body.print-shopping .section-header, body.print-shopping .card-header button, body.print-shopping #shopping-generate-btn{
    display: none !important;
  }
  body.print-shopping .view{ display: none !important; }
  body.print-shopping #section-shopping{
    display: block !important;
    padding: 0;
  }
  body.print-shopping #section-shopping .shopping-left, body.print-shopping #section-shopping #shopping-drinks-card{
    display: none !important;
  }
  body.print-shopping #shopping-result-table{
    display: none !important;
  }
  body.print-shopping .shopping-print-tables{
    display: block !important;
  }
  body.print-shopping .print-supplier-block{
    page-break-inside: avoid;
    margin-bottom: 8px;
  }
  body.print-shopping .print-supplier-title{
    font-weight: 600;
    margin: 4px 0 6px;
  }
  .app-main{
    padding: 0;
  }
  .card{
    box-shadow: none;
    border: 0;
    padding: 0;
    margin: 0 0 6px 0;
  }
  .table-wrapper{
    box-shadow: none;
    border: 0;
    padding: 0;
  }
  table.data-table{
    page-break-inside: avoid;
    border-collapse: collapse;
    table-layout: fixed;
  }
  @page{
    margin: 10mm;
  }
  .shopping-header-print{
    display: flex;
    margin: 0 0 6px 0;
    font-size: 12px;
  }
  .data-table th, .data-table td{
    border: 0.25pt solid #d1d5db;
    padding: 3px 4px;
    background: #fff;
    word-break: break-word;
  }
  /* Optimize shopping columns for print */
  #section-shopping #shopping-result-table th:nth-child(1), #section-shopping #shopping-result-table td:nth-child(1){ width: 16%; }
  #section-shopping #shopping-result-table th:nth-child(2), #section-shopping #shopping-result-table td:nth-child(2){ width: 18%; }
  #section-shopping #shopping-result-table th:nth-child(3), #section-shopping #shopping-result-table td:nth-child(3){ width: 16%; }
  #section-shopping #shopping-result-table th:nth-child(4), #section-shopping #shopping-result-table td:nth-child(4){ width: 8%; text-align: right; }
  #section-shopping #shopping-result-table th:nth-child(5), #section-shopping #shopping-result-table td:nth-child(5){ width: 6%; text-align: right; }
  #section-shopping #shopping-result-table th:nth-child(6), #section-shopping #shopping-result-table td:nth-child(6){ width: 6%; text-align: right; }
  #section-shopping #shopping-result-table th:nth-child(7), #section-shopping #shopping-result-table td:nth-child(7){ width: 10%; text-align: right; }
  #section-shopping #shopping-result-table th:nth-child(8), #section-shopping #shopping-result-table td:nth-child(8){ width: 10%; text-align: right; white-space: nowrap; }
  #section-shopping #shopping-result-table th:nth-child(9), #section-shopping #shopping-result-table td:nth-child(9){ width: 10%; text-align: right; white-space: nowrap; }
  #section-shopping #shopping-result-table th:nth-child(8), #section-shopping #shopping-result-table td:nth-child(8){ white-space: nowrap; }
  #section-shopping .print-supplier-table th:nth-child(1), #section-shopping .print-supplier-table td:nth-child(1){ width: 24%; }
  #section-shopping .print-supplier-table th:nth-child(2), #section-shopping .print-supplier-table td:nth-child(2){ width: 20%; }
  #section-shopping .print-supplier-table th:nth-child(3), #section-shopping .print-supplier-table td:nth-child(3){ width: 7%; text-align: right; }
  #section-shopping .print-supplier-table th:nth-child(4), #section-shopping .print-supplier-table td:nth-child(4){ width: 6%; }
  #section-shopping .print-supplier-table th:nth-child(5), #section-shopping .print-supplier-table td:nth-child(5){ width: 6%; text-align: right; }
  #section-shopping .print-supplier-table th:nth-child(6), #section-shopping .print-supplier-table td:nth-child(6){ width: 10%; text-align: right; }
  #section-shopping .print-supplier-table th:nth-child(7), #section-shopping .print-supplier-table td:nth-child(7){ width: 12%; text-align: right; white-space: nowrap; }
  #section-shopping .print-supplier-table th:nth-child(8), #section-shopping .print-supplier-table td:nth-child(8){ width: 15%; text-align: right; white-space: nowrap; }
  .group-row td, .group-subrow td{
    font-weight: 600;
    background: transparent !important;
  }
  .shopping-total{
    font-size: 11px;
    text-align: right;
    margin-top: 4px;
  }
}

/* Print-friendly staff */
@media print{
  body.print-staff .app-header, body.print-staff .app-nav, body.print-staff .nav-tab, body.print-staff .section-header, body.print-staff .subnav, body.print-staff button{
    display: none !important;
  }
  body.print-staff .view{ display: none !important; }
  body.print-staff #section-staff{
    display: block !important;
    padding: 0;
  }
  body.print-staff .card{
    box-shadow: none;
    border: 1px solid #d1d5db;
    margin-bottom: 10px;
    page-break-inside: avoid;
  }
  body.print-staff-summary .card:not(.staff-print-summary), body.print-staff-log .card:not(.staff-print-log){
    display: none !important;
  }
}

/* Staff inline form */
.staff-inline{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.staff-inline .form-field{
  min-width: 180px;
}
.staff-inline-actions{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
}

/* Allergen matrix tweaks */


/* Staff layout tuning */
#section-staff .card{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
#section-staff .section-header{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
}

/* Allergens layout tuning */
#section-allergens .card, #section-allergens .section-header, #section-shopping .card, #section-shopping .section-header, #section-analytics .card, #section-analytics .section-header{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Shifts layout and calendar */
#section-shifts .card, #section-shifts .section-header{
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.shift-calendar{
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  overflow-x: auto;
  box-shadow: 0 6px 16px rgba(0,0,0,0.05);
}
.shift-grid{
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}
.shift-grid-head{
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}
.shift-cell{
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  min-height: 140px;
  background: #f8fafc;
  cursor: pointer;
}
.shift-cell.selected{
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(47, 109, 242, 0.15);
}
.shift-cell.today{
  outline: 2px dashed var(--accent);
}
.shift-cell.off{
  background: #f3f4f6;
  opacity: 0.6;
  filter: grayscale(0.3);
}
.shift-cell.ops-closed{
  background: #f5f5f4;
  border-color: #e7e5e4;
}
.shift-cell.ops-closed .shift-date{
  color: var(--text-muted);
}
.shift-cell.full{
  background: #e8f6ec;
  border-color: #b6e1c4;
}
.shift-cell.past{
  opacity: 0.55;
  filter: grayscale(0.2);
}
.shift-cell.empty{
  background: transparent;
  border: 0;
  cursor: default;
}
.shift-cell:hover{
  box-shadow: 0 8px 18px rgba(0,0,0,0.05);
}
.shift-cell-top{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.shift-top-right{
  display: flex;
  align-items: center;
  gap: 6px;
}
.dayoff-toggle{
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dayoff-toggle input{
  width: 14px;
  height: 14px;
}
.dayoff-bottom{
  margin-top: 8px;
  text-align: right;
}
.shift-date{
  font-weight: 700;
  color: var(--text-main);
}
.shift-chips{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-height: 70px;
  max-height: 140px;
  overflow-y: auto;
}
.shift-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.shift-row:last-child{ border-bottom: 0; }
.shift-actions{
  display: flex;
  gap: 4px;
}
.shift-detail-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

@media print{
  body.print-shifts .app-header, body.print-shifts .app-nav, body.print-shifts .nav-tab, body.print-shifts .section-header, body.print-shifts .subnav, body.print-shifts button{
    display: none !important;
  }
  body.print-shifts .view{ display: none !important; }
  body.print-shifts #section-shifts{ display: block !important; padding: 0; }
  body.print-shifts .card{
    box-shadow: none;
    border: 1px solid #d1d5db;
    margin-bottom: 10px;
  }
}









/* Allergen tables can scroll horizontally on small screens */


/* формы */

.grid-form{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
  margin-bottom: 10px;
}

.grid-form .form-section{
  grid-column: 1 / -1;
}

.form-section{
  padding: 8px 0 10px;
  border-top: 1px dashed #e5e7eb;
}

.form-section:first-of-type{
  border-top: 0;
  padding-top: 0;
}

.form-section-title{
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}



.form-section-body{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
}

.form-section-body-full{
  display: block;
}

.form-field label{
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-muted);
  gap: 4px;
}

.form-field-full{
  grid-column: 1 / -1;
}



.form-input{
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

.form-select{
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  background: #fff;
}

.form-select-sm{
  height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 12px;
  background: #fff;
}

.form-input:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.form-input.input-warn:focus{
  border-color: #c56a6a;
  box-shadow: 0 0 0 1px rgba(197, 106, 106, 0.25);
}

.form-select:focus, .form-select-sm:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.recipe-notes-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

.recipe-notes-grid label{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.recipe-note-input{
  min-height: 72px;
  resize: vertical;
}

.recipe-photo-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.recipe-photo-preview{
  display: block;
  margin-top: 2px;
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  object-fit: cover;
}

@media (max-width: 900px){
  .recipe-notes-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px){
  .recipe-notes-grid{
    grid-template-columns: 1fr;
  }
}

.form-actions{
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions-split{
  justify-content: flex-end;
  flex-wrap: wrap;
}

.form-actions-split .form-status{
  margin-right: auto;
  min-height: 16px;
}

.form-actions-bar{
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.form-status{
  font-size: 12px;
  color: var(--text-muted);
}

.form-note{
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.form-note-full{
  grid-column: 1 / -1;
}

.checkbox-field{
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.checkbox-field input{
  accent-color: var(--accent);
}

.inline-toggle{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.inline-toggle input{
  accent-color: var(--accent);
}

.form-field.align-end{
  align-self: end;
}

.recipe-components-block{
  margin-top: 8px;
}

.recipe-components-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.recipe-components-header h4{
  margin: 0;
  font-size: 14px;
}

/* view switching */

.view{
  display: none;
}

.view-active{
  display: block;
}

/* modal */

.hidden{
  display: none !important;
}

.auth-overlay{
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(248, 249, 251, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card{
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(18, 28, 45, 0.12);
  padding: 24px;
  border: 1px solid rgba(17, 24, 39, 0.08);
}

.auth-form{
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-error{
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  font-size: 13px;
}

.auth-invite-info{
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.auth-controls{
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab.hidden{
  display: none;
}

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-content{
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  width: min(720px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
}

.modal-header{
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body{
  padding: 12px 18px 18px;
  overflow: auto;
}

.modal-close{
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-subtitle{
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.modal-table-wrapper{
  max-height: 60vh;
  overflow: auto;
}

.breakdown-top-line{
  background: #fef2f2;
}

.breakdown-group-row td{
  background: #f8fafc;
  font-weight: 600;
}

/* shopping header */

.shopping-header-print{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.shopping-header-print-title{
  font-weight: 600;
  color: var(--text-main);
}

.shopping-header-print-date{
  font-variant-numeric: tabular-nums;
}

/* группировка в shopping list */

.group-row td{
  background: #e5e7eb;
  font-weight: 600;
}

.group-subrow td{
  background: #f3f4f6;
  font-weight: 500;
  font-size: 12px;
}

/* responsive */

@media (max-width: 900px){
  

  
}

@media (max-width: 640px){
  .app-shell{
    margin-top: 12px;
  }

  .app-header-main{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .app-nav{
    flex-wrap: wrap;
  }

  
}

/* print-friendly for shopping list */

@media print{
  @page{
    size: A4 portrait;
    margin: 8mm;
  }

  body{
    background: #ffffff;
  }

  .app-header, .app-nav, .shopping-left, .btn, .global-error{
    display: none !important;
  }

  .app-shell{
    max-width: none;
    margin: 0;
    padding: 0 4mm;
  }

  #section-shopping{
    display: block !important;
  }
  #section-allergens{
    display: block !important;
  }

  .card{
    box-shadow: none;
    border-radius: 0;
    border: none;
    margin: 0;
  }

  .shopping-right{
    margin-top: 0;
  }

  .data-table{
    font-size: 11px;
    table-layout: auto;
    width: 100%;
  }

  .data-table thead{
    display: table-header-group;
  }

  .data-table th, .data-table td{
    padding: 3px 4px;
    border-bottom: 1px solid #000000;
    white-space: normal;
    line-height: 1.25;
  }

  #section-shopping #shopping-result-table th:nth-child(1), #section-shopping #shopping-result-table td:nth-child(1){
    width: 18%;
  }

  #section-shopping #shopping-result-table th:nth-child(2), #section-shopping #shopping-result-table td:nth-child(2){
    width: 18%;
  }

  #section-shopping #shopping-result-table th:nth-child(3), #section-shopping #shopping-result-table td:nth-child(3){
    width: 12%;
  }

  #section-shopping #shopping-result-table th:nth-child(4), #section-shopping #shopping-result-table td:nth-child(4){
    width: 10%;
  }

  #section-shopping #shopping-result-table th:nth-child(5), #section-shopping #shopping-result-table td:nth-child(5){
    width: 8%;
  }

  #section-shopping #shopping-result-table th:nth-child(6), #section-shopping #shopping-result-table td:nth-child(6){
    width: 8%;
  }

  #section-shopping #shopping-result-table th:nth-child(7), #section-shopping #shopping-result-table td:nth-child(7){
    width: 12%;
  }

  #section-shopping #shopping-result-table th:nth-child(8), #section-shopping #shopping-result-table td:nth-child(8){
    width: 7%;
  }

  #section-shopping #shopping-result-table th:nth-child(9), #section-shopping #shopping-result-table td:nth-child(9){
    width: 7%;
  }

  .shopping-total{
    margin-top: 6px;
    font-size: 12px;
    text-align: right;
  }

  .shopping-header-print{
    font-size: 11px;
    margin-bottom: 4px;
  }

  .group-row td, .group-subrow td{
    background: #ffffff;
  }

  .shopping-right .card-body{
    padding: 0;
  }

  .table-wrapper{
    box-shadow: none;
    border: 1px solid #000000;
    margin: 0;
  }
  /* Only print the allergen list on Allergens tab */
  #section-allergens .card:not(:first-of-type){
    display: none !important;
  }
#section-allergens .data-table th:nth-child(1), #section-allergens .data-table td:nth-child(1){ width: 34%; }
#section-allergens .data-table th:nth-child(2), #section-allergens .data-table td:nth-child(2){ width: 16%; }
#section-allergens .data-table th:nth-child(3), #section-allergens .data-table td:nth-child(3){ width: 20%; }
#section-allergens .data-table th:nth-child(4), #section-allergens .data-table td:nth-child(4){ width: 30%; }
}
.targets-label{
  font-size: 12px;
  color: var(--text-muted);
}

.targets-row{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.targets-input{
  width: 100%;
}
#new-dish-form{
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: 10px 12px 8px;
  background: #f8fafc;
  margin-bottom: 0;
}

#dish-form-card .card-body{
  padding-bottom: 12px;
}

#new-dish-form .form-row{
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(200px, 1.2fr) minmax(180px, 1fr) minmax(140px, 0.9fr) minmax(150px, 1fr);
  gap: 12px;
  grid-column: 1 / -1;
  align-items: start;
}

#new-dish-form .form-field{
  min-width: 0;
}

#new-dish-form .form-input{
  width: 100%;
}

#new-dish-form #new-dish-recipe{
  min-height: 120px;
}

#new-dish-form .form-field .small-note{
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

#new-dish-form .form-actions{
  margin-top: 4px;
  justify-content: space-between;
  align-items: flex-start;
}

#new-dish-form #new-dish-status{
  margin: 0;
}

#new-dish-form .dish-form-actions-left{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#new-dish-form .dish-form-actions-right{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

@media (max-width: 1100px){
  #new-dish-form .form-row{
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 720px){
  #new-dish-form .form-row{
    grid-template-columns: 1fr;
  }
}

#new-dish-form label{
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
}

#new-dish-warning{
  min-height: 18px;
}

.allergen-list{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  background: #f9fafb;
}

.allergen-list.compact{
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  max-height: 180px;
  padding: 8px;
}

.allergen-pill{
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid #e5e7eb;
}

/* override print rules to output only the allergen list */
@media print{
  .view{ display: none !important; }
  #section-shopping{ display: none !important; }
  /* show allergens section and shell */
  .app-main, .app-shell, #section-allergens{ display: block !important; }
  #section-allergens .card, #section-allergens .card-header, #section-allergens .card-body, #section-allergens .table-wrapper{
    display: block !important;
  }
  /* ensure headings are visible */
  #section-allergens h2, #section-allergens h3, #section-allergens p{ display: block !important; color: #111 !important; }
  #section-allergens .card{ page-break-inside: avoid; }
  #section-allergens .table-wrapper{ overflow-x: auto; }
  /* force table to render even if earlier rules hide things */
  #section-allergens table.data-table{ display: table !important; }
  #section-allergens table.data-table thead{ display: table-header-group !important; }
  #section-allergens table.data-table tbody{ display: table-row-group !important; }
  #section-allergens .data-table th:nth-child(1), #section-allergens .data-table td:nth-child(1){ width: 34%; }
  #section-allergens .data-table th:nth-child(2), #section-allergens .data-table td:nth-child(2){ width: 16%; }
  #section-allergens .data-table th:nth-child(3), #section-allergens .data-table td:nth-child(3){ width: 20%; }
  #section-allergens .data-table th:nth-child(4), #section-allergens .data-table td:nth-child(4){ width: 30%; }
}

/* FINAL print safeguard: show only Allergens content */
@media print{
  /* reset any earlier hide rules for views */
  .view{ display: block !important; }
  /* then hide all except allergens */
  .view{ display: none !important; }
  /* hide all app sections by default */
  /* show shell + allergens section */
  .app-main, .app-shell, #section-allergens{ display: block !important; }
  #section-allergens .card, #section-allergens .card-header, #section-allergens .card-body, #section-allergens .table-wrapper{
    display: block !important;
    position: static !important;
  }
  #section-allergens .table-wrapper{
    overflow-x: auto !important;
  }
  #section-allergens table.data-table{
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }
  #section-allergens table.data-table thead{ display: table-header-group !important; }
  #section-allergens table.data-table tbody{ display: table-row-group !important; }
  #section-allergens table.data-table tr{ display: table-row !important; }
  #section-allergens table.data-table th, #section-allergens table.data-table td{ display: table-cell !important; }
  #section-allergens, #section-allergens *{
    visibility: visible !important;
    color: #111 !important;
  }
  #section-allergens .card{ page-break-inside: avoid; }
}
.dashboard-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 14px;
  align-items: start;
}

.dashboard-grid.trust-grid{
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

@media (max-width: 1100px){
  .dashboard-grid.trust-grid{
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}





/* Menu print layout */
.menu-print-layout{
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.menu-print-left{
  width: 100%;
  min-width: 0;
}

.menu-print-form-card{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}

.menu-print-form-card h3{
  margin: 0 0 6px;
  font-size: 17px;
}

.menu-print-form-card label{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.menu-print-form-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 16px;
}

.menu-print-form-card .checkbox-group{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-print-image-block{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-print-image-preview{
  display: none;
  width: 100%;
  max-width: 260px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.menu-print-image-preview.is-visible{
  display: block;
}

.menu-print-locus-preview{
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre;
  resize: vertical;
}

.menu-print-locus-status{
  font-size: 12px;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.menu-print-locus-status.is-ok{
  color: var(--success);
}

.menu-print-locus-status.is-warn{
  color: var(--danger);
}

.menu-print-select-cell{
  width: 36px;
}

#menu-print-selected-count{
  font-size: 12px;
  margin-top: 18px;
}

#section-menu-print .cell-muted{
  text-align: left;
}

#menu-print-source-hint{
  font-size: 11px;
}



/* layout is already column-first; keep toolbar wrapping on small screens */
