/* Coop — Poultry Farm Management — Design tokens from farm-app.html */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --pine: #1e3a2b;
  --pine-900: #152a1f;
  --moss: #2f5e43;
  --yolk: #f5b301;
  --yolk-soft: #fce9ae;
  --paper: #f3f1e9;
  --card: #ffffff;
  --line: #e5e1d5;
  --ink: #1b231b;
  --muted: #6a7268;
  --muted-2: #8b9186;
  --clay: #b4633a;
  --good: #2e8b57;
  --warn: #c4772a;
  --bad: #be4636;
  --r: 14px;
  --shadow:
    0 1px 2px rgba(26, 42, 31, 0.04), 0 8px 24px -14px rgba(26, 42, 31, 0.18);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
h1,
h2,
h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  line-height: 1.08;
  letter-spacing: -0.01em;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
:focus-visible {
  outline: 2px solid var(--yolk);
  outline-offset: 2px;
  border-radius: 4px;
}
a {
  color: var(--moss);
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}
.side {
  background: var(--pine);
  color: #dfe7de;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 22px;
}
.brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--yolk);
  display: grid;
  place-items: center;
  flex: none;
}
.brand .wm {
  font-family: "Bricolage Grotesque";
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.02em;
}
.brand .by {
  font-family: "IBM Plex Mono";
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: #8fa593;
  text-transform: uppercase;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.nav .lbl {
  font-family: "IBM Plex Mono";
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7e9583;
  padding: 14px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  color: #c8d3c6;
  font-size: 14px;
  font-weight: 500;
  transition:
    background 0.15s,
    color 0.15s;
  position: relative;
}
.nav a svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.85;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav a.on {
  background: var(--pine-900);
  color: #fff;
}
.nav a.on::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yolk);
  position: absolute;
  left: -2px;
}
.side .foot {
  margin-top: auto;
  padding: 12px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.side .foot .av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--moss);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex: none;
}
.side .foot .nm {
  font-size: 13px;
  color: #eaf0e9;
  font-weight: 500;
}
.side .foot .rl {
  font-size: 11px;
  color: #8fa593;
}

.main {
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 34px 20px;
  flex-wrap: wrap;
}
.topbar .ttl h1 {
  font-size: 27px;
  font-weight: 700;
}
.topbar .ttl .eyebrow {
  margin-bottom: 7px;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  transition:
    transform 0.1s,
    filter 0.15s;
  text-decoration: none;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--yolk);
  color: #3a2c00;
}
.btn-primary:hover {
  filter: brightness(1.04);
}
.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.view {
  padding: 0 34px 48px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.pad {
  padding: 20px;
}
.grid {
  display: grid;
  gap: 18px;
}
.hero-row {
  grid-template-columns: 1fr 1.15fr;
}
.kpis {
  grid-template-columns: repeat(4, 1fr);
}
.cols-2 {
  grid-template-columns: 1.25fr 1fr;
}
.cols-2b {
  grid-template-columns: 1fr 1fr;
}

.hero {
  padding: 24px 26px;
}
.hero .num {
  font-family: "Bricolage Grotesque";
  font-weight: 800;
  font-size: 64px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--pine);
  margin: 10px 0 2px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "IBM Plex Mono";
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e7f0e7;
  color: #2c6b41;
}
.hero .split {
  display: flex;
  gap: 26px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.hero .split .k {
  font-family: "IBM Plex Mono";
  font-size: 18px;
  font-weight: 600;
}
.hero .split .kl {
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.03em;
  margin-top: 2px;
}

.alloc {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
}
.stack {
  display: flex;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  margin: 6px 0 18px;
  background: #ede9dc;
}
.stack .seg {
  height: 100%;
  transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.legend .row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.legend .sw {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: none;
}
.legend .nm {
  flex: 1;
}
.legend .vl {
  font-family: "IBM Plex Mono";
  font-weight: 600;
}
.legend .pc {
  font-family: "IBM Plex Mono";
  color: var(--muted-2);
  font-size: 12px;
  width: 44px;
  text-align: right;
}

.kpi {
  padding: 17px 18px;
}
.kpi .lbl {
  font-family: "IBM Plex Mono";
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 7px;
}
.kpi .lbl .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.kpi .v {
  font-family: "Bricolage Grotesque";
  font-weight: 700;
  font-size: 29px;
  margin-top: 11px;
  letter-spacing: -0.02em;
}
.kpi .d {
  font-size: 12px;
  margin-top: 5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.up {
  color: var(--good);
}
.down {
  color: var(--bad);
}

.sh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sh h3 {
  font-size: 16px;
  font-weight: 600;
}
.sh .lnk {
  font-family: "IBM Plex Mono";
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--moss);
  text-transform: uppercase;
  cursor: pointer;
}
.add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3a2c00;
  background: var(--yolk);
  padding: 7px 13px;
  border-radius: 9px;
  text-decoration: none;
}
.add svg {
  width: 14px;
  height: 14px;
}
.add:hover {
  filter: brightness(1.04);
}
.add.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.headrow {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 150px;
  padding-top: 6px;
}
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.bar .col {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--moss), var(--pine));
  transition: height 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar .col.hl {
  background: linear-gradient(180deg, var(--yolk), #e0a000);
}
.bar .dl {
  font-family: "IBM Plex Mono";
  font-size: 10px;
  color: var(--muted-2);
}
.bar .vv {
  font-family: "IBM Plex Mono";
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.hbars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hbars .row {
  display: grid;
  grid-template-columns: 96px 1fr 76px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.hbars .track {
  height: 12px;
  background: #ede9dc;
  border-radius: 6px;
  overflow: hidden;
}
.hbars .fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.hbars .vl {
  font-family: "IBM Plex Mono";
  font-weight: 600;
  text-align: right;
}

.collect-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
}
.collect-strip .big {
  font-family: "Bricolage Grotesque";
  font-weight: 800;
  font-size: 48px;
  color: var(--pine);
  line-height: 1;
}
.crate {
  flex: none;
  background: #faf7ee;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.crate .cap {
  font-family: "IBM Plex Mono";
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  margin-bottom: 9px;
}
.egggrid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.cell {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ede7d6;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.06);
}
.cell.f {
  background: radial-gradient(circle at 38% 32%, #ffdd73, var(--yolk) 68%);
  box-shadow: inset 0 -2px 3px rgba(140, 90, 0, 0.22);
}

table {
  width: 100%;
  border-collapse: collapse;
}
th {
  font-family: "IBM Plex Mono";
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}
td {
  padding: 13px 14px;
  border-bottom: 1px solid #f0ede3;
  font-size: 13.5px;
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.12s;
}
tbody tr:hover {
  background: #faf8f1;
}
.row-clickable {
  cursor: pointer;
}
.row-clickable:hover {
  background: #f6f3e5;
}
.num {
  font-family: "IBM Plex Mono";
  font-variant-numeric: tabular-nums;
}
.tr-name {
  font-weight: 600;
}
.muted {
  color: var(--muted);
}
tfoot td {
  border-top: 2px solid var(--line);
  font-weight: 600;
  border-bottom: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono";
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag-layer {
  background: #e7f0e7;
  color: #2c6b41;
}
.tag-broiler {
  background: #f6e7dc;
  color: var(--clay);
}
.tag-med {
  background: #fbefd3;
  color: #9a6c13;
}

.flocks {
  grid-template-columns: repeat(3, 1fr);
}
.flock {
  padding: 18px;
}
.flock .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.flock h3 {
  font-size: 16px;
  font-weight: 600;
}
.flock .coop {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.flock .stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid #f0ede3;
  font-size: 13px;
}
.flock .stat .sv {
  font-family: "IBM Plex Mono";
  font-weight: 600;
}
.pop {
  height: 6px;
  border-radius: 4px;
  background: #ede9dc;
  overflow: hidden;
  margin-top: 12px;
}
.pop i {
  display: block;
  height: 100%;
  background: var(--moss);
  border-radius: 4px;
}

.li {
  padding: 9px 14px 9px 32px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid #f0ede3;
  display: flex;
  justify-content: space-between;
}
.li:last-child {
  border-bottom: none;
}
.row-parent {
  cursor: pointer;
}
.row-parent .chev {
  transition: transform 0.15s;
  display: inline-block;
  color: var(--muted-2);
}
.row-parent.open .chev {
  transform: rotate(90deg);
}

.form {
  display: grid;
  gap: 12px;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: "IBM Plex Mono";
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.field input,
.field select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: "IBM Plex Mono";
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--yolk);
  box-shadow: 0 0 0 3px var(--yolk-soft);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 42, 31, 0.42);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 50;
  overflow-y: auto;
}
.overlay.on {
  display: flex;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 580px;
  animation: pop 0.18s ease;
}
@keyframes pop {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  font-size: 17px;
}
.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}
.iconbtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.iconbtn:hover {
  border-color: #cdc8b8;
  color: var(--ink);
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.items {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.item-row {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.item-row select,
.item-row input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "IBM Plex Mono";
  font-size: 12.5px;
  background: #fff;
  width: 100%;
}
.item-row .rm {
  width: 32px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--bad);
  display: grid;
  place-items: center;
}
.item-row .rm:hover {
  background: #f7e1dd;
}
.addline {
  align-self: flex-start;
  font-family: "IBM Plex Mono";
  font-size: 12px;
  color: var(--moss);
  font-weight: 600;
}
.modal-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.modal-total .tv {
  font-family: "Bricolage Grotesque";
  font-weight: 700;
  font-size: 22px;
  color: var(--pine);
}

/* Flash messages */
.flash {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flash .msg {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.25s ease;
}
.flash .msg.success {
  background: #e7f0e7;
  color: #2c6b41;
  border: 1px solid #b8d4b8;
}
.flash .msg.error {
  background: #fce4e4;
  color: #be4636;
  border: 1px solid #f5c2c2;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* Validation */
.field .error {
  font-size: 11px;
  color: var(--bad);
  margin-top: 2px;
}
.input-validation-error {
  border-color: var(--bad) !important;
}

.hide-sm {
  display: block;
}
@media (max-width: 920px) {
  .app {
    grid-template-columns: 1fr;
  }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    overflow-x: auto;
    gap: 6px;
  }
  .side .brand {
    padding: 0 14px 0 4px;
  }
  .side .brand .by {
    display: none;
  }
  .nav {
    flex-direction: row;
    gap: 2px;
    margin: 0;
  }
  .nav .lbl,
  .side .foot {
    display: none;
  }
  .nav a {
    white-space: nowrap;
    padding: 8px 12px;
  }
  .nav a span {
    display: none;
  }
  .nav a.on::before {
    display: none;
  }
  .hero-row,
  .kpis,
  .cols-2,
  .cols-2b,
  .flocks,
  .grid2 {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
  }
  .item-row {
    grid-template-columns: 1.5fr 1fr auto;
  }
  .topbar,
  .view {
    padding-left: 18px;
    padding-right: 18px;
  }
  .hide-sm {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 20, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: 0 24px 64px rgba(20, 30, 20, 0.3);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease-out;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover {
  background: #f0ede3;
  color: var(--ink);
}
.modal .form {
  padding: 16px 22px 22px;
}
@@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Icon button ── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-icon:hover {
  background: #f0ede3;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--pine);
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(20, 30, 20, 0.22);
  z-index: 2000;
  animation: toastIn 0.3s ease-out;
}
.toast-err {
  background: var(--bad);
}
@@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  background: #f4f2eb;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
  width: fit-content;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted-2);
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  position: relative;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}
.tab-btn.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.tab-btn svg {
  flex-shrink: 0;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
