@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600&display=swap');

:root {
  --bg: #f4efe7;
  --bg-soft: #f8f2e8;
  --ink: #1f2a24;
  --ink-soft: #4b5a50;
  --line: rgba(31, 42, 36, 0.12);
  --card: #fffdf8;
  --accent: #ea580c;
  --accent-2: #f59e0b;
  --danger: #be123c;
  --ok: #0f766e;
  --size-tone-25: #fff9df;
  --size-tone-30: #f2fbef;
  --size-tone-35: #fff3f1;
  --size-tone-25-line: #e9ddb0;
  --size-tone-30-line: #cfe7cb;
  --size-tone-35-line: #e9cec8;
  --shadow: 0 20px 40px rgba(31, 42, 36, 0.12);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Fira Sans", sans-serif;
  background: radial-gradient(circle at 0% 0%, #fff2df 0%, var(--bg) 45%, #ece3d5 100%);
}

.app-shell {
  position: relative;
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  opacity: 0.45;
  z-index: 0;
}

.app-shell::before {
  width: 480px;
  height: 480px;
  right: -160px;
  top: -220px;
  background: radial-gradient(circle, rgba(232, 93, 19, 0.28), transparent 72%);
}

.app-shell::after {
  width: 520px;
  height: 520px;
  left: -200px;
  bottom: -260px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.2), transparent 75%);
}

header,
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 30px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ea580c, #fb923c);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  box-shadow: 0 18px 30px rgba(234, 88, 12, 0.22);
  text-decoration: none;
}

.brand h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 29px;
  line-height: 1.1;
}

.brand p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.language-switch label {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

.language-select {
  width: auto;
  min-width: 140px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 13px;
  background: #fff;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-pill > span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-action {
  margin-left: auto;
  border: 1px solid rgba(31, 42, 36, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.status-action:hover {
  background: rgba(232, 93, 19, 0.08);
}

.status-pill.connected > span {
  background: #22c55e;
}

.status-pill.connected {
  border-color: var(--line);
  background: #fff;
}

.status-pill.connected strong {
  color: #15803d;
}

main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 70px;
}

.pair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
}

.section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
}

.section-title small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
  max-width: 380px;
}

.connect-country-wrap {
  margin-top: 10px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connect-country-label {
  font-size: 13px;
}

.connect-country-select {
  min-height: 46px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
}

.connect-country-combobox {
  position: relative;
}

.connect-country-input-shell {
  position: relative;
}

.connect-country-input {
  width: 100%;
  padding-right: 44px;
}

.connect-country-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.connect-country-toggle:hover {
  background: rgba(31, 42, 36, 0.08);
}

.connect-country-combobox.is-open .connect-country-toggle {
  color: var(--ink);
}

.connect-country-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.connect-country-option {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.connect-country-option:hover,
.connect-country-option:focus-visible {
  background: rgba(232, 93, 19, 0.08);
  outline: none;
}

.connect-country-option.active {
  background: rgba(232, 93, 19, 0.14);
}

.connect-country-option-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.connect-country-option-code {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.connect-country-empty {
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.3;
}

.connect-row-actions {
  margin-top: 14px;
}

#connectHint {
  min-height: 18px;
  margin-top: 8px;
}

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

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

input,
select,
button {
  font-family: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(232, 93, 19, 0.28);
  outline-offset: 1px;
}

.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.validation-error {
  outline: 2px solid rgba(220, 38, 38, 0.65);
  outline-offset: 3px;
}

.validation-hint {
  display: none;
  margin: 6px 0 0;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.validation-hint.active {
  display: block;
}

.date-list-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.compact-date-list-block {
  margin-top: 12px;
  padding-top: 12px;
}

.planning-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.planning-option-panel {
  min-width: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: #fffdfa;
}

.planning-option-panel > .inline-list-head:first-child {
  margin-bottom: 12px;
}

.inline-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.compact-button {
  padding: 8px 12px;
  min-height: 0;
}

.inline-date-rows {
  display: grid;
  gap: 8px;
}

.inline-date-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 120px) auto;
  gap: 8px;
  align-items: center;
}

.inline-date-row.no-percent {
  grid-template-columns: minmax(0, 1fr) auto;
}

.inline-hint {
  margin-top: 8px;
}

.inline-date-row input {
  min-width: 0;
}

#coverageDays[readonly] {
  background: #f8f2e8;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.days-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 100%;
}

.days-field input {
  width: 100%;
  max-width: 180px;
  min-width: 0;
  min-height: 48px;
  height: 48px;
  padding: 10px 10px;
  text-align: center;
  font-weight: 600;
}

.days-field input.simulation-days-locked {
  background: #f4efe7;
  border-style: dashed;
  color: var(--ink-soft);
  cursor: default;
}

.days-field input.simulation-days-locked::-webkit-outer-spin-button,
.days-field input.simulation-days-locked::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.grid-7 {
  margin-top: 12px;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 8px;
}

.grid-7 label {
  font-size: 11px;
  margin-bottom: 4px;
}

.grid-7 input {
  padding: 7px 4px;
  text-align: center;
}

.holiday-block {
  margin-top: 14px;
}

.buffer-size-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.buffer-size-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.buffer-size-item label {
  margin-bottom: 4px;
}

.buffer-size-item input {
  text-align: center;
}

.sub-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.grid-retro-controls {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.retro-control-button {
  display: flex;
  align-items: flex-end;
}

.retro-split {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.retro-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
  background: #fff;
}

.segment {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.segment button {
  border: 0;
  background: transparent;
  min-height: 48px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.segment button.active {
  background: linear-gradient(135deg, rgba(232, 93, 19, 0.16), rgba(248, 160, 74, 0.22));
  color: var(--ink);
  font-weight: 600;
}

.hint-card {
  margin-top: 12px;
  background: var(--bg-soft);
  border: 1px solid rgba(232, 93, 19, 0.24);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.recipe-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.recipe-action-button {
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.3;
  border-radius: 10px;
}

.recipe-edit-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

#settingsSection .settings-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#settingsSection .settings-row {
  display: grid;
  gap: 14px;
  align-items: start;
}

#settingsSection .settings-row-top {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

#settingsSection .settings-row-bottom {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

#settingsSection .settings-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#settingsSection #sizeMode {
  align-self: flex-start;
  width: auto;
}

#settingsSection .settings-block > label {
  min-height: 20px;
  display: flex;
  align-items: flex-end;
}

#settingsSection .settings-layout select,
#settingsSection .settings-layout input[type="text"],
#settingsSection .settings-layout input[type="number"] {
  width: 100%;
  min-width: 0;
}

#settingsSection .recipe-config select {
  min-height: 48px;
}

#settingsSection .recipe-actions {
  min-height: 48px;
  align-items: center;
}

#settingsSection .recipe-actions .button {
  min-height: 48px;
}

#settingsSection .days-field {
  padding-top: 2px;
  max-width: none;
  justify-self: stretch;
  align-items: stretch;
}

#settingsSection .days-field input {
  max-width: none;
}

.recipe-custom-hint {
  min-height: 16px;
  margin: 0;
}

.recipe-info-hint {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(31, 42, 36, 0.03);
  border: 1px dashed rgba(31, 42, 36, 0.2);
  min-height: 48px;
  display: flex;
  align-items: center;
}

textarea {
  font-family: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(232, 93, 19, 0.28);
  outline-offset: 1px;
}

.unit-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
}

.unit-item:hover {
  background: #fbf6ee;
}

.unit-item input {
  width: auto;
  margin: 0;
}

.unit-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.unit-text small {
  color: var(--ink-soft);
  font-size: 11px;
}

.selected-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.unit-picker-field {
  grid-column: span 2;
}

.unit-choice-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, auto);
  gap: 10px;
  align-items: center;
}

.selected-wrap-inline {
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
  min-width: 210px;
}

.selected-counter {
  white-space: nowrap;
}

.lookback-panel {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fffcf7;
}

.lookback-row {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lookback-row label {
  margin: 0;
}

.lookback-select {
  width: auto;
  min-width: 110px;
  max-width: 140px;
}

.lookback-range-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
}

.lookback-date-field label {
  margin-bottom: 4px;
}

.lookback-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.08);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.chip button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
  font-size: 13px;
}

.readonly-pill {
  display: inline-flex;
  min-width: 54px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8f2e8;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 6px 10px;
}

.admin-toolbar {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, auto);
  gap: 12px;
  align-items: end;
}

.admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 0;
  white-space: nowrap;
}

.admin-toggle input {
  width: auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(232, 93, 19, 0.28);
  border-radius: 999px;
  background: rgba(232, 93, 19, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
  white-space: nowrap;
}

.status-badge.ok {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.08);
  color: var(--ok);
}

.muted-badge {
  border-color: var(--line);
  background: #fff;
  color: var(--ink-soft);
}

.admin-actions-cell {
  white-space: nowrap;
}

.size-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.legend-title {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 13px;
}

.size-filter .chip {
  border: 1px solid rgba(232, 93, 19, 0.45);
  background: rgba(232, 93, 19, 0.06);
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.size-filter .chip.active {
  background: rgba(232, 93, 19, 0.14);
  border-color: rgba(232, 93, 19, 0.7);
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table.compact-table {
  min-width: 420px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 600;
}

.result-table {
  min-width: 980px;
}

#simulationTable {
  min-width: 1120px;
}

#retroTable {
  min-width: 980px;
}

.result-table th,
.result-table td {
  padding: 6px 4px;
  text-align: center;
}

.result-actions {
  margin: 8px 0 6px;
}

.result-actions > label {
  margin-bottom: 4px;
}

.result-table .demand-input {
  width: 74px;
  max-width: 100%;
  margin: 0 auto;
  padding: 5px 6px;
  text-align: center;
}

.result-table .demand-input.edited {
  border-color: rgba(232, 93, 19, 0.9);
  box-shadow: 0 0 0 2px rgba(232, 93, 19, 0.16);
  background: rgba(232, 93, 19, 0.06);
}

.result-table .demand-input:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.result-table .demand-input.edited:disabled {
  border-color: rgba(232, 93, 19, 0.9);
  box-shadow: 0 0 0 2px rgba(232, 93, 19, 0.16);
  background: rgba(232, 93, 19, 0.06);
}

.result-table tr.day-separator td {
  border-top: 2px solid rgba(31, 42, 36, 0.22);
}

.result-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
}

.date-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
}

.date-stack .date-sub {
  font-size: 12px;
  color: var(--ink-soft);
}

.cell-zero {
  color: rgba(31, 42, 36, 0.45);
}

.input-zero {
  color: rgba(31, 42, 36, 0.45);
}

.cell-shortage {
  background: rgba(220, 38, 38, 0.14);
  color: #991b1b;
  font-weight: 600;
}

.cell-writeoff {
  background: rgba(239, 68, 68, 0.12);
  color: #991b1b;
  font-weight: 600;
}

.result-table tr.size-tone-25 {
  background: var(--size-tone-25);
}

.result-table tr.size-tone-30 {
  background: var(--size-tone-30);
}

.result-table tr.size-tone-35 {
  background: var(--size-tone-35);
}

#simulationCards {
  display: none;
}

.simulation-day-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f3eb;
  padding: 12px;
}

.simulation-day-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
}

.simulation-size-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.simulation-size-card {
  border: 1px dashed rgba(31, 42, 36, 0.24);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}

.simulation-size-card.size-tone-25 {
  background: var(--size-tone-25);
  border-color: var(--size-tone-25-line);
}

.simulation-size-card.size-tone-30 {
  background: var(--size-tone-30);
  border-color: var(--size-tone-30-line);
}

.simulation-size-card.size-tone-35 {
  background: var(--size-tone-35);
  border-color: var(--size-tone-35-line);
}

.simulation-size-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.simulation-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

.simulation-metric:last-child {
  margin-bottom: 0;
}

.simulation-metric-value {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.simulation-metric-plan {
  align-items: flex-start;
  flex-direction: column;
}

.simulation-metric-plan .demand-input {
  width: 100%;
  margin: 0;
  text-align: center;
  padding: 8px 10px;
  border-radius: 999px;
}

.simulation-metric-value.cell-shortage,
.simulation-metric-value.cell-writeoff {
  border-radius: 8px;
  padding: 4px 6px;
}

.simulation-day-revenue {
  margin-top: 10px;
  border: 1px dashed rgba(31, 42, 36, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  padding: 10px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.simulation-day-revenue strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

#productionTable {
  min-width: 0;
  table-layout: fixed;
}

#productionTable th,
#productionTable td {
  text-align: center;
}

#productionTable th:nth-child(1),
#productionTable td:nth-child(1) {
  width: 38%;
}

#productionTable th:nth-child(2),
#productionTable td:nth-child(2) {
  width: 62%;
}

#ingredientsTable {
  min-width: 0;
  table-layout: fixed;
}

#ingredientsTable th:nth-child(1),
#ingredientsTable td:nth-child(1) {
  width: 58%;
}

#ingredientsTable th:nth-child(2),
#ingredientsTable td:nth-child(2),
#ingredientsTable th:nth-child(3),
#ingredientsTable td:nth-child(3) {
  width: 21%;
  text-align: center;
}

#ingredientsTable td {
  white-space: normal;
  word-break: break-word;
}

.production-main {
  line-height: 1.1;
}

.production-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.1;
}

#stockTable {
  table-layout: fixed;
  min-width: 940px;
}

#stockTable th,
#stockTable td {
  text-align: center;
}

#stockTable th:nth-child(1),
#stockTable td:nth-child(1) {
  width: 90px;
}

#stockTable th:nth-child(2),
#stockTable td:nth-child(2) {
  width: 93px;
}

#stockTable th:nth-child(3),
#stockTable td:nth-child(3) {
  width: 78px;
}

#stockTable th:nth-child(4),
#stockTable td:nth-child(4) {
  width: 88px;
}

#stockTable th:nth-child(6),
#stockTable td:nth-child(6) {
  width: 66px;
}

#stockTable th:nth-child(7),
#stockTable td:nth-child(7) {
  width: 44px;
}

#stockTable th:nth-child(5),
#stockTable td:nth-child(5) {
  width: 66px;
}

#stockTable .stock-size,
#stockTable .stock-dough-type {
  width: 84px;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

#stockTable .stock-unit-toggle {
  width: 84px;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
}

#stockTable .stock-unit-toggle .stock-unit-button {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
}

#stockTable .stock-qty {
  width: 87px;
  max-width: 100%;
  margin: 0 auto;
  display: block;
  text-align: center;
}

.date-control {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 26px;
  gap: 2px;
  align-items: center;
}

.date-control .date-display,
.date-control .native-date-input {
  grid-column: 2;
  grid-row: 1;
}

.date-control .date-display {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.date-control:focus-within .date-display {
  outline: 2px solid rgba(232, 93, 19, 0.28);
  outline-offset: 1px;
}

.date-control .native-date-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  background: transparent;
  cursor: pointer;
}

#stockTable .stock-qty.field-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

#stockTable .date-control.field-error .date-display {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.14);
}

#stockTable td.stock-cell-actions {
  padding-left: 0;
  padding-right: 0;
}

#stockTable td.stock-cell-actions .icon-button {
  width: 28px;
  height: 28px;
}

#stockTable tr.stock-group-row td {
  background: transparent;
}

#stockTable tr.stock-group-row td:first-child {
  border-left: 2px solid rgba(31, 42, 36, 0.22);
}

#stockTable tr.stock-group-row td:last-child {
  border-right: 2px solid rgba(31, 42, 36, 0.22);
}

#stockTable tr.stock-group-start td {
  border-top: 2px solid rgba(31, 42, 36, 0.22);
}

#stockTable tr.stock-group-start td,
#stockTable tr.stock-group-middle td {
  border-bottom-color: transparent;
}

#stockTable tr.stock-group-end td {
  border-bottom: 2px solid rgba(31, 42, 36, 0.22);
}

#stockTable tr.stock-group-single td {
  border-top: 2px solid rgba(31, 42, 36, 0.22);
  border-bottom: 2px solid rgba(31, 42, 36, 0.22);
}

#stockTable tr.stock-group-start td:first-child,
#stockTable tr.stock-group-single td:first-child {
  border-top-left-radius: 12px;
}

#stockTable tr.stock-group-start td:last-child,
#stockTable tr.stock-group-single td:last-child {
  border-top-right-radius: 12px;
}

#stockTable tr.stock-group-end td:first-child,
#stockTable tr.stock-group-single td:first-child {
  border-bottom-left-radius: 12px;
}

#stockTable tr.stock-group-end td:last-child,
#stockTable tr.stock-group-single td:last-child {
  border-bottom-right-radius: 12px;
}

#stockTable tr.stock-group-end td,
#stockTable tr.stock-group-single td {
  box-shadow: 0 6px 12px -8px rgba(31, 42, 36, 0.22);
}

.date-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  height: 38px;
  width: 26px;
  padding: 0;
  cursor: pointer;
}

.date-step:hover {
  background: rgba(232, 93, 19, 0.12);
}

.row-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stock-date-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 23, 0.36);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.stock-date-modal {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.22);
  padding: 14px;
}

.stock-date-modal h4 {
  margin: 0 0 10px;
  font-size: 20px;
}

.stock-date-modal .stock-block-date-input {
  width: 100%;
}

.stock-date-modal-label {
  display: block;
  margin: 6px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.stock-date-modal-hint {
  margin: 6px 0 0;
}

.stock-date-modal-unit {
  margin-top: 10px;
}

.stock-date-modal-unit label {
  margin-bottom: 6px;
}

.stock-modal-unit-toggle {
  width: 184px;
  max-width: 100%;
}

.stock-modal-unit-toggle .stock-unit-button {
  flex: 1;
}

.stock-date-modal .row-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(234, 88, 12, 0.22);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.button.ghost {
  background: linear-gradient(180deg, #fffefc 0%, #fff7ed 100%);
  color: var(--ink);
  border: 1px dashed rgba(224, 122, 95, 0.6);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.result-block + .result-block {
  margin-top: 18px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.result-head .row-actions {
  margin-top: 0;
}

.recipe-files {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.recipe-file-button {
  border: 1px dashed rgba(15, 91, 102, 0.45);
  background: rgba(15, 91, 102, 0.06);
  color: #0f5b66;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.recipe-file-button:hover {
  background: rgba(15, 91, 102, 0.12);
}

.recipe-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 23, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.recipe-modal {
  width: min(760px, 100%);
  max-height: calc(100dvh - 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 36px rgba(0, 0, 0, 0.24);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recipe-modal-title {
  margin: 0;
  font-size: 20px;
}

.recipe-modal-content {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9f7f2;
  padding: 12px;
  overflow: auto;
  max-height: calc(100dvh - 180px);
  font-size: 14px;
  line-height: 1.45;
}

.recipe-modal-line {
  margin: 0;
}

.recipe-modal-line + .recipe-modal-line {
  margin-top: 6px;
}

.recipe-modal-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}

.recipe-modal-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.recipe-modal-table th,
.recipe-modal-table td {
  border: 1px solid rgba(31, 42, 36, 0.22);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.recipe-modal-table th {
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.custom-recipe-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 23, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 16px;
}

.custom-recipe-modal {
  width: min(860px, 100%);
  max-height: calc(100dvh - 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 36px rgba(0, 0, 0, 0.24);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.custom-recipe-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.custom-recipe-modal-head h4 {
  margin: 0;
  font-size: 20px;
}

.custom-recipe-modal-content {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9f7f2;
  padding: 12px;
  overflow: auto;
  max-height: calc(100dvh - 200px);
  display: grid;
  gap: 12px;
}

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

.custom-recipe-field label {
  margin-bottom: 4px;
}

.custom-recipe-field .segment {
  width: 100%;
}

.custom-recipe-field .segment button {
  flex: 1;
}

.custom-recipe-name {
  max-width: 100%;
}

.custom-recipe-transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-recipe-ingredients {
  border: 1px solid rgba(31, 42, 36, 0.2);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.custom-recipe-mode-hint {
  margin: 0 0 8px;
}

.custom-recipe-ingredients-table-wrap {
  overflow-x: auto;
}

.custom-recipe-ingredients-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
}

.custom-recipe-ingredients-table th,
.custom-recipe-ingredients-table td {
  border: 1px solid rgba(31, 42, 36, 0.2);
  padding: 7px 8px;
  text-align: left;
}

.custom-recipe-ingredients-table th {
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(249, 247, 242, 0.9);
}

.custom-recipe-ingredients-table td:nth-child(2) {
  width: 150px;
}

.custom-recipe-ingredients-table td:nth-child(2) input {
  text-align: right;
}

.custom-recipe-ingredient-input-locked {
  background: #f3efe7;
  border-style: dashed;
  color: var(--ink-soft);
  cursor: not-allowed;
}

.custom-recipe-units-toolbar {
  margin-bottom: 8px;
}

.custom-recipe-units-list {
  border: 1px solid rgba(31, 42, 36, 0.2);
  border-radius: 10px;
  background: #fff;
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.custom-recipe-units-list.custom-recipe-units-list-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.custom-recipe-unit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 2px;
}

.custom-recipe-unit-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.custom-recipe-save-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(15, 91, 102, 0.42);
  background: rgba(15, 91, 102, 0.06);
  color: #0f5b66;
  font-size: 12px;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.warning-item {
  border: 1px solid rgba(190, 18, 60, 0.25);
  background: rgba(190, 18, 60, 0.08);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
}

.small-cell {
  font-size: 12px;
  white-space: nowrap;
}

.danger {
  color: var(--danger);
  font-weight: 700;
}

.growth-pos {
  color: #0f766e;
  font-weight: 600;
}

.growth-neg {
  color: #b91c1c;
  font-weight: 600;
}

.muted {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  header,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .pair-grid {
    grid-template-columns: 1fr;
  }

  .planning-options-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 16px;
    border-radius: 18px;
  }

  .table {
    min-width: 640px;
  }

  .result-table {
    min-width: 760px;
  }

  .table.compact-table {
    min-width: 520px;
  }

  #productionTable,
  #ingredientsTable {
    min-width: 0;
  }

  #simulationTableWrap {
    display: none;
  }

  #simulationCards {
    display: grid;
    gap: 12px;
  }

  .retro-split {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 25px;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 8px;
  }

  main {
    padding-bottom: 56px;
  }

  .status-pill {
    width: 100%;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .header-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .language-switch {
    width: 100%;
    justify-content: space-between;
    border-radius: 14px;
  }

  .language-select {
    width: 100%;
    min-width: 0;
  }

  .status-action {
    margin-left: 0;
  }

  .connect-country-wrap {
    max-width: none;
  }

  .connect-country-select {
    font-size: 14px;
  }

  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-title small {
    max-width: 100%;
  }

  .recipe-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .recipe-action-button {
    width: 100%;
  }

  .recipe-edit-button {
    width: 46px;
    min-width: 46px;
    align-self: flex-start;
  }

  .custom-recipe-grid {
    grid-template-columns: 1fr;
  }

  .custom-recipe-transfer-actions .button {
    width: 100%;
  }

  #bufferSection .grid-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #settingsSection .settings-row-top,
  #settingsSection .settings-row-bottom {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #settingsSection .days-field {
    max-width: none;
    justify-self: stretch;
  }

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

  .grid-7 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .holiday-block .row-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .holiday-block .row-actions .button {
    width: 100%;
  }

  #unitSection .selected-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  #unitSection .chips {
    width: 100%;
  }

  #productionTable th,
  #productionTable td {
    padding: 8px 6px;
  }

  #ingredientsTable th,
  #ingredientsTable td {
    padding: 7px 4px;
  }

  #ingredientsTable th {
    font-size: 10px;
    letter-spacing: 0.02em;
  }

  #stockTable thead,
  #holidayTable thead {
    display: none;
  }

  #stockTable,
  #stockTable tbody,
  #holidayTable,
  #holidayTable tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #stockTable tr {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 12px 54px;
    margin-bottom: 10px;
    background: #f8f3eb;
    position: relative;
  }

  #stockTable td,
  #holidayTable td {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0;
    border: none;
    text-align: left;
    min-width: 0;
  }

  #stockTable td::before,
  #holidayTable td::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--ink-soft);
    font-weight: 600;
    line-height: 1.2;
  }

  #stockTable td.stock-cell-size {
    grid-column: 1 / span 4;
    grid-row: 1;
  }

  #stockTable td.stock-cell-qty {
    grid-column: 5 / span 4;
    grid-row: 1;
  }

  #stockTable td.stock-cell-unit {
    grid-column: 9 / span 2;
    grid-row: 1;
  }

  #stockTable td.stock-cell-dough {
    grid-column: 11 / span 2;
    grid-row: 1;
  }

  #stockTable td.stock-cell-size .stock-size {
    width: 86%;
    max-width: 170px;
    margin-left: auto;
    margin-right: auto;
  }

  #stockTable td.stock-cell-qty .stock-qty {
    width: 86%;
    max-width: 170px;
    margin-left: auto;
    margin-right: auto;
  }

  #stockTable td.stock-cell-unit .stock-unit-toggle,
  #stockTable td.stock-cell-dough .stock-dough-type {
    width: 82%;
    max-width: 118px;
    margin-left: auto;
    margin-right: auto;
  }

  #stockTable td.stock-cell-production {
    grid-column: 1 / span 6;
    grid-row: 2;
    align-items: center;
  }

  #stockTable td.stock-cell-expiry {
    grid-column: 7 / span 6;
    grid-row: 2;
    align-items: center;
  }

  #stockTable td.stock-cell-production::before,
  #stockTable td.stock-cell-expiry::before {
    align-self: center;
    text-align: center;
  }

  #stockTable td.stock-cell-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    align-items: center;
    justify-content: center;
    display: flex;
    width: 34px;
    height: 34px;
    padding: 0;
  }

  #stockTable td.stock-cell-actions::before {
    display: none;
  }

  #stockTable td.stock-cell-actions .icon-button {
    width: 100%;
    height: 100%;
    font-size: 20px;
  }

  #stockTable .stock-dough-type {
    font-size: 12px;
    padding-left: 6px;
    padding-right: 18px;
  }

  #stockTable .stock-unit-toggle .stock-unit-button {
    font-size: 12px;
    padding: 7px 4px;
  }

  #stockTable select,
  #stockTable input[type="number"],
  #stockTable input[type="date"] {
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    font-size: 13px;
  }

  #stockTable .stock-size,
  #stockTable .stock-unit-toggle,
  #stockTable .stock-dough-type,
  #stockTable .stock-qty {
    width: 100%;
  }

  #stockTable tr.stock-group-row {
    border-color: rgba(31, 42, 36, 0.2);
    background: rgba(255, 253, 248, 0.9);
  }

  #stockTable tr.stock-group-row td {
    background: transparent;
  }

  #stockTable tr.stock-group-end,
  #stockTable tr.stock-group-single {
    box-shadow: 0 4px 10px rgba(31, 42, 36, 0.08);
  }

  #stockTable .date-control {
    width: 100%;
    min-width: 0;
    grid-template-columns: 30px minmax(96px, 1fr) 30px;
    gap: 6px;
  }

  #stockTable td.stock-cell-production .date-control,
  #stockTable td.stock-cell-expiry .date-control {
    max-width: 240px;
    margin: 0 auto;
  }

  #stockTable .date-control .date-display,
  #stockTable .date-control .native-date-input {
    min-height: 44px;
    height: 44px;
    padding: 7px 8px;
  }

  #stockTable .date-control .date-display {
    font-size: 17px;
    text-align: center;
    line-height: 1;
  }

  #stockTable .date-step {
    width: 30px;
    height: 44px;
    font-size: 18px;
  }

  .simulation-size-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .simulation-day-revenue strong {
    font-size: 30px;
  }

  #holidayTable tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 8px;
    background: #fff;
  }

  #holidayTable td.holiday-cell-actions {
    align-items: flex-end;
    justify-content: flex-end;
  }

  #holidayTable input[type="date"],
  #holidayTable input[type="number"] {
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    font-size: 13px;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 22px;
  }

  .unit-list {
    max-height: 210px;
  }

  .grid-7 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #stockTable tr {
    gap: 7px;
    padding: 10px 10px 48px;
  }

  #stockTable td.stock-cell-size .stock-size,
  #stockTable td.stock-cell-qty .stock-qty {
    width: 84%;
  }

  #stockTable td.stock-cell-unit .stock-unit-toggle,
  #stockTable td.stock-cell-dough .stock-dough-type {
    width: 80%;
    max-width: 106px;
  }

  #stockTable .stock-unit-toggle .stock-unit-button {
    padding: 7px 2px;
  }

  #stockTable td.stock-cell-actions {
    right: 10px;
    bottom: 10px;
    width: 32px;
    height: 32px;
  }

  #stockTable .date-control {
    grid-template-columns: 28px minmax(90px, 1fr) 28px;
    gap: 4px;
  }

  #stockTable td.stock-cell-production .date-control,
  #stockTable td.stock-cell-expiry .date-control {
    max-width: 230px;
  }

  #stockTable .date-control .date-display,
  #stockTable .date-control .native-date-input {
    min-height: 42px;
    height: 42px;
    padding: 6px 6px;
  }

  #stockTable .date-control .date-display {
    font-size: 16px;
  }

  #stockTable .date-step {
    width: 28px;
    height: 42px;
    font-size: 17px;
  }

  .simulation-size-grid {
    grid-template-columns: 1fr;
  }

  .simulation-day-revenue strong {
    font-size: 26px;
  }

  #holidayTable tr {
    grid-template-columns: 1fr;
  }

  #holidayTable td.holiday-cell-actions {
    align-items: flex-start;
  }
}

.weekday-pills {
  display: grid;
  grid-template-columns: repeat(7, minmax(70px, 1fr));
  gap: 8px;
}

.weekday-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.weekday-pill.active {
  border-color: rgba(234, 88, 12, 0.35);
  background: rgba(234, 88, 12, 0.1);
  color: var(--ink);
}

.qty-input {
  min-width: 120px;
}

.tara-select {
  min-width: 110px;
}

.order-input {
  min-width: 120px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(26, 32, 28, 0.4);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(1200px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .weekday-pills {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }

  .unit-choice-row,
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .unit-picker-field {
    grid-column: auto;
  }

  .selected-wrap-inline {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .weekday-pills {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }
}
