:root {
  color-scheme: dark;
  --bg-top: #10251d;
  --bg-mid: #194d3d;
  --bg-bottom: #536a35;
  --ink: #f5fff6;
  --muted: rgba(245, 255, 246, 0.68);
  --quiet: rgba(245, 255, 246, 0.48);
  --line: rgba(245, 255, 246, 0.16);
  --panel: rgba(13, 31, 25, 0.72);
  --panel-soft: rgba(245, 255, 246, 0.075);
  --field: rgba(245, 255, 246, 0.09);
  --accent: #a7df72;
  --accent-2: #77d6b2;
  --warn: #ffd36a;
  --danger: #ff8b8b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    radial-gradient(circle at 8% 0%, rgba(167, 223, 114, 0.18), transparent 24rem),
    radial-gradient(circle at 92% 10%, rgba(119, 214, 178, 0.16), transparent 26rem),
    linear-gradient(135deg, var(--bg-top), var(--bg-mid) 52%, var(--bg-bottom));
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 15px;
  color: #0d2019;
  background: linear-gradient(180deg, #fafff5, #cfeaae);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.danger-button {
  color: #fff7f5;
  background: linear-gradient(180deg, rgba(255, 139, 139, 0.95), rgba(157, 42, 42, 0.95));
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.secondary,
.icon-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.compact-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.76rem;
}

.danger-small {
  min-height: 34px;
  padding: 6px 10px;
  color: #fff7f5;
  background: rgba(255, 139, 139, 0.16);
  border: 1px solid rgba(255, 139, 139, 0.32);
  box-shadow: none;
  font-size: 0.76rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--field);
  outline: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(167, 223, 114, 0.78);
  box-shadow: 0 0 0 3px rgba(167, 223, 114, 0.13);
}

textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
  line-height: 1.4;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.password-hint {
  margin: -4px 0 0;
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.35;
}

.legal-note {
  margin: -2px 0 0;
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.4;
  text-transform: none;
}

.legal-note a {
  color: var(--ink);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  width: min(1180px, calc(100% - 28px));
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px auto 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 31, 25, 0.78);
  backdrop-filter: blur(18px) saturate(145%);
  box-shadow: var(--shadow);
}

.brand-link,
.app-topbar nav {
  display: flex;
  align-items: center;
}

.brand-link {
  gap: 10px;
  min-height: 42px;
  padding: 4px 12px 4px 4px;
  border-radius: 12px;
  font-weight: 950;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(180deg, #fafff5, #cfeaae);
  color: #0d2019;
  font-size: 0.72rem;
  font-weight: 950;
}

.app-topbar nav {
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
}

.app-topbar nav a,
.nav-logout {
  min-height: 36px;
  padding: 9px 13px;
  border-radius: 10px;
  color: rgba(245, 255, 246, 0.72);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.86rem;
  font-weight: 850;
}

.brand-link:hover,
.app-topbar nav a:hover,
.nav-logout:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
  transform: none;
}

.nav-logout {
  color: var(--warn);
}

.shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.brand-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 8px;
  font-size: clamp(3rem, 5.2vw, 5.8rem);
  line-height: 0.92;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.5rem);
  line-height: 1.05;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

h4 {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.45;
}

.site-link {
  align-self: center;
  color: var(--ink);
  font-weight: 900;
}

.panel,
.sub-panel,
.records-panel,
.detail-panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 16px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 16px;
  align-items: stretch;
}

.auth-intro {
  display: grid;
  min-height: 390px;
  align-content: end;
  padding: clamp(22px, 4vw, 42px);
}

.auth-intro h2 {
  max-width: 640px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.4vw, 4.8rem);
}

.auth-intro p {
  max-width: 660px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.58;
}

.auth-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.auth-preview-grid div {
  min-height: 88px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.075);
}

.auth-preview-grid span,
.metric-card span {
  display: block;
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-preview-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 1rem;
  line-height: 1.24;
}

.auth-card {
  display: grid;
  align-content: start;
  padding: 20px;
}

.stack {
  display: grid;
  gap: 12px;
}

.actions,
.inline-form,
.invite-form,
.panel-title,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title,
.section-head {
  justify-content: space-between;
}

.panel-title {
  margin-bottom: 14px;
}

.app-grid {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 16px;
}

.plan-gate {
  max-width: 760px;
  margin: 18px auto 0;
}

.farms-panel,
.workspace-panel {
  min-height: 620px;
}

.sub-panel,
.records-panel,
.detail-panel {
  padding: 14px;
  box-shadow: none;
}

.sub-panel {
  margin-top: 14px;
  background: rgba(13, 31, 25, 0.52);
}

.account-tools {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.account-tools summary {
  cursor: pointer;
  padding: 12px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 950;
}

.account-stack {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.danger-zone {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 139, 139, 0.28);
  border-radius: 12px;
  background: rgba(255, 139, 139, 0.09);
}

.danger-zone p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.list {
  display: grid;
  gap: 10px;
}

#farm-list {
  margin-top: 16px;
}

.farm-button,
.invite-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.075);
  text-align: left;
}

.farm-button.active {
  border-color: rgba(167, 223, 114, 0.72);
  background: rgba(167, 223, 114, 0.16);
}

.access-row {
  background: rgba(255, 255, 255, 0.052);
}

#farm-access-card .section-head {
  margin-bottom: 14px;
}

#farm-access-card .section-head h3 {
  margin-bottom: 0;
}

.farm-name {
  font-weight: 950;
}

.role,
.small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.billing-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(167, 223, 114, 0.32);
  border-radius: 16px;
  background: rgba(167, 223, 114, 0.11);
  box-shadow: none;
}

.billing-card.needs-plan {
  border-color: rgba(255, 211, 106, 0.42);
  background: rgba(255, 211, 106, 0.1);
}

.billing-card h3,
.billing-card p {
  margin-bottom: 0;
}

.billing-card p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.42;
}

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metric-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.085);
  box-shadow: none;
}

.metric-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
  font-weight: 950;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.detail-panel {
  overflow: visible;
}

.detail-empty {
  display: grid;
  min-height: 220px;
  align-content: center;
}

.detail-empty p {
  color: var(--muted);
}

.detail-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-heading h3 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

.detail-section {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-section > .section-head {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.detail-section > .section-head h4 {
  margin-bottom: 0;
}

.detail-section:first-of-type {
  border-top: 0;
}

.detail-actions,
.sticky-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.readonly-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 205, 111, 0.36);
  border-radius: 12px;
  color: #fff6dd;
  background: rgba(255, 205, 111, 0.13);
  font-weight: 760;
}

.missing-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 117, 117, 0.46);
  border-radius: 12px;
  color: #ffe9e9;
  background: rgba(211, 49, 49, 0.18);
  font-weight: 760;
  line-height: 1.35;
}

.is-missing {
  color: #ffb7b7;
}

.is-missing input,
.is-missing textarea {
  border-color: rgba(255, 117, 117, 0.86);
  background: rgba(211, 49, 49, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 117, 117, 0.22);
}

.is-missing input:focus,
.is-missing textarea:focus {
  border-color: rgba(255, 139, 139, 0.98);
  box-shadow: 0 0 0 3px rgba(255, 117, 117, 0.18);
}

.job-edit-form {
  display: grid;
  gap: 10px;
}

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

.repeater-list {
  display: grid;
  gap: 12px;
}

.edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.edit-row > label {
  flex: 1 1 138px;
  min-width: min(100%, 138px);
}

.product-edit-row > label,
.weather-edit-row > label {
  flex-basis: 128px;
}

.weather-edit-row {
  display: grid;
  grid-template-columns: minmax(238px, 1.35fr) repeat(6, minmax(112px, 1fr)) minmax(104px, auto);
  align-items: end;
}

.weather-edit-row > label {
  min-width: 0;
}

.weather-edit-row > label:nth-of-type(8) {
  grid-column: 1 / -2;
}

.weather-edit-row > label:nth-of-type(8) input {
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-remove {
  flex: 0 0 auto;
  min-width: 104px;
  margin-left: auto;
  align-self: end;
}

.weather-edit-row .row-remove {
  width: 100%;
  margin-left: 0;
}

.sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 8px;
  padding: 12px 0 0;
  background: linear-gradient(180deg, rgba(16, 50, 38, 0), rgba(16, 50, 38, 0.96) 28%);
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

dl div,
.detail-list > div {
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

dt {
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  font-weight: 850;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-list strong,
.detail-list span {
  display: block;
}

.detail-list span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.notes {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

th,
td {
  padding: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

td {
  color: rgba(245, 255, 246, 0.9);
  font-size: 0.9rem;
  font-weight: 720;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: rgba(167, 223, 114, 0.12);
}

.job-number-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.missing-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 117, 117, 0.7);
  border-radius: 999px;
  color: #fff;
  background: rgba(211, 49, 49, 0.88);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

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

.mini-table {
  min-width: 0;
}

.mini-table th,
.mini-table td {
  white-space: normal;
  font-size: 0.78rem;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 950;
}

.status.open {
  color: #13251c;
  background: var(--accent);
}

.status.sealed {
  color: #241c0d;
  background: var(--warn);
}

.message {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(167, 223, 114, 0.2);
  font-weight: 780;
}

.message.error {
  background: rgba(255, 139, 139, 0.22);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .auth-grid,
  .app-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    max-height: none;
  }

  .edit-grid,
  .paddock-edit-row,
  .product-edit-row,
  .weather-edit-row {
    grid-template-columns: 1fr;
  }

  .detail-heading {
    display: grid;
  }
}

@media (max-width: 760px) {
  .app-topbar,
  .brand-panel,
  .actions,
  .inline-form,
  .invite-form {
    align-items: stretch;
    flex-direction: column;
  }

  .shell {
    width: min(100% - 20px, 1480px);
    padding: 18px 0 28px;
  }

  .app-topbar {
    position: static;
    width: min(100% - 20px, 1480px);
  }

  .app-topbar nav {
    width: 100%;
    flex-direction: column;
    justify-content: stretch;
  }

  .app-topbar nav a,
  .nav-logout,
  button {
    width: 100%;
  }

  .brand-panel {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .auth-grid,
  .auth-intro,
  .auth-card,
  .panel {
    min-width: 0;
  }

  h1 {
    font-size: clamp(2.25rem, 11vw, 3.2rem);
    line-height: 0.98;
    overflow-wrap: anywhere;
  }

  .lead,
  .auth-intro p {
    max-width: calc(100vw - 56px);
    overflow-wrap: anywhere;
  }

  .auth-intro {
    min-height: 0;
    padding: 18px;
  }

  .auth-intro h2 {
    max-width: calc(100vw - 56px);
    font-size: clamp(1.9rem, 8.5vw, 2.7rem);
    line-height: 1.02;
    overflow-wrap: anywhere;
  }

  .brand-panel h1 {
    max-width: calc(100vw - 40px);
  }

  .auth-preview-grid,
  .summary-grid,
  .billing-card,
  dl {
    grid-template-columns: 1fr;
  }

  .billing-actions {
    justify-content: stretch;
  }

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