:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef5f1;
  --text: #17211b;
  --muted: #64736a;
  --line: #d8e2dc;
  --green: #1f7a4d;
  --green-2: #dff1e6;
  --blue: #256f9c;
  --blue-2: #e0f0f8;
  --amber: #a66500;
  --amber-2: #fff0cc;
  --red: #a43a35;
  --red-2: #ffe4e1;
  --ink-soft: #2d3b32;
  --shadow: 0 10px 30px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input,
textarea {
  min-width: 0;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 800;
}

h2 {
  font-size: 24px;
  font-weight: 800;
}

h3 {
  font-size: 16px;
  font-weight: 750;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compact-field,
.search-field,
.data-form label,
.import-zone label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-field select,
.search-field input,
.data-form input,
.data-form select,
.data-form textarea,
.import-zone input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.compact-field select:focus,
.search-field input:focus,
.data-form input:focus,
.data-form select:focus,
.data-form textarea:focus,
.import-zone input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.12);
}

.compact-field {
  min-width: 150px;
}

.search-field {
  width: min(330px, 100%);
}

.view-stack {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 16px;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.plain-select {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.analysis-filters {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  width: min(720px, 100%);
}

.analysis-filters.compact {
  width: min(680px, 100%);
}

.analysis-filters label,
.producer-filter-group {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.producer-select {
  position: relative;
}

.producer-select summary {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 9px 36px 9px 10px;
  font-size: 13px;
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.producer-select summary::-webkit-details-marker {
  display: none;
}

.producer-select summary::after {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--muted);
  content: "⌄";
}

.producer-select[open] summary {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.12);
}

.producer-filter {
  position: absolute;
  z-index: 25;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 6px;
  width: min(420px, 88vw);
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  box-shadow: var(--shadow);
}

.producer-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border-radius: 8px;
  padding: 8px;
  color: var(--ink-soft);
  cursor: pointer;
}

.producer-option:hover,
.producer-option:has(input:checked) {
  background: var(--green-2);
}

.producer-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--green);
}

.producer-option span {
  display: grid;
  gap: 2px;
}

.producer-option strong {
  color: var(--green);
  font-size: 14px;
}

.producer-option small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

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

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

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

.mini-heading h4 {
  margin: 0;
  font-size: 15px;
}

.receipt-chart-stack {
  display: grid;
  gap: 16px;
}

.receipt-chart-stack h5 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 3px;
}

.segmented-control button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 850;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 1px 5px rgba(23, 33, 27, 0.1);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.forms-first {
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

.data-form {
  display: grid;
  gap: 13px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

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

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.danger-button,
.bell-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: normal;
}

.primary-button {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--green);
}

.ghost-button {
  min-height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--blue);
  padding: 6px 9px;
}

.icon-button {
  border: 1px solid var(--green);
  background: var(--green-2);
  color: var(--green);
}

.bell-button {
  position: relative;
  width: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 8px;
}

.bell-count {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 20px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.2;
}

.danger-button {
  min-height: 32px;
  border: 1px solid var(--red-2);
  background: var(--red-2);
  color: var(--red);
  padding: 6px 9px;
}

.table-panel {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.muted,
.helper-text {
  color: var(--muted);
}

.helper-text {
  margin-top: 12px;
  font-size: 13px;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
}

.pill.green,
.status-badge.online {
  background: var(--green-2);
  color: var(--green);
}

.pill.blue,
.status-badge.neutral {
  background: var(--blue-2);
  color: var(--blue);
}

.pill.amber,
.status-badge.pending {
  background: var(--amber-2);
  color: var(--amber);
}

.pill.red,
.status-badge.offline {
  background: var(--red-2);
  color: var(--red);
}

.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.stack-list.compact {
  gap: 8px;
}

.list-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px;
}

.list-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-item strong {
  min-width: 0;
}

.list-item p {
  color: var(--muted);
  font-size: 13px;
}

.bar-chart {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.bar-track {
  height: 11px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.metric-bar,
.evolution-row {
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.5fr) minmax(86px, auto);
}

.evolution-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.line-chart {
  min-height: 230px;
  overflow: hidden;
}

.compact-line {
  min-height: 210px;
}

.column-chart {
  min-height: 230px;
  overflow: hidden;
}

.column-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.column-chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.line-chart.tall {
  min-height: 270px;
}

.line-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.line-chart text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend span::before {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--legend);
  content: "";
}

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

.list-item.selected {
  border-color: var(--green);
  background: var(--green-2);
}

.sync-panel {
  background: var(--surface-2);
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.sync-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--amber);
}

.sync-dot.online {
  background: var(--green);
}

.sync-dot.offline {
  background: var(--red);
}

.sync-status {
  margin-top: 10px;
  color: var(--muted);
}

.sync-facts {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.sync-facts div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sync-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sync-facts dd {
  margin: 0;
  font-weight: 850;
}

.hidden {
  display: none !important;
}

.floating-panel {
  position: fixed;
  top: 82px;
  right: 18px;
  z-index: 50;
  width: min(390px, calc(100vw - 36px));
  max-height: calc(100dvh - 112px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.floating-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 27, 0.4);
  padding: 18px;
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-zone {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #16231b;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .inspector {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .chart-grid,
  .chart-grid.wide,
  .split-grid,
  .forms-first,
  .inspector {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .analysis-filters,
  .analysis-filters.compact {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .form-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 56px minmax(0, 1fr) 54px;
  }
}


.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}

.account-chip #accountEmail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}




.check-field {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex-direction: row !important;
}

.check-field input {
  width: auto;
}

.steps {
  margin: 0;
  padding-left: 20px;
}

.user-admin-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.farm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.05em;
}

.farm-settings {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
