:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111d;
  color: #f4f7fb;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #07111d;
}

button,
select {
  font: inherit;
}

.app {
  width: min(100vw, 820px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 10px 28px;
  background: #091522;
}

.topbar {
  display: grid;
  grid-template-columns: 42px 44px 1fr 48px;
  gap: 12px;
  align-items: center;
  min-height: 78px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffd08d;
  color: #fff;
  font-weight: 800;
}

.pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 235px;
  padding: 17px 24px;
  border-radius: 18px;
  background: #142131;
  font-size: 26px;
}

.logo-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(#56a8ff, #39d98a, #ffd35a, #6a74ff, #56a8ff);
  box-shadow: inset 0 0 0 4px #7bd8ff;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 10px 16px 22px;
  padding: 8px;
  border: 1px solid #2a3a50;
  border-radius: 16px;
  background: #131f2e;
}

.tab {
  min-height: 82px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #93a2b8;
  font-size: 26px;
  font-weight: 800;
}

.tab.active {
  background: #223c5d;
  color: #66afff;
}

.hero {
  position: relative;
  padding: 0 16px 8px;
}

.eyebrow,
.selector span,
.summary-label,
.summary-meta,
.panel-head span {
  color: #93a2b8;
  font-size: 22px;
  font-weight: 700;
}

h1 {
  margin: 12px 0 0;
  font-size: 52px;
  line-height: 1;
}

.status {
  position: absolute;
  right: 28px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #5aa7ff;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
}

.selector {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 12px;
  align-items: center;
  margin: 16px;
  padding: 12px 14px;
  border: 1px solid #2b3c53;
  border-radius: 16px;
  background: #162438;
}

select {
  width: 100%;
  min-height: 72px;
  padding: 0 50px 0 22px;
  border: 1px solid #31445d;
  border-radius: 14px;
  appearance: none;
  background-color: #1b2b40;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='12' viewBox='0 0 18 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 2.25L9 9.75L16.5 2.25' fill='none' stroke='%2370B3FF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: calc(100% - 24px) 50%;
  background-size: 18px 12px;
  background-repeat: no-repeat;
  color: #f4f7fb;
  font-size: 25px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary {
  text-align: center;
  padding: 44px 16px 28px;
}

.summary-value {
  margin-top: 10px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 62px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.summary-meta {
  margin-top: 14px;
}

.summary-breakdown {
  width: min(520px, 100%);
  margin: 22px auto 0;
  display: grid;
  gap: 10px;
}

.summary-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #263a52;
  border-radius: 14px;
  background: rgba(13, 27, 41, 0.7);
  color: #9fb0c6;
  font-size: 18px;
  font-weight: 800;
}

.summary-breakdown-row strong {
  color: #f4f7fb;
  font-size: 20px;
  white-space: nowrap;
}

.stock-period-card {
  margin: 12px 16px 24px;
  padding: 18px;
  border: 1px solid #2b3c53;
  border-radius: 16px;
  background: #162438;
}

.stock-period-card .mini-period-controls {
  margin-top: 0;
}

.stock-period-card .mini-range {
  margin-bottom: 0;
}

.periods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 16px 24px;
}

.period {
  min-height: 132px;
  border: 1px solid #24364a;
  border-radius: 14px;
  background: #0d1b29;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
}

.period span {
  display: block;
  margin-top: 10px;
  color: #93a2b8;
  font-size: 22px;
}

.period.active {
  border-color: #4c8eda;
  background: #1c3654;
}

.panel {
  margin: 16px;
  padding: 18px;
  border: 1px solid #2b3f59;
  border-radius: 16px;
  background: #17263a;
}

.analytics-card {
  position: relative;
  margin: 16px;
  padding: 24px;
  border: 1px solid #2b3f59;
  border-radius: 16px;
  background: #17263a;
}

.analytics-kicker,
.period-caption {
  color: #93a2b8;
  font-size: 22px;
  font-weight: 700;
}

h2 {
  margin: 10px 0 24px;
  color: #f4f7fb;
  font-size: 40px;
  line-height: 1.15;
}

.section-title-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 24px;
}

.section-title-row h2 {
  margin: 0;
}

.compare-card #applyPeriods {
  display: block;
  width: min(100%, 320px);
  margin: 0 auto 22px;
}

.metrics-table {
  overflow: hidden;
  border: 1px solid #2b3f59;
  border-radius: 14px;
}

#inventoryTable,
#consumptionTable {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.metric-row {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr 1fr 1.05fr;
  gap: 10px;
  align-items: center;
  min-height: 84px;
  padding: 12px 16px;
  border-bottom: 1px solid #26374c;
}

.metric-row:last-child {
  border-bottom: 0;
}

.summary-metric-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(116px, 0.8fr);
  gap: 0;
  padding: 0;
}

.summary-metric-row > * {
  display: grid;
  align-items: center;
  min-height: inherit;
  min-width: 0;
  padding: 12px 16px;
}

.summary-metric-row > * + * {
  border-left: 1px solid #26374c;
}

.summary-metric-row .metric-value,
.summary-metric-row .metric-change {
  justify-items: center;
  text-align: center;
}

.summary-metric-row .metric-name {
  justify-items: start;
}

.summary-metric-row .badge {
  justify-self: center;
}

.metric-head {
  min-height: 68px;
  color: #93a2b8;
  font-weight: 800;
}

.metric-name {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
}

.metric-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: normal;
  word-break: keep-all;
}

.badge {
  display: inline-grid;
  gap: 2px;
  align-content: center;
  justify-self: end;
  min-width: 128px;
  min-height: 78px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: center;
  font-size: 20px;
  line-height: 1.05;
  font-weight: 900;
  white-space: nowrap;
}

.badge span {
  display: block;
}

.badge.up {
  background: #164942;
  color: #34e39a;
}

.badge.down {
  background: #4a263c;
  color: #ff6682;
}

.branch-item {
  position: relative;
  padding: 22px 132px 22px 0;
  border-bottom: 1px solid #26374c;
}

.branch-item:last-child {
  border-bottom: 0;
}

.branch-item h3 {
  margin: 0 0 12px;
  font-size: 28px;
}

.branch-item p {
  margin: 6px 0;
  color: #93a2b8;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.branch-item .badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.product-leader-item {
  min-height: 164px;
}

.product-leader-item h3 {
  margin-bottom: 10px;
}

.product-leader-item p {
  margin: 3px 0;
  line-height: 1.18;
}

.hourly-card {
  padding-right: 0;
}

.hourly-card .badge {
  position: static;
  transform: none;
}

/* Почасовая загрузка — вертикальные карточки по часам (помещается на телефоне) */
.hourly-hours {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.hh-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: #122033;
  border: 1px solid #243246;
}

.hh-item.peak {
  background: rgba(52, 227, 154, 0.08);
  border-color: rgba(52, 227, 154, 0.28);
}

.hh-item.quiet {
  background: rgba(255, 102, 132, 0.07);
  border-color: rgba(255, 102, 132, 0.22);
}

.hh-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hh-time {
  font-size: 18px;
  font-weight: 800;
  color: #f4f7fb;
}

.hh-status {
  flex-shrink: 0;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: #93a2b8;
  background: #1c2940;
}

.hh-status.peak {
  color: #6ee7a8;
  background: rgba(52, 227, 154, 0.16);
}

.hh-status.quiet {
  color: #ff9db0;
  background: rgba(255, 102, 132, 0.16);
}

.hh-meta {
  margin-top: 8px;
  color: #93a2b8;
  font-size: 14px;
  font-weight: 600;
}

.hh-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}

.hh-wd {
  padding: 8px 13px;
  border-radius: 12px;
  border: 1px solid #2b3a52;
  background: #16243a;
  color: #93a2b8;
  font-weight: 800;
  font-size: 15px;
}

.hh-wd.active {
  background: #25466b;
  border-color: #4c8eda;
  color: #77b8ff;
}

.load-bar {
  display: block;
  height: 10px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f1d2d;
}

.load-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #5fa8ff;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

#refresh {
  min-width: 136px;
  min-height: 48px;
  border: 1px solid #4c8eda;
  border-radius: 12px;
  background: #25466b;
  color: #77b8ff;
  font-weight: 800;
}

pre {
  margin: 0;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d8e4f3;
  font-size: 16px;
  line-height: 1.45;
}

.receipt-form,
.custom-periods,
.payroll-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.receipt-form {
  grid-template-columns: 1fr;
  gap: 14px;
}

.stock-filter {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.stock-note {
  margin: 10px 0 14px;
  color: #93a2b8;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.stock-value-head {
  margin: 16px 0 4px;
}

.stock-value-filter {
  margin-bottom: 14px;
}

.stock-value-filter label {
  display: grid;
  gap: 6px;
  color: #93a2b8;
  font-size: 17px;
  font-weight: 700;
}

.stock-value-cards {
  display: grid;
  gap: 12px;
}

.stock-value-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 22px;
  background: #182234;
  border: 1px solid #243246;
}

.stock-value-card.accent {
  background: linear-gradient(135deg, #1f3b2e, #18324a);
  border-color: #2f6f52;
}

.stock-value-label {
  color: #93a2b8;
  font-size: 18px;
  font-weight: 700;
}

.stock-value-amount {
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
}

.stock-value-card.accent .stock-value-amount {
  color: #6ee7a8;
}

.stock-value-meta {
  margin: 12px 2px 0;
  color: #93a2b8;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.stock-value-breakdown {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.stock-value-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #141d2c;
  font-size: 15px;
  font-weight: 700;
}

.stock-value-row span:not(:first-child) {
  text-align: right;
  color: #cdd8e6;
}

.stock-value-row.head span {
  color: #93a2b8;
  font-size: 13px;
}

.recipe-editor {
  display: grid;
  gap: 12px;
  margin: 8px 0 4px;
}

.recipe-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.recipe-form-row label {
  display: grid;
  gap: 6px;
  color: #93a2b8;
  font-size: 15px;
  font-weight: 700;
}

.recipe-ing-head {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr 36px;
  gap: 8px;
  padding: 0 4px;
  color: #93a2b8;
  font-size: 13px;
  font-weight: 700;
}

.recipe-ingredients {
  display: grid;
  gap: 8px;
}

.recipe-ing-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr 36px;
  gap: 8px;
  align-items: center;
}

.recipe-ing-remove {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  background: #2a1a22;
  border: 1px solid #4a2733;
  color: #ff9db0;
  font-size: 22px;
  line-height: 1;
}

.recipe-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.ghost-btn {
  background: #182234;
  border: 1px solid #2b3a52;
  color: #cdd8e6;
  border-radius: 14px;
  font-weight: 700;
}

.ghost-btn.danger {
  background: #2a1a22;
  border-color: #4a2733;
  color: #ff9db0;
}

.recipe-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.recipe-group-head {
  color: #93a2b8;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.recipe-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #141d2c;
  margin-bottom: 8px;
}

.recipe-item-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.recipe-item-name {
  font-size: 18px;
  font-weight: 800;
}

.recipe-item-sub {
  color: #93a2b8;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
}

.recipe-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #1f3b2e;
  color: #6ee7a8;
  font-size: 12px;
  vertical-align: middle;
}

.recipe-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.recipe-item-actions .ghost-btn {
  padding: 8px 12px;
  font-size: 14px;
}

/* Редактор алиасов ингредиентов */
.alias-editor {
  display: grid;
  gap: 10px;
}

.alias-editor input {
  min-width: 0;
}

#aliasSave {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #4c8eda;
  border-radius: 14px;
  background: #25466b;
  color: #77b8ff;
  font-weight: 800;
  font-size: 16px;
}

.alias-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.alias-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #141d2c;
}

.alias-item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.alias-item-variant {
  font-size: 16px;
  font-weight: 800;
}

.alias-item-arrow {
  color: #93a2b8;
  font-size: 14px;
  font-weight: 700;
}

/* Кнопки редактора рецептур — в общем стиле приложения */
#recipeSave {
  min-height: 56px;
  border: 1px solid #4c8eda;
  border-radius: 14px;
  background: #25466b;
  color: #77b8ff;
  font-size: 19px;
  font-weight: 800;
}

#recipeAddIngredient,
#recipeClear {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
}

#recipeAddIngredient {
  border: 1px dashed #3a567d;
  background: #14233a;
  color: #8fb6e8;
}

/* Приходы с кнопкой удаления */
.stock-lots {
  display: grid;
  gap: 8px;
}

.stock-lot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #141d2c;
}

.stock-lot-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.stock-lot-name {
  font-size: 17px;
  font-weight: 800;
}

.stock-lot-sub {
  color: #93a2b8;
  font-size: 14px;
  font-weight: 600;
}

.lot-delete {
  flex-shrink: 0;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border-radius: 14px;
  background: #2a1a22;
  border: 1px solid #4a2733;
  color: #ff9db0;
  font-size: 22px;
  font-weight: 800;
}

/* Нижняя навигация склада */
.stock-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 820px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #0d1a29;
  border-top: 1px solid #1d2c40;
  z-index: 50;
}

.summary-nav .stock-nav-btn {
  font-size: 12px;
}

.summary-nav .stock-nav-btn span {
  white-space: nowrap;
}

.stock-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: #6b7d95;
  font-size: 14px;
  font-weight: 700;
  border-radius: 14px;
}

.stock-nav-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-nav-btn.active {
  color: #77b8ff;
  background: rgba(76, 142, 218, 0.12);
}

body.has-stock-nav .app,
body.has-summary-nav .app {
  padding-bottom: 110px;
}

/* Чистая прибыль (P&L) */
.profit-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.profit-card {
  padding: 16px;
  border-radius: 18px;
  background: #141d2c;
  border: 1px solid #243246;
}

.profit-card.total {
  background: linear-gradient(135deg, #16243a, #14233a);
  border-color: #355176;
}

.profit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.profit-outlet {
  font-size: 22px;
  font-weight: 800;
}

.profit-amount {
  font-size: 26px;
  font-weight: 800;
}

.profit-amount.pos {
  color: #6ee7a8;
}

.profit-amount.neg {
  color: #ff9db0;
}

.profit-rows {
  display: grid;
  gap: 6px;
}

.profit-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #cdd8e6;
}

.profit-row span:first-child {
  color: #93a2b8;
}

.profit-net {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #2b3a52;
  font-size: 18px;
  font-weight: 800;
  color: #f4f7fb;
}

.profit-net span:first-child {
  color: #f4f7fb;
}

/* Напоминания об оплате */
.reminder-form {
  display: grid;
  gap: 12px;
}

.reminder-form input {
  min-height: 54px;
  font-size: 17px;
  font-weight: 700;
}

.reminder-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: #cdd8e6;
  padding: 4px 2px;
}

.reminder-toggle input {
  width: 26px;
  height: 26px;
  min-height: 0;
  flex-shrink: 0;
}

.reminder-when {
  display: grid;
  gap: 12px;
}

.reminder-when label {
  display: grid;
  gap: 6px;
  color: #93a2b8;
  font-size: 15px;
  font-weight: 700;
}

#saveReminder {
  min-height: 52px;
  border: 1px solid #4c8eda;
  border-radius: 14px;
  background: #25466b;
  color: #77b8ff;
  font-weight: 800;
  font-size: 18px;
}

.reminder-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #141d2c;
}

.reminder-item.off {
  opacity: 0.55;
}

.reminder-item-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.reminder-item-name {
  font-size: 17px;
  font-weight: 800;
}

.reminder-item-sub {
  color: #93a2b8;
  font-size: 14px;
  font-weight: 600;
}

.reminder-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.reminder-item-actions .ghost-btn {
  padding: 8px 12px;
  font-size: 14px;
}

.access-denied {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #091522;
}

.access-denied-card {
  text-align: center;
  max-width: 360px;
}

.access-denied-emoji {
  font-size: 64px;
  margin-bottom: 12px;
}

.access-denied-card h2 {
  font-size: 28px;
  margin: 0 0 10px;
}

.access-denied-card p {
  color: #93a2b8;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.receipt-main-row,
.receipt-detail-row,
.receipt-action-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.receipt-main-row {
  grid-template-columns: 0.9fr 1.6fr;
}

.receipt-detail-row {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.receipt-action-row {
  justify-items: center;
}

.receipt-form input,
.receipt-form select {
  min-height: 72px;
  padding: 0 54px 0 28px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-detail-row input {
  padding-right: 18px;
  font-size: 16px;
}

.receipt-main-row input {
  font-size: 19px;
}

.receipt-form input::placeholder {
  color: rgba(244, 247, 251, 0.48);
  font-weight: 700;
}

.custom-periods {
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 18px;
}

.custom-periods label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.custom-periods label span {
  display: block;
  margin-bottom: 2px;
  color: #93a2b8;
  font-size: 18px;
  font-weight: 900;
}

.custom-periods input + input {
  margin-top: 6px;
}

.period-caption {
  display: grid;
  gap: 6px;
  margin: 16px 0 28px;
  line-height: 1.25;
}

.mini-period-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -6px 0 14px;
}

.mini-period {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #2b3f59;
  border-radius: 12px;
  background: #0f1d2d;
  color: #93a2b8;
  font-size: 16px;
  font-weight: 900;
}

.mini-period.active {
  border-color: #4c8eda;
  background: #1c3654;
  color: #77b8ff;
}

.mini-range {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.mini-range button {
  min-height: 48px;
  border: 1px solid #4c8eda;
  border-radius: 12px;
  background: #25466b;
  color: #77b8ff;
  font-weight: 800;
}

.payroll-periods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.payroll-range {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.expense-range {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.expense-total {
  padding: 16px 0 22px;
}

.expense-row {
  grid-template-columns: 1fr 1.6fr 0.6fr 1fr;
}

.inventory-row {
  grid-template-columns: 0.9fr 1.4fr 0.8fr 0.8fr 0.8fr 1fr;
}

.consumption-row {
  grid-template-columns: 1fr 1.5fr 0.9fr 0.9fr;
}

.stock-unmatched-row {
  grid-template-columns: 1.7fr 0.6fr;
}

.stock-subtable {
  margin-top: 14px;
}

.expense-editor {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #2b3f59;
}

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

.expense-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.payroll-filter {
  max-width: 360px;
  margin: -8px 0 18px;
}

.payroll-form {
  grid-template-columns: 1fr;
  gap: 14px;
}

.payroll-main-row,
.payroll-pay-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.payroll-main-row {
  grid-template-columns: 1fr 1fr 1.2fr;
}

.payroll-pay-row {
  grid-template-columns: 1fr 1fr auto;
}

.payroll-form select {
  min-height: 48px;
  padding: 0 14px;
  font-size: 16px;
}

.payroll-hint,
.empty-state {
  color: #93a2b8;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #31445d;
  border-radius: 12px;
  background: #0f1d2d;
  color: #f4f7fb;
  font: inherit;
}

.date-field {
  position: relative;
  display: block;
  width: 100%;
}

.native-date-input {
  color: transparent;
  caret-color: transparent;
  -webkit-text-fill-color: transparent;
}

.native-date-input::-webkit-date-and-time-value {
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.date-overlay {
  position: absolute;
  left: 14px;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  overflow: hidden;
  color: #f4f7fb;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-overlay.is-placeholder {
  color: rgba(244, 247, 251, 0.55);
}

label {
  color: #93a2b8;
  font-size: 16px;
  font-weight: 800;
}

#addReceipt,
#applyPeriods,
#applyInventory,
#applyConsumption,
#applyExpenses,
#applyPayrollPeriod,
#saveExpenseRule,
#clearExpenseRule,
#deleteExpenseRule,
#saveExpenseAdjustment,
#clearExpenseAdjustment,
#deleteExpenseAdjustment,
#addShift {
  min-height: 48px;
  border: 1px solid #4c8eda;
  border-radius: 12px;
  background: #25466b;
  color: #77b8ff;
  font-weight: 800;
}

#addReceipt {
  min-width: min(100%, 320px);
  min-height: 62px;
  padding: 0 28px;
  font-size: 22px;
  border-radius: 16px;
}

#addWriteoff {
  min-width: min(100%, 320px);
  min-height: 62px;
  padding: 0 28px;
  font-size: 22px;
  font-weight: 800;
  border-radius: 16px;
  border: 1px solid #5a2e3b;
  background: #3a1f29;
  color: #ff9db0;
}

.payroll-row {
  grid-template-columns: 1.3fr 1fr 0.8fr 0.8fr 1fr;
}

.payroll-total-row {
  background: rgba(76, 142, 218, 0.08);
}

.delete-shift {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid rgba(255, 102, 132, 0.45);
  border-radius: 10px;
  background: rgba(255, 102, 132, 0.12);
  color: #ff7892;
  font-size: 14px;
  font-weight: 800;
}

.delete-shift:disabled {
  opacity: 0.7;
}

.metric-name span,
.metric-value span {
  color: #93a2b8;
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .app {
    width: 100%;
    padding: 8px 8px 24px;
  }

  .topbar {
    grid-template-columns: 34px 36px 1fr 34px;
    gap: 8px;
    min-height: 58px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    font-size: 30px;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }

  .pill {
    min-width: 0;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 20px;
  }

  .logo-dot {
    width: 24px;
    height: 24px;
  }

  .tabs {
    margin: 16px 8px;
    padding: 5px;
    border-radius: 14px;
  }

  .tab {
    min-height: 58px;
    font-size: 18px;
  }

  .analytics-card,
  .panel {
    margin: 12px 4px;
    padding: 18px;
    border-radius: 14px;
  }

  .analytics-kicker,
  .period-caption {
    font-size: 18px;
  }

  h1 {
    font-size: 42px;
  }

  h2 {
    font-size: 32px;
  }

  .section-title-row {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .compare-card #applyPeriods {
    width: min(100%, 260px);
    margin: 0 auto 18px;
  }

  .custom-periods {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-right: 0;
    margin-bottom: 14px;
  }

  .custom-periods label {
    gap: 8px;
  }

  .custom-periods label span {
    font-size: 18px;
  }

  .custom-periods input {
    min-height: 52px;
    padding: 0 10px;
    font-size: 15px;
  }

  .period-caption {
    margin: 12px 0 22px;
    gap: 4px;
  }

  .receipt-form,
  .stock-filter,
  .expense-range,
  .expense-form,
  .payroll-periods,
  .payroll-range,
  .payroll-form {
    grid-template-columns: 1fr;
  }

  .mini-range {
    grid-template-columns: 1fr 1fr;
  }

  .mini-range button {
    grid-column: 1 / -1;
    justify-self: center;
    width: min(100%, 260px);
  }

  .metric-row {
    grid-template-columns: minmax(0, 1fr) minmax(46px, 0.5fr) minmax(92px, 0.9fr) minmax(88px, 0.78fr);
    gap: 8px;
    min-height: 78px;
    padding: 12px 10px;
  }

  .summary-metric-row {
    grid-template-columns: minmax(0, 1fr) minmax(58px, 0.62fr) minmax(78px, 0.72fr) minmax(86px, 0.72fr);
    gap: 0;
    padding: 0;
  }

  .summary-metric-row > * {
    padding: 10px 8px;
  }

  .metric-head {
    min-height: 54px;
    font-size: 14px;
  }

  .metric-name {
    font-size: 18px;
    overflow-wrap: break-word;
  }

  .metric-value {
    font-size: 17px;
    white-space: nowrap;
  }

  .badge {
    min-width: 84px;
    min-height: 64px;
    padding: 8px 9px;
    border-radius: 11px;
    font-size: 16px;
  }

  .branch-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 20px 0;
  }

  .branch-item h3 {
    grid-column: 1 / -1;
    font-size: 25px;
  }

  .branch-item p {
    grid-column: 1;
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .branch-item .badge {
    grid-column: 2;
    grid-row: 2 / span 3;
    position: static;
    align-self: center;
    justify-self: end;
    transform: none;
    min-width: 112px;
  }

  .hourly-card {
    display: block;
    padding: 20px 0;
  }

  .hourly-card h3,
  .hourly-card p {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: normal;
  }

  .product-leader-item {
    min-height: 142px;
  }

  .product-leader-item p {
    margin: 2px 0;
    line-height: 1.15;
  }

  .payroll-main-row,
  .payroll-pay-row,
  .receipt-main-row,
  .receipt-detail-row {
    grid-template-columns: 1fr;
  }

  .payroll-row {
    grid-template-columns: 1fr;
  }

  .expense-row {
    grid-template-columns: 1fr;
  }

  .stock-unmatched-row {
    grid-template-columns: 1fr;
  }

  #inventoryTable,
  #consumptionTable {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .inventory-row {
    grid-template-columns: 120px 190px 96px 96px 96px 112px;
    min-width: 760px;
    gap: 8px;
    font-size: 15px;
  }

  .consumption-row {
    grid-template-columns: 132px 220px 120px 132px;
    min-width: 660px;
    gap: 8px;
    font-size: 15px;
  }

  .inventory-row .metric-name,
  .inventory-row .metric-value,
  .consumption-row .metric-name,
  .consumption-row .metric-value {
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
  }

  .inventory-row .badge {
    min-width: 0;
    min-height: 0;
    padding: 6px 8px;
    white-space: normal;
    font-size: 13px;
  }

}

@media (max-width: 480px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    background: #07111d;
  }

  .app {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 10px 10px 28px;
  }

  .topbar {
    grid-template-columns: 34px 40px minmax(0, 1fr) 38px;
    gap: 8px;
    min-height: 56px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    font-size: 30px;
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .pill {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 21px;
  }

  .pill > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logo-dot {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin: 18px 0 14px;
    padding: 4px;
    border-radius: 16px;
  }

  .tab {
    min-height: 54px;
    padding: 0 4px;
    border-radius: 12px;
    font-size: 18px;
    line-height: 1;
  }

  .hero,
  .selector,
  .summary,
  .stock-period-card,
  .periods,
  .panel,
  .analytics-card {
    margin-left: 0;
    margin-right: 0;
  }

  .stock-period-card {
    padding: 14px;
  }

  .hero {
    padding: 0 2px 4px;
  }

  h1 {
    font-size: clamp(34px, 11vw, 42px);
  }

  h2 {
    margin: 8px 0 18px;
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.12;
    overflow-wrap: normal;
    word-break: normal;
  }

  .analytics-card,
  .panel {
    padding: 18px 14px;
    border-radius: 16px;
  }

  .analytics-kicker,
  .period-caption,
  .eyebrow,
  .selector span,
  .summary-label,
  .summary-meta,
  .panel-head span,
  label {
    font-size: 17px;
    line-height: 1.2;
  }

  label {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .panel-head strong {
    font-size: 25px;
    line-height: 1.08;
  }

  .selector {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
  }

  select,
  input,
  .receipt-form input,
  .receipt-form select {
    min-width: 0;
    width: 100%;
    min-height: 54px;
    padding: 0 42px 0 14px;
    border-radius: 13px;
    font-size: 18px;
    line-height: 1.1;
  }

  input {
    padding-right: 14px;
  }

  input[type="date"],
  input[data-date-input],
  .date-text-input {
    -webkit-appearance: none;
    appearance: none;
    min-inline-size: 0;
    font-size: 15px;
    text-align: left;
  }

  .receipt-main-row,
  .receipt-detail-row,
  .receipt-action-row,
  .stock-filter,
  .expense-range,
  .expense-form,
  .payroll-form,
  .payroll-main-row,
  .payroll-pay-row,
  .payroll-range {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .receipt-form {
    gap: 12px;
  }

  .receipt-form input,
  .receipt-form select,
  .receipt-detail-row input,
  .receipt-main-row input {
    font-size: 17px;
  }

  #addReceipt,
  #applyInventory,
  #applyConsumption,
  #applyExpenses,
  #applyPayrollPeriod,
  #addShift,
  #refresh,
  .mini-range button,
  .compare-card #applyPeriods {
    width: min(100%, 260px);
    min-height: 52px;
    justify-self: center;
    margin-left: auto;
    margin-right: auto;
    border-radius: 13px;
    font-size: 18px;
  }

  .summary {
    padding: 30px 6px 22px;
  }

  .summary-value {
    font-size: clamp(42px, 15vw, 58px);
    line-height: 1;
  }

  .periods,
  .payroll-periods {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 14px 0 18px;
  }

  .period {
    min-height: 86px;
    font-size: 34px;
  }

  .period span {
    margin-top: 4px;
    font-size: 18px;
  }

  .custom-periods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .custom-periods label {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 0;
  }

  .custom-periods label span {
    font-size: 18px;
  }

  .custom-periods input + input {
    margin-top: 0;
  }

  .custom-periods input[type="date"],
  .custom-periods input[data-date-input],
  .custom-periods .date-text-input {
    min-height: 44px;
    width: 100%;
    min-width: 0;
    padding: 0 26px 0 8px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 800;
  }

  .section-title-row {
    display: block;
  }

  .compare-card #applyPeriods {
    display: block;
    margin-top: 4px;
    margin-bottom: 20px;
  }

  .period-caption {
    margin: 16px 0 18px;
    gap: 6px;
    overflow-wrap: break-word;
  }

  .mini-period-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .mini-period {
    min-height: 46px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 17px;
  }

  .mini-range {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: end;
    overflow: hidden;
  }

  .mini-range label {
    min-width: 0;
    overflow: hidden;
  }

  .mini-range input {
    min-height: 44px;
    width: 100%;
    min-width: 0;
    padding: 0 26px 0 8px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 800;
  }

  .mini-range button {
    grid-column: 1 / -1;
  }

  .metrics-table {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .metric-row {
    gap: 0;
    min-height: 68px;
    padding: 0;
  }

  .metric-row > * {
    min-width: 0;
    padding: 12px 10px;
  }

  .metric-name {
    font-size: 18px;
    line-height: 1.12;
  }

  .metric-value {
    font-size: 17px;
    line-height: 1.12;
  }

  #metricsTable .metric-head,
  #metricsTable .summary-metric-row.metric-head {
    display: none;
  }

  #metricsTable .summary-metric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    min-width: 0;
    min-height: 0;
    padding: 16px 12px;
  }

  #metricsTable .summary-metric-row > * {
    min-height: 0;
    padding: 0;
    border-left: 0;
  }

  #metricsTable .summary-metric-row .metric-name {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    font-size: 21px;
    line-height: 1.12;
  }

  #metricsTable .summary-metric-row .metric-value {
    grid-column: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 0;
    max-width: 210px;
    font-size: 17px;
    white-space: normal;
    text-align: left;
  }

  #metricsTable .summary-metric-row .metric-value:nth-child(2) {
    grid-row: 2;
  }

  #metricsTable .summary-metric-row .metric-value:nth-child(3) {
    grid-row: 3;
  }

  #metricsTable .summary-metric-row .metric-value:nth-child(2)::before {
    content: "Было";
    color: #93a2b8;
    font-size: 13px;
    font-weight: 800;
  }

  #metricsTable .summary-metric-row .metric-value:nth-child(3)::before {
    content: "Стало";
    color: #93a2b8;
    font-size: 13px;
    font-weight: 800;
  }

  #metricsTable .summary-metric-row .metric-change {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    justify-self: end;
  }

  #metricsTable .summary-metric-row .badge {
    width: 106px;
    min-width: 106px;
    min-height: 68px;
    padding: 8px 7px;
    font-size: 15px;
    white-space: normal;
  }

  .badge {
    min-width: 96px;
    min-height: 62px;
    padding: 8px 10px;
    font-size: 16px;
  }

  .branch-list {
    overflow: hidden;
  }

  .branch-item {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 8px;
    padding: 20px 0;
  }

  .branch-item h3 {
    grid-column: 1 / -1;
    margin-bottom: 6px;
    font-size: 26px;
    line-height: 1.08;
  }

  .branch-item p {
    grid-column: 1;
    margin: 3px 0;
    font-size: 18px;
    line-height: 1.28;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .branch-item .badge {
    grid-column: 2;
    grid-row: 2 / span 3;
    align-self: center;
    min-width: 104px;
    white-space: normal;
  }

  .product-leader-item {
    min-height: 128px;
  }

  .product-leader-item p {
    line-height: 1.18;
  }

  .hourly-card {
    display: block;
    padding: 18px 0 0;
  }

  .hourly-card h3 {
    font-size: 28px;
  }

  .hourly-card p {
    font-size: 18px;
    line-height: 1.35;
  }

  .load-bar {
    height: 9px;
  }

  .stock-note,
  .payroll-hint,
  .empty-state {
    font-size: 16px;
    line-height: 1.35;
  }

  .expense-total {
    padding: 10px 0 18px;
  }

  .expense-row.metric-head,
  .payroll-row.metric-head,
  .inventory-row.metric-head,
  .consumption-row.metric-head,
  .stock-unmatched-row.metric-head {
    display: none;
  }

  .expense-row:not(.metric-head),
  .payroll-row:not(.metric-head),
  .inventory-row:not(.metric-head),
  .consumption-row:not(.metric-head),
  .stock-unmatched-row:not(.metric-head) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    min-width: 0;
    min-height: 0;
    padding: 14px 12px;
  }

  .expense-row:not(.metric-head) > *,
  .payroll-row:not(.metric-head) > *,
  .inventory-row:not(.metric-head) > *,
  .consumption-row:not(.metric-head) > *,
  .stock-unmatched-row:not(.metric-head) > * {
    min-width: 0;
    padding: 0;
    border-left: 0;
    font-size: 16px;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .expense-row:not(.metric-head) > *::before,
  .payroll-row:not(.metric-head) > *::before,
  .inventory-row:not(.metric-head) > *::before,
  .consumption-row:not(.metric-head) > *::before {
    display: block;
    margin-bottom: 3px;
    color: #93a2b8;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
  }

  .expense-row > :nth-child(1)::before { content: "Кофейня"; }
  .expense-row > :nth-child(2)::before { content: "Платеж"; }
  .expense-row > :nth-child(3)::before { content: "Дней"; }
  .expense-row > :nth-child(4)::before { content: "Сумма"; }

  .expense-row:not(.metric-head) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "outlet amount"
      "payment days";
    gap: 12px 16px;
    padding: 18px 16px;
  }

  .expense-row:not(.metric-head) > :nth-child(1) {
    grid-area: outlet;
    font-size: 18px;
    line-height: 1.12;
  }

  .expense-row:not(.metric-head) > :nth-child(2) {
    grid-area: payment;
    font-size: 18px;
    line-height: 1.18;
  }

  .expense-row:not(.metric-head) > :nth-child(2) span {
    display: inline-block;
    margin-top: 2px;
    color: #93a2b8;
    font-size: 15px;
    font-weight: 800;
  }

  .expense-row:not(.metric-head) > :nth-child(3) {
    grid-area: days;
    justify-self: end;
    align-self: end;
    text-align: right;
    font-size: 18px;
  }

  .expense-row:not(.metric-head) > :nth-child(4) {
    grid-area: amount;
    justify-self: end;
    align-self: start;
    text-align: right;
    color: #f4f7fb;
    font-size: 22px;
    white-space: nowrap;
  }

  .expense-row:not(.metric-head) > :nth-child(4)::before {
    text-align: right;
  }

  .expense-row.payroll-total-row:not(.metric-head) {
    grid-template-areas: "outlet amount";
    align-items: center;
  }

  .expense-row.payroll-total-row:not(.metric-head) > :nth-child(2),
  .expense-row.payroll-total-row:not(.metric-head) > :nth-child(3) {
    display: none;
  }

  .payroll-row > :nth-child(1)::before { content: "Смена"; }
  .payroll-row > :nth-child(2)::before { content: "Выручка"; }
  .payroll-row > :nth-child(3)::before { content: "Оклад"; }
  .payroll-row > :nth-child(4)::before { content: "%"; }
  .payroll-row > :nth-child(5)::before { content: "Итого"; }

  .inventory-row > :nth-child(1)::before { content: "Кофейня"; }
  .inventory-row > :nth-child(2)::before { content: "Позиция"; }
  .inventory-row > :nth-child(3)::before { content: "Остаток"; }
  .inventory-row > :nth-child(4)::before { content: "Приход"; }
  .inventory-row > :nth-child(5)::before { content: "Списано"; }
  .inventory-row > :nth-child(6)::before { content: "Статус"; }

  .consumption-row > :nth-child(1)::before { content: "Кофейня"; }
  .consumption-row > :nth-child(2)::before { content: "Расходник"; }
  .consumption-row > :nth-child(3)::before { content: "Количество"; }
  .consumption-row > :nth-child(4)::before { content: "Себестоимость"; }

  .payroll-row:not(.metric-head) > :first-child,
  .inventory-row:not(.metric-head) > :first-child,
  .consumption-row:not(.metric-head) > :first-child {
    grid-column: 1 / -1;
    font-size: 19px;
  }

  .payroll-total-row:not(.metric-head) {
    background: #1c314a;
  }

  .expense-form,
  .expense-actions {
    gap: 10px;
  }

  .expense-actions button {
    width: 100%;
  }

  .payroll-filter {
    max-width: none;
  }

  .delete-shift {
    min-height: 30px;
    margin-top: 8px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .app {
    padding-left: 8px;
    padding-right: 8px;
  }

  .tab {
    font-size: 16px;
  }

  .analytics-card,
  .panel {
    padding: 16px 14px;
  }

  .custom-periods {
    gap: 8px;
  }

  .custom-periods input[type="date"],
  .custom-periods input[data-date-input],
  .custom-periods .date-text-input,
  .mini-range input {
    font-size: 11px;
  }

  .branch-item {
    grid-template-columns: 1fr;
  }

  .branch-item .badge {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}
