:root {
  --bg: #f5f3ec;
  --surface: #ffffff;
  --surface-soft: #faf9f5;
  --surface-muted: #f0eee6;
  --sidebar: #173f2b;
  --sidebar-deep: #0f2e1f;
  --primary: #245b3b;
  --primary-strong: #173f2b;
  --primary-soft: #e3eee7;
  --accent: #c8902f;
  --accent-soft: #f7ecd8;
  --danger: #b8443c;
  --danger-soft: #fbe9e7;
  --warning: #9a6511;
  --warning-soft: #fff2d9;
  --info: #326a86;
  --info-soft: #e5f1f6;
  --text: #1c2922;
  --text-soft: #5f6d65;
  --text-faint: #8a958f;
  --border: #dedfd8;
  --border-strong: #c8cbc2;
  --shadow-sm: 0 1px 2px rgba(25, 47, 35, .06), 0 4px 18px rgba(25, 47, 35, .04);
  --shadow-md: 0 18px 45px rgba(18, 47, 31, .14);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar-width: 268px;
  --transition: 170ms ease;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% 8%, rgba(200, 144, 47, .07), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 28%),
    linear-gradient(155deg, var(--sidebar), var(--sidebar-deep));
  box-shadow: 10px 0 28px rgba(12, 35, 23, .09);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 25px; }
.brand-mark {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #f1c268;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
}
.brand-mark svg { width: 32px; height: 32px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .01em; }
.brand span { display: block; margin-top: 1px; color: rgba(255,255,255,.62); font-size: 12px; }

.nav-list { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: rgba(255,255,255,.72);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(2px); }
.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.08);
  box-shadow: inset 3px 0 0 #f1c268;
}
.nav-icon { width: 23px; text-align: center; font-size: 20px; line-height: 1; opacity: .95; }

.sidebar-footer { margin-top: auto; display: grid; gap: 16px; padding: 17px 8px 2px; }
.storage-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.055);
}
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #78d79b; box-shadow: 0 0 0 5px rgba(120,215,155,.12); }
.storage-indicator strong { display: block; font-size: 12px; }
.storage-indicator span:not(.status-dot) { display: block; margin-top: 1px; color: rgba(255,255,255,.55); font-size: 11px; }
.sidebar-footer small { color: rgba(255,255,255,.42); font-size: 11px; }

.main-column { width: calc(100% - var(--sidebar-width)); min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid rgba(189, 193, 181, .65);
  background: rgba(250, 249, 245, .86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar h1 { margin: 0; font-size: clamp(22px, 2vw, 28px); line-height: 1.15; letter-spacing: -.025em; }
.topbar p { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; }
.today-box { padding-right: 18px; border-right: 1px solid var(--border); text-align: right; }
.today-box span { display: block; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.today-box strong { display: block; margin-top: 1px; font-size: 13px; }
.mobile-menu { display: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }

.content { padding: clamp(22px, 3vw, 42px); max-width: 1640px; margin: 0 auto; outline: none; }
.page-stack { display: grid; gap: 22px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.page-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.page-heading p { margin: 5px 0 0; color: var(--text-soft); font-size: 13px; max-width: 700px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }

.primary-button, .secondary-button, .ghost-button, .danger-button, .icon-button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
}
.primary-button, .secondary-button, .ghost-button, .danger-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  font-weight: 700;
  font-size: 13px;
}
.primary-button { color: #fff; background: var(--primary); box-shadow: 0 7px 16px rgba(36,91,59,.17); }
.primary-button:hover { background: var(--primary-strong); transform: translateY(-1px); box-shadow: 0 9px 18px rgba(36,91,59,.22); }
.secondary-button { color: var(--primary); background: var(--primary-soft); }
.secondary-button:hover { background: #d8e8dd; }
.ghost-button { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.ghost-button:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.danger-button { color: var(--danger); background: var(--danger-soft); }
.danger-button:hover { background: #f7d9d6; }
.compact { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.small-button { min-height: 32px; padding: 5px 10px; font-size: 11px; border-radius: 8px; }
button:disabled { opacity: .48; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 17px;
}
.icon-button:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-soft); }
.icon-button.danger:hover { color: var(--danger); border-color: #ecc8c5; background: var(--danger-soft); }

.card {
  background: var(--surface);
  border: 1px solid rgba(207, 210, 200, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--text-soft); font-size: 12px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-soft); border-radius: 0 0 var(--radius) var(--radius); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { position: relative; overflow: hidden; min-height: 136px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-card::after { content: ""; position: absolute; width: 96px; height: 96px; right: -32px; bottom: -42px; border-radius: 50%; background: var(--primary-soft); }
.stat-card.accent::after { background: var(--accent-soft); }
.stat-card.info::after { background: var(--info-soft); }
.stat-card.warn::after { background: var(--warning-soft); }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stat-label { color: var(--text-soft); font-size: 12px; font-weight: 650; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 18px; }
.stat-card.accent .stat-icon { color: var(--warning); background: var(--accent-soft); }
.stat-card.info .stat-icon { color: var(--info); background: var(--info-soft); }
.stat-card.warn .stat-icon { color: var(--warning); background: var(--warning-soft); }
.stat-value { position: relative; z-index: 1; margin-top: 16px; font-size: clamp(23px, 2.2vw, 31px); font-weight: 800; line-height: 1; letter-spacing: -.035em; }
.stat-meta { position: relative; z-index: 1; margin-top: 8px; color: var(--text-faint); font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .75fr); gap: 18px; }
.dashboard-side { display: grid; gap: 18px; align-content: start; }

.batch-focus { padding: 22px; }
.batch-focus-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.batch-focus h3 { margin: 0; font-size: 18px; }
.batch-focus p { margin: 5px 0 0; color: var(--text-soft); font-size: 12px; }
.batch-dates { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.date-pill { padding: 7px 10px; border-radius: 9px; background: var(--surface-muted); color: var(--text-soft); font-size: 11px; }
.progress-row { margin-top: 20px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--text-soft); font-size: 11px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #4c8c66); }
.batch-focus-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }

.quick-actions { display: grid; gap: 9px; }
.quick-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.quick-action:hover { border-color: #aebeb3; background: var(--surface-soft); transform: translateY(-1px); }
.quick-action > .quick-action-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; margin: 0; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 16px; font-weight: 800; }
.quick-action > span:last-child { min-width: 0; }
.quick-action > span:last-child > strong { display: block; color: var(--text); font-size: 12px; }
.quick-action > span:last-child > span { display: block; margin-top: 2px; color: var(--text-faint); font-size: 10px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--text-faint); background: var(--surface-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
td { font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(248, 248, 244, .72); }
.cell-main { display: block; font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; color: var(--text-faint); font-size: 10px; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.number-cell { text-align: right; font-variant-numeric: tabular-nums; }

.badge, .phase-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge { color: var(--text-soft); background: var(--surface-muted); }
.phase-badge { color: var(--primary); background: var(--primary-soft); }
.phase-badge.grower1 { color: #6e5c11; background: #f3edcf; }
.phase-badge.grower2 { color: #8c4c1c; background: #f6e4d6; }
.phase-badge.finisher { color: #385e82; background: #e2edf6; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { color: #297348; background: #e1f2e7; }
.status-planned { color: #326a86; background: #e5f1f6; }
.status-finished { color: #68716c; background: #eceeea; }
.status-archived { color: #8a6a34; background: #f4ead9; }

.filters-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255,255,255,.68); }
.filters-bar .form-field { min-width: 180px; flex: 1 1 180px; }
.filters-bar .form-field.search { flex: 2 1 260px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: var(--text-soft); font-size: 11px; font-weight: 750; }
.required::after { content: " *"; color: var(--danger); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-field textarea { min-height: 86px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #6e9880; box-shadow: 0 0 0 4px rgba(36,91,59,.1); }
.form-field input:disabled, .form-field select:disabled { background: var(--surface-muted); color: var(--text-faint); }
.field-help { color: var(--text-faint); font-size: 10px; }
.field-error { color: var(--danger); font-size: 10px; }

.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.inline-form .form-field { flex: 1 1 210px; }
.inline-form .form-field.narrow { flex: 0 1 150px; }

.empty-state { display: grid; place-items: center; min-height: 250px; padding: 38px 20px; text-align: center; }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 20px; color: var(--primary); background: var(--primary-soft); font-size: 28px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { max-width: 480px; margin: 7px auto 18px; color: var(--text-soft); font-size: 12px; }

.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.recipe-card { display: flex; flex-direction: column; min-height: 295px; overflow: hidden; }
.recipe-card.archived { opacity: .72; }
.recipe-card-top { padding: 18px 18px 13px; }
.recipe-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recipe-card h3 { margin: 10px 0 0; font-size: 16px; }
.recipe-card-note { min-height: 36px; margin: 6px 0 0; color: var(--text-soft); font-size: 11px; }
.recipe-total { margin-top: 15px; padding: 11px 12px; border-radius: 10px; background: var(--surface-soft); }
.recipe-total span { display: block; color: var(--text-faint); font-size: 10px; }
.recipe-total strong { display: block; margin-top: 2px; font-size: 18px; }
.composition-list { display: grid; gap: 8px; padding: 4px 18px 16px; }
.composition-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 11px; }
.composition-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.composition-row strong { font-variant-numeric: tabular-nums; }
.composition-bar { grid-column: 1 / -1; height: 4px; margin-top: -4px; overflow: hidden; border-radius: 99px; background: var(--surface-muted); }
.composition-bar > span { display: block; height: 100%; border-radius: inherit; background: #88a995; }
.recipe-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface-soft); }

.batch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.batch-card { padding: 18px; }
.batch-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.batch-card h3 { margin: 0; font-size: 16px; }
.batch-card p { min-height: 32px; margin: 5px 0 0; color: var(--text-soft); font-size: 11px; }
.batch-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.meta-box { padding: 10px; border-radius: 10px; background: var(--surface-soft); }
.meta-box span { display: block; color: var(--text-faint); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.meta-box strong { display: block; margin-top: 3px; font-size: 12px; }
.batch-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--border); }

.production-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(340px, .55fr); gap: 18px; align-items: start; }
.production-form-card { position: sticky; top: 110px; }
.production-preview { display: grid; gap: 10px; }
.preview-summary { padding: 13px; border-radius: 11px; background: var(--primary-soft); }
.preview-summary span { display: block; color: var(--text-soft); font-size: 10px; }
.preview-summary strong { display: block; margin-top: 3px; color: var(--primary-strong); font-size: 19px; }
.preview-ingredient { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 11px; }
.preview-ingredient:last-child { border-bottom: 0; }
.preview-ingredient span { color: var(--text-soft); }
.preview-ingredient strong { font-variant-numeric: tabular-nums; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

.report-filter-grid { display: grid; grid-template-columns: 2fr repeat(2, 1fr) auto; align-items: end; gap: 12px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .65fr); gap: 18px; }
.report-side { display: grid; gap: 18px; align-content: start; }
.breakdown-list { display: grid; gap: 12px; }
.breakdown-item { display: grid; gap: 6px; }
.breakdown-top { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; }
.breakdown-top span { color: var(--text-soft); }
.breakdown-top strong { font-variant-numeric: tabular-nums; }
.breakdown-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.breakdown-track > span { display: block; height: 100%; border-radius: inherit; background: #71947d; }
.report-note { padding: 12px 14px; border: 1px solid #ead6ae; border-radius: 10px; color: #71511d; background: #fff8e8; font-size: 11px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-card { min-height: 330px; }
.config-list { display: grid; gap: 7px; }
.config-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.config-item-main { min-width: 0; }
.config-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.config-item span { display: block; margin-top: 1px; color: var(--text-faint); font-size: 9px; }
.config-actions { display: flex; align-items: center; gap: 5px; }
.backup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.backup-action { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.backup-action h4 { margin: 0; font-size: 12px; }
.backup-action p { min-height: 42px; margin: 5px 0 12px; color: var(--text-soft); font-size: 10px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 28, 19, .58);
  backdrop-filter: blur(4px);
  animation: fadeIn 140ms ease;
}
.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: modalIn 180ms ease;
}
.modal.large { width: min(920px, 100%); }
.modal.small { width: min(480px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-header p { margin: 4px 0 0; color: var(--text-soft); font-size: 11px; }
.modal-close { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 19px; }
.modal-body { overflow-y: auto; padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--border); background: var(--surface-soft); }

.ingredient-editor { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ingredient-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.ingredient-editor-head strong { font-size: 12px; }
.ingredient-rows { display: grid; }
.ingredient-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 36px; align-items: end; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.ingredient-row:last-child { border-bottom: 0; }
.recipe-sum { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--primary-strong); background: var(--primary-soft); }
.recipe-sum span { font-size: 11px; }
.recipe-sum strong { font-size: 13px; font-variant-numeric: tabular-nums; }

.confirm-message { color: var(--text-soft); font-size: 13px; }
.confirm-message strong { color: var(--text); }

.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 9px; pointer-events: none; }
.toast { min-width: 260px; max-width: 410px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.45); border-radius: 11px; color: #fff; background: #233a2e; box-shadow: 0 12px 30px rgba(17, 37, 26, .22); font-size: 12px; animation: toastIn 180ms ease; }
.toast.success { background: #245b3b; }
.toast.error { background: #9d3933; }
.toast.warning { background: #8a5c13; }
.toast.removing { opacity: 0; transform: translateY(8px); transition: 180ms ease; }

.notice { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-soft); background: var(--surface-soft); font-size: 11px; }
.notice.info { color: #245d78; border-color: #c7dce6; background: var(--info-soft); }
.notice.warning { color: #765318; border-color: #ead6ae; background: #fff8e8; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(11,28,19,.42); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1260px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-grid, .batch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-filter-grid .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .sidebar { transform: translateX(-102%); transition: transform 220ms ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .main-column { width: 100%; margin-left: 0; }
  .mobile-menu { display: grid; place-items: center; }
  .dashboard-grid, .production-layout, .report-grid { grid-template-columns: 1fr; }
  .production-form-card { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { min-height: 72px; padding: 12px 15px; }
  .topbar p, .today-box { display: none; }
  .topbar-right .primary-button { display: none; }
  .content { padding: 18px 14px 30px; }
  .page-heading { flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .stats-grid, .recipe-grid, .batch-grid, .form-grid, .form-grid.three, .backup-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 118px; }
  .report-filter-grid { grid-template-columns: 1fr; }
  .report-filter-grid .filter-actions { grid-column: auto; }
  .modal-overlay { align-items: end; padding: 0; }
  .modal, .modal.large, .modal.small { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .ingredient-row { grid-template-columns: 1fr 110px 36px; }
  .batch-focus-top { flex-direction: column; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 460px) {
  .ingredient-row { grid-template-columns: 1fr 36px; }
  .ingredient-row .qty-field { grid-column: 1 / 2; }
  .ingredient-row .remove-field { grid-column: 2 / 3; grid-row: 1 / 3; align-self: center; }
  .card-header, .card-body { padding-left: 15px; padding-right: 15px; }
  th, td { padding-left: 10px; padding-right: 10px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .page-heading, .filters-bar, .report-filter-card, .no-print, .toast-container { display: none !important; }
  .main-column { width: 100%; margin: 0; }
  .content { max-width: none; padding: 0; }
  .card, .stat-card { box-shadow: none; break-inside: avoid; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
}

/* ========================================================================== */
/* FERMA DROBIU UJAZD — jasna szata graficzna v0.2                           */
/* ========================================================================== */

:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --surface-muted: #eef2ec;
  --sidebar: #ffffff;
  --sidebar-deep: #ffffff;
  --primary: #4b9938;
  --primary-strong: #367d27;
  --primary-soft: #edf6e9;
  --accent: #6eaf4f;
  --accent-soft: #f0f8ec;
  --danger: #b7463e;
  --danger-soft: #fbeceb;
  --warning: #986513;
  --warning-soft: #fff5df;
  --info: #417b90;
  --info-soft: #edf5f8;
  --text: #222722;
  --text-soft: #687068;
  --text-faint: #929992;
  --border: #e1e6df;
  --border-strong: #cfd7cd;
  --shadow-sm: 0 2px 8px rgba(28, 45, 28, .045), 0 12px 26px rgba(28, 45, 28, .035);
  --shadow-md: 0 20px 56px rgba(25, 38, 25, .16);
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 15px;
  --sidebar-width: 238px;
  --transition: 160ms ease;
}

[hidden] { display: none !important; }

html { background: #f4f7f3; }
body {
  background:
    radial-gradient(circle at 92% 1%, rgba(92, 164, 69, .055), transparent 31rem),
    var(--bg);
  color: var(--text);
}

body::selection { background: #dcefd4; }

/* Logowanie */
.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 42px 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,247,.94)),
    repeating-linear-gradient(90deg, rgba(67, 119, 54, .025) 0 1px, transparent 1px 58px);
}
.login-view::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 33vh;
  min-height: 230px;
  opacity: .48;
  background:
    linear-gradient(180deg, transparent, rgba(211, 226, 205, .45)),
    linear-gradient(12deg, rgba(83, 137, 67, .14) 0 18%, transparent 18% 100%);
  clip-path: polygon(0 43%, 12% 35%, 24% 46%, 37% 25%, 49% 39%, 62% 22%, 74% 42%, 86% 26%, 100% 40%, 100% 100%, 0 100%);
}
.login-ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}
.login-ambient-one {
  width: 520px;
  height: 520px;
  left: -235px;
  top: -245px;
  background: radial-gradient(circle, rgba(91, 160, 68, .11), rgba(91, 160, 68, 0) 69%);
}
.login-ambient-two {
  width: 560px;
  height: 560px;
  right: -260px;
  bottom: -280px;
  background: radial-gradient(circle, rgba(75, 153, 56, .09), rgba(75, 153, 56, 0) 70%);
}
.login-panel {
  position: relative;
  z-index: 2;
  width: min(460px, 100%);
  display: grid;
  justify-items: stretch;
  gap: 28px;
}
.login-brand {
  display: grid;
  place-items: center;
  min-height: 98px;
}
.login-brand img {
  width: min(350px, 88vw);
  height: auto;
  display: block;
}
.login-card {
  padding: 30px 32px 27px;
  border: 1px solid #dce2da;
  border-radius: 12px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 20px 55px rgba(34, 52, 34, .11), 0 2px 8px rgba(34,52,34,.05);
}
.login-card-heading { margin-bottom: 22px; text-align: center; }
.login-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.login-card h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.login-card-heading p { margin: 7px auto 0; max-width: 330px; color: var(--text-soft); font-size: 12px; }
.login-card form { display: grid; gap: 16px; }
.login-card .form-field > span:first-child {
  color: #3e443e;
  font-size: 12px;
  font-weight: 700;
}
.login-card .required { color: var(--danger); font-style: normal; }
.login-card .required::after { content: none; }
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon > svg {
  position: absolute;
  left: 13px;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: #6c746c;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.login-card .input-with-icon input {
  min-height: 48px;
  padding-left: 43px;
  padding-right: 44px;
  border-radius: 7px;
  background: #fff;
}
.password-toggle {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #6c746c;
  background: transparent;
  cursor: pointer;
}
.password-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.login-submit { width: 100%; min-height: 47px; margin-top: 2px; border-radius: 7px; font-size: 14px; }
.login-error {
  padding: 10px 12px;
  border: 1px solid #efc7c3;
  border-radius: 7px;
  color: #9d3731;
  background: #fff1ef;
  font-size: 11px;
}
.login-no-registration {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.45;
  text-align: left;
}
.login-no-registration svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  fill: none;
  stroke: #7d857d;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.login-no-registration strong { color: #505750; }
.demo-credentials {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px dashed #c9dcc3;
  border-radius: 7px;
  color: #577052;
  background: #f5faf3;
  font-size: 10px;
}
.demo-credentials span { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.demo-credentials strong { color: #35562e; font-size: 10.5px; }
.login-footer { color: #8a918a; font-size: 10px; text-align: center; }

/* Główna aplikacja */
.app-shell { min-height: 100vh; background: var(--bg); }
.sidebar {
  width: var(--sidebar-width);
  padding: 0 12px 16px;
  color: var(--text);
  background: rgba(255,255,255,.98);
  border-right: 1px solid var(--border);
  box-shadow: 7px 0 24px rgba(28, 45, 28, .035);
}
.brand {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: 15px 12px 13px;
  border-bottom: 1px solid var(--border);
}
.brand-logo { width: 190px; height: auto; display: block; }
.nav-list { gap: 4px; padding-top: 18px; }
.nav-item {
  min-height: 43px;
  gap: 11px;
  padding: 9px 12px;
  color: #404740;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
}
.nav-item:hover {
  color: var(--primary-strong);
  background: #f4f8f2;
  transform: none;
}
.nav-item.active {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}
.nav-settings { position: relative; }
.nav-caret {
  width: 17px;
  height: 17px;
  margin-left: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.settings-subnav {
  position: relative;
  display: grid;
  gap: 1px;
  margin: 2px 0 5px 21px;
  padding: 4px 0 3px 17px;
}
.settings-subnav::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 4px;
  width: 1px;
  background: #dce4d9;
}
.settings-subitem {
  position: relative;
  min-height: 31px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: #727972;
  background: transparent;
  text-align: left;
  font-size: 11.5px;
  cursor: pointer;
}
.settings-subitem::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 9px;
  height: 1px;
  background: #dce4d9;
}
.settings-subitem:hover { color: var(--primary-strong); background: #f5f8f3; }
.settings-subitem.active { color: var(--primary-strong); background: var(--primary-soft); font-weight: 750; }
.sidebar-footer { gap: 12px; padding: 16px 4px 0; }
.storage-indicator {
  padding: 11px;
  border: 1px solid #dde6da;
  border-radius: 8px;
  background: #f7faf6;
}
.status-dot { background: #65b44d; box-shadow: 0 0 0 4px rgba(101,180,77,.12); }
.storage-indicator strong { color: #434943; }
.storage-indicator span:not(.status-dot) { color: #8a918a; }
.sidebar-footer small { color: #9aa09a; }

.main-column { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); }
.topbar {
  min-height: 84px;
  padding: 13px clamp(20px, 2.6vw, 38px);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.94);
  box-shadow: 0 3px 16px rgba(29, 47, 29, .025);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: clamp(20px, 1.8vw, 25px); }
.topbar p { margin-top: 3px; color: #858c85; }
.today-box { border-right-color: var(--border); }
.today-box span { color: #a0a6a0; }
.topbar-icon,
.logout-button,
.mobile-menu {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #444b44;
  background: #fff;
  cursor: pointer;
}
.topbar-icon:hover,
.logout-button:hover,
.mobile-menu:hover { color: var(--primary); border-color: #c9d9c5; background: #f7faf5; }
.topbar-icon svg,
.logout-button svg,
.mobile-menu svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-menu { display: none; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 4px;
}
.user-avatar {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #b7d5ae;
  border-radius: 50%;
  color: var(--primary);
  background: #f3faf0;
}
.user-avatar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.user-details { min-width: 105px; }
.user-details strong { display: block; font-size: 12px; line-height: 1.2; }
.user-details small { display: block; margin-top: 2px; color: #8b928b; font-size: 9.5px; }
.logout-button { width: 34px; height: 34px; margin-left: 1px; border-color: transparent; }
.logout-button svg { width: 18px; height: 18px; }

.content { max-width: 1550px; padding: clamp(22px, 2.7vw, 38px); }
.page-stack { gap: 19px; }
.page-heading h2 { font-size: 19px; }
.page-heading p { color: #7d857d; }

.primary-button { background: linear-gradient(180deg, #55a840, #459334); box-shadow: 0 7px 15px rgba(68, 145, 51, .16); }
.primary-button:hover { background: linear-gradient(180deg, #4d9f39, #3d852e); box-shadow: 0 9px 18px rgba(68,145,51,.22); }
.secondary-button { color: var(--primary-strong); background: var(--primary-soft); }
.secondary-button:hover { background: #e3f1de; }
.ghost-button { border-color: var(--border-strong); }
.icon-button { border-radius: 7px; }

.card,
.stat-card {
  border-color: #dfe5dd;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.card-header { padding: 16px 18px; background: #fff; }
.card-header h3 { font-size: 14px; letter-spacing: -.005em; }
.card-body { padding: 18px; }
.card-footer { background: #fafcf9; }

.stats-grid { gap: 13px; }
.stat-card { min-height: 126px; padding: 18px; }
.stat-card::after { opacity: .65; }
.stat-icon { border-radius: 8px; }
.stat-value { margin-top: 14px; font-size: clamp(22px, 2vw, 28px); }

th { color: #697169; background: #f7f9f6; }
tbody tr:hover td { background: #fafcf9; }
.form-field input,
.form-field select,
.form-field textarea { border-radius: 7px; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: #78ad68; box-shadow: 0 0 0 3px rgba(75,153,56,.11); }
.filters-bar { background: rgba(255,255,255,.9); }
.quick-action { border-radius: 8px; }
.quick-action:hover { border-color: #c7d9c2; }
.empty-icon { border-radius: 14px; }

/* Ustawienia jako jedna sekcja z podstronami */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.settings-tab {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  color: #6d756d;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.settings-tab:hover { color: var(--primary-strong); background: #f5f9f3; }
.settings-tab.active { color: var(--primary-strong); background: var(--primary-soft); }
.settings-single { display: grid; grid-template-columns: minmax(0, 880px); }
.settings-single .settings-card { min-height: 0; }
.settings-section-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .46fr); gap: 18px; align-items: start; }
.settings-logo-preview {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 18px;
  border: 1px dashed #ccd9c8;
  border-radius: 9px;
  background: #fbfdfb;
}
.settings-logo-preview img { width: min(350px, 100%); height: auto; }
.user-admin-note { display: grid; gap: 12px; }
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.user-row-main { display: flex; align-items: center; gap: 11px; }
.user-row-avatar {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 800;
}
.user-row strong { display: block; font-size: 12px; }
.user-row small { display: block; margin-top: 2px; color: var(--text-faint); font-size: 10px; }
.code-path {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  color: #2f5d29;
  background: #eaf4e7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}
.company-form .form-actions { justify-content: flex-start; }

.modal-overlay { background: rgba(34, 43, 34, .46); }
.modal { border-radius: 13px; }
.toast.success { background: #3f8d31; }
.sidebar-backdrop { background: rgba(34,43,34,.33); }

@media (max-width: 1100px) {
  .settings-section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .sidebar { box-shadow: 12px 0 35px rgba(28,45,28,.13); }
  .main-column { width: 100%; margin-left: 0; }
  .mobile-menu { display: grid; }
}

@media (max-width: 720px) {
  .login-view { padding: 24px 14px; }
  .login-panel { gap: 19px; }
  .login-brand { min-height: 74px; }
  .login-brand img { width: min(305px, 89vw); }
  .login-card { padding: 24px 20px 21px; }
  .demo-credentials { align-items: flex-start; flex-direction: column; gap: 3px; }
  .topbar-icon, .user-details, .today-box { display: none; }
  .user-chip { gap: 4px; }
  .settings-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .settings-tab { white-space: nowrap; }
}

@media (max-width: 460px) {
  .login-card h1 { font-size: 19px; }
  .login-card-heading p { font-size: 11px; }
  .login-no-registration { justify-content: flex-start; }
  .brand-logo { width: 180px; }
  .sidebar { width: min(86vw, 268px); }
  .user-avatar { width: 34px; height: 34px; }
  .logout-button { width: 32px; height: 32px; }
}

@media print {
  .login-view { display: none !important; }
  .settings-tabs { display: none !important; }
}
