:root {
  color-scheme: light;
  --bg: #eef1e7;
  --surface: #fffdf8;
  --surface-strong: #f8f4ea;
  --ink: #13211b;
  --muted: #617168;
  --line: #d7d0c1;
  --leaf: #2b7350;
  --leaf-dark: #173d2b;
  --soil: #76563d;
  --amber: #c9882c;
  --blue: #2c6a78;
  --danger: #9a3b32;
  --shadow: 0 18px 50px rgba(42, 35, 24, 0.1);
  --radius: 8px;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  letter-spacing: 0;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a[x-apple-data-detectors] {
  color: inherit !important;
  cursor: default !important;
  pointer-events: none !important;
  text-decoration: none !important;
}

button,
input,
select {
  font: inherit;
}

button,
.auth-mode-title,
.panel-heading h3,
.nav-button,
.sub-tab,
.ghost-button,
.copy-button,
.auth-submit,
.auth-switch,
.auth-forgot,
.logout-button,
.metric strong {
  font-family: var(--font-display);
}

input,
select,
.metric strong,
.nav-mark {
  font-variant-numeric: tabular-nums;
}

button {
  cursor: pointer;
}

.public-landing {
  min-height: 100vh;
  background: #ffffff;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 10px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid #e3e7e3;
  background: #ffffff;
}

.public-logo {
  display: block;
  width: min(240px, 44vw);
  height: 52px;
  object-fit: contain;
  object-position: left center;
}

.public-header-actions,
.public-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-login-link {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--leaf-dark);
  padding: 6px 8px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
}

.public-login-link:hover,
.public-login-link:focus-visible {
  color: var(--leaf);
  text-decoration: underline;
  text-underline-offset: 4px;
  outline: none;
}

.public-hero {
  position: relative;
  display: grid;
  align-items: end;
  width: 100%;
  min-height: min(680px, calc(100vh - 72px));
  padding: 48px max(24px, calc((100vw - 1240px) / 2));
  background-color: #1f4b30;
  background-image: url("assets/agrivanced-sidebar-hero.png");
  background-position: center;
  background-size: cover;
}

.public-hero-content {
  display: grid;
  gap: 16px;
  width: min(660px, 100%);
  padding: 28px 0 4px;
  color: #ffffff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
}

.public-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.public-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: 0;
}

.public-hero-content > p:not(.public-kicker) {
  max-width: 620px;
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.55;
}

.public-primary,
.public-secondary {
  min-height: 48px;
  border-radius: 6px;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  text-shadow: none;
}

.public-primary {
  border: 1px solid #ffffff;
  background: #ffffff;
  color: var(--leaf-dark);
}

.public-secondary {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(18, 33, 27, 0.68);
  color: #ffffff;
}

.public-primary:hover,
.public-primary:focus-visible {
  border-color: #dce9df;
  background: #eaf3ed;
  outline: none;
}

.public-secondary:hover,
.public-secondary:focus-visible {
  background: rgba(18, 33, 27, 0.88);
  outline: none;
}

.public-tools {
  display: grid;
  gap: 28px;
  padding: 56px max(24px, calc((100vw - 1240px) / 2)) 64px;
  background: #f6f8f4;
}

.public-tools-heading {
  max-width: 700px;
}

.public-tools-heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1.2;
}

.public-tool-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid #dfe5df;
  background: #dfe5df;
}

.public-tool-list article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 180px;
  padding: 24px;
  background: #ffffff;
}

.public-tool-list article > span {
  color: var(--leaf);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
}

.public-tool-list h3,
.public-tool-list p {
  margin: 0;
}

.public-tool-list h3 {
  font-family: var(--font-display);
  font-size: 1.08rem;
}

.public-tool-list p {
  color: var(--muted);
  font-size: 0.9rem;
}

.public-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  padding: 24px;
  border-top: 1px solid #e1e5e1;
  background: #ffffff;
  color: #68736d;
  font-size: 0.78rem;
}

.public-footer a {
  color: var(--leaf-dark);
  text-decoration: none;
}

.public-footer a:hover,
.public-footer a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.legal-page {
  min-height: 100vh;
  background: #f6f8f4;
  color: var(--ink);
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 10px max(24px, calc((100vw - 920px) / 2));
  border-bottom: 1px solid #e1e5e1;
  background: #ffffff;
}

.legal-header img {
  display: block;
  width: min(210px, 52vw);
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.legal-main {
  display: grid;
  gap: 26px;
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.legal-main article {
  display: grid;
  gap: 24px;
}

.legal-main header,
.legal-section {
  display: grid;
  gap: 8px;
}

.legal-main h1,
.legal-main h2,
.legal-main p,
.legal-main ul {
  margin: 0;
}

.legal-main h1,
.legal-main h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.legal-main h1 {
  font-size: 2rem;
  line-height: 1.15;
}

.legal-main h2 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.legal-main p,
.legal-main li {
  color: #4f5c55;
  font-size: 0.94rem;
  line-height: 1.65;
}

.legal-main ul {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.legal-back {
  width: fit-content;
  color: var(--leaf-dark);
  font-weight: 800;
  text-decoration: none;
}

.legal-back:hover,
.legal-back:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
  outline: none;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  background: #ffffff;
  place-items: center;
}

.auth-card {
  display: grid;
  width: min(680px, 100%);
  min-height: min(820px, calc(100vh - 64px));
  background: #ffffff;
}

.auth-content {
  display: grid;
  align-content: center;
  gap: 22px;
  width: 100%;
  padding: 0;
}

.auth-topline {
  display: grid;
  justify-items: end;
  min-height: 34px;
}

.auth-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.auth-brand-logo-large {
  justify-self: center;
  max-width: 430px;
}

.auth-mode-title {
  margin: 0 0 2px;
  color: #050505;
  font-size: 1.42rem;
  font-weight: 780;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.auth-confirmation {
  display: grid;
  gap: 16px;
  width: 100%;
}

.auth-confirmation-lead,
.auth-confirmation-instruction,
.auth-confirmation-note,
.auth-confirmation-status {
  margin: 0;
  line-height: 1.5;
}

.auth-confirmation-lead {
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

.auth-confirmation-email {
  display: block;
  overflow-wrap: anywhere;
  border-left: 4px solid #2b7350;
  border-radius: 4px;
  background: #eef6f0;
  padding: 14px 16px;
  color: #173d2b;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 800;
}

.auth-confirmation-instruction {
  color: #1f2937;
  font-size: 1rem;
  font-weight: 650;
}

.auth-confirmation-note {
  border: 1px solid #dfd7c6;
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px 14px;
  color: #61513d;
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-confirmation-resend {
  width: 100%;
}

.auth-confirmation-resend:disabled {
  cursor: not-allowed;
}

.auth-confirmation-status {
  min-height: 22px;
  color: #173d2b;
  font-size: 0.92rem;
  font-weight: 760;
  text-align: center;
}

.auth-confirmation-status.is-error {
  color: var(--danger);
}

.auth-confirmation-back {
  justify-self: center;
}

.auth-form label {
  display: grid;
  position: relative;
  gap: 8px;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 760;
}

.auth-form label > span {
  padding-left: 4px;
}

.auth-form input {
  min-height: 72px;
  border-color: #cfd4dc;
  border-radius: 18px;
  background: #ffffff;
  padding: 0 20px;
  color: #111827;
  font-size: 1.05rem;
  font-weight: 520;
}

.auth-form input:focus {
  border-color: #8aa892;
  box-shadow: 0 0 0 3px rgba(43, 115, 80, 0.13);
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 96px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 16px;
  min-width: 64px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #246a48;
  padding: 4px 6px;
  font-size: 0.82rem;
  font-weight: 800;
  transform: translateY(-50%);
  transition: color 140ms ease, background-color 140ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #173d2b;
  background: rgba(43, 115, 80, 0.09);
  outline: none;
}

.auth-submit {
  min-height: 56px;
  border: 1px solid #70b98c;
  border-radius: 999px;
  background: #75bd91;
  color: #ffffff;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 820;
  transition: background-color 140ms ease, transform 140ms ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  background: #2b7350;
  outline: none;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-forgot {
  justify-self: center;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: #111827;
  padding: 0 4px;
  font-size: 0.98rem;
  font-weight: 760;
}

.auth-forgot:hover,
.auth-forgot:focus-visible {
  color: #2b7350;
  outline: none;
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: #173d2b;
  font-size: 0.95rem;
  font-weight: 760;
  line-height: 1.4;
  text-align: center;
}

.auth-message.is-error {
  color: var(--danger);
}

.auth-switch {
  min-height: 56px;
  border: 1.5px solid #2b7350;
  border-radius: 999px;
  background: #ffffff;
  color: #1f6f46;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 820;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.auth-switch:hover,
.auth-switch:focus-visible {
  border-color: #173d2b;
  background: #f2faf4;
  color: #173d2b;
  outline: none;
}

.auth-support {
  justify-self: center;
  color: #68736d;
  font-size: 0.78rem;
  font-weight: 550;
  text-decoration: none;
}

.auth-support:hover,
.auth-support:focus-visible {
  color: #2b7350;
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 0.72rem;
}

.legal-links a {
  color: inherit;
  text-decoration: none;
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: var(--leaf-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.auth-legal-links {
  justify-self: center;
}

.app-legal-links {
  justify-content: center;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 180ms ease;
}

.loading-overlay.is-hidden {
  pointer-events: none;
  opacity: 0;
}

.loading-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 170px;
  padding: 24px 28px;
  border: 1px solid rgba(43, 115, 80, 0.16);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
  transform: translateY(0);
  animation: loading-card-in 220ms ease both;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #e2efe7;
  border-top-color: #2b7350;
  border-radius: 999px;
  animation: loading-spin 780ms linear infinite;
}

.loading-card p {
  margin: 0;
  color: #173d2b;
  font-size: 0.96rem;
  font-weight: 820;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.side-panel {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-right: 1px solid rgba(23, 61, 43, 0.16);
  background: #fbf7ee;
  backdrop-filter: blur(12px);
}

.brand-visual {
  overflow: hidden;
  aspect-ratio: 1.42;
  min-height: 0;
  border-radius: var(--radius);
  background: var(--soil);
  box-shadow: 0 12px 30px rgba(38, 31, 22, 0.14);
}

.brand-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.brand-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
  line-height: 1.3;
}

.language-picker {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid #cfd4dc;
  border-radius: 999px;
  background: #ffffff;
  color: #526159;
  font-size: 0.84rem;
  font-weight: 780;
  box-shadow: 0 2px 5px rgba(17, 24, 39, 0.04);
}

.language-picker > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.language-picker select {
  width: 54px;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: #173d2b;
  padding: 2px 18px 2px 0;
  font-size: 0.82rem;
  font-weight: 820;
}

.language-flag {
  display: block;
  width: 28px;
  height: 18px;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 5px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}

.language-picker select:focus {
  box-shadow: none;
}

.language-picker:focus-within {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(43, 115, 80, 0.12);
}

.side-utilities {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.language-picker-side {
  grid-template-columns: auto auto;
  align-self: stretch;
  justify-content: start;
  min-height: 30px;
  padding: 3px 7px;
}

.language-picker-side select {
  width: 54px;
}

.weather-widget {
  position: relative;
  min-width: 0;
}

.weather-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 4px 9px;
  border: 1px solid #cfd4dc;
  border-radius: 999px;
  background: #ffffff;
  color: var(--leaf-dark);
  box-shadow: 0 2px 5px rgba(17, 24, 39, 0.04);
  text-align: left;
}

.weather-chip strong {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.weather-chip span {
  overflow: hidden;
  color: #526159;
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-chip:hover,
.weather-chip:focus-visible,
.weather-chip[aria-expanded="true"] {
  border-color: var(--leaf);
  background: #f7fbf8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 115, 80, 0.1);
}

.weather-chip.is-loading strong,
.weather-chip.is-loading span {
  opacity: 0.55;
}

.weather-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  width: min(290px, calc(100vw - 36px));
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(43, 115, 80, 0.22);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(31, 42, 38, 0.18);
}

.weather-current {
  display: block;
}

.weather-current > div {
  display: grid;
  gap: 2px;
}

.weather-current strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
}

.weather-current span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.weather-current .weather-location-detail {
  color: #7a887f;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.25;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.weather-details div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border-radius: 6px;
  background: #f4f7f4;
}

.weather-details dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 740;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-details dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.weather-search {
  position: relative;
  display: block;
}

.weather-search input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid #cfd4dc;
  border-radius: 6px;
  background: #ffffff;
  padding: 6px 32px 6px 9px;
  color: var(--ink);
  font-size: 0.78rem;
}

.weather-search input:focus {
  border-color: var(--leaf);
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 115, 80, 0.1);
}

.weather-search::after {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 12px;
  height: 12px;
  border: 2px solid #839188;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.weather-search::before {
  position: absolute;
  top: 23px;
  right: 8px;
  z-index: 1;
  width: 7px;
  height: 2px;
  transform: rotate(45deg);
  background: #839188;
  content: "";
  pointer-events: none;
}

.weather-suggestions {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  z-index: 30;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #cfd4dc;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(31, 42, 38, 0.18);
}

.weather-suggestion {
  display: grid;
  width: 100%;
  gap: 1px;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.weather-suggestion:last-child {
  border-bottom: 0;
}

.weather-suggestion:hover,
.weather-suggestion:focus-visible,
.weather-suggestion.is-active {
  background: #edf5ef;
  outline: none;
}

.weather-suggestion strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-suggestion span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 620;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-status,
.weather-updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.weather-status:empty,
.weather-updated:empty {
  display: none;
}

.weather-status.is-error {
  color: var(--danger);
}

.user-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label action"
    "name action";
  align-items: center;
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid rgba(44, 106, 120, 0.18);
  border-radius: var(--radius);
  background: #ffffff;
}

.user-panel span {
  grid-area: label;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 780;
  text-transform: uppercase;
  line-height: 1.1;
}

.user-panel strong {
  grid-area: name;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.logout-button {
  grid-area: action;
  justify-self: end;
  min-height: 28px;
  border: 1px solid rgba(44, 106, 120, 0.2);
  border-radius: 999px;
  background: #f7fbfb;
  color: var(--blue);
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 820;
}

.logout-button:hover,
.logout-button:focus-visible {
  background: #eef6f5;
  color: var(--leaf-dark);
  outline: none;
}

.support-link {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(43, 115, 80, 0.18);
  border-radius: var(--radius);
  background: #f7fbf8;
  color: var(--leaf-dark);
  text-decoration: none;
}

.support-link span {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 780;
  line-height: 1.1;
  text-transform: uppercase;
}

.support-link strong {
  color: var(--leaf-dark);
  font-size: 0.84rem;
  font-weight: 760;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.support-link:hover,
.support-link:focus-visible {
  border-color: rgba(43, 115, 80, 0.38);
  background: #eef6f0;
  outline: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-heading h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: 0;
}

.tool-nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 780;
  text-align: left;
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: rgba(47, 111, 78, 0.24);
  background: rgba(47, 111, 78, 0.08);
  outline: none;
}

.nav-button.is-active {
  border-color: rgba(43, 115, 80, 0.34);
  background: #e5efe7;
  color: var(--leaf-dark);
  box-shadow: inset 3px 0 0 var(--leaf);
}

.nav-mark {
  display: inline-grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--soil);
  font-size: 0.72rem;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(114, 82, 58, 0.14);
}

.workspace {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px;
  min-width: 0;
}

.calc-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  min-width: 0;
}

.form-grid label {
  display: grid;
  position: relative;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 780;
}

input,
select {
  width: 100%;
  min-height: 46px;
  min-width: 0;
  border: 1px solid #cfc7b8;
  border-radius: var(--radius);
  background: #fffefa;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

input:focus,
select:focus {
  border-color: var(--leaf);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(43, 115, 80, 0.15);
}

input::placeholder {
  color: #92998f;
}

.ghost-button {
  border: 1px solid var(--line);
  min-height: 44px;
  border-radius: var(--radius);
  background: #fffefa;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 820;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(47, 111, 78, 0.38);
  background: #eef5ef;
  outline: none;
}

.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.calc-panel {
  display: none;
  padding: 20px 22px 24px;
}

.calc-panel.is-active {
  display: grid;
  gap: 16px;
}

.dashboard-panel {
  overflow: hidden;
  padding: 0;
}

.dashboard-panel.is-active {
  gap: 0;
}

.dashboard-welcome {
  display: grid;
  gap: 7px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--line);
  background: #f7fbf8;
}

.dashboard-welcome .eyebrow,
.dashboard-welcome h3,
.dashboard-welcome p {
  margin: 0;
}

.dashboard-welcome h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.15;
}

.dashboard-welcome > p:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--line);
  gap: 1px;
}

.dashboard-tools button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-areas:
    "mark title"
    "mark meta";
  align-items: center;
  gap: 2px 12px;
  min-height: 94px;
  min-width: 0;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: #fffefa;
  color: var(--ink);
  text-align: left;
}

.dashboard-tools button > span {
  grid-area: mark;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(43, 115, 80, 0.22);
  border-radius: 50%;
  background: #eaf3ed;
  color: var(--leaf-dark);
  font-size: 0.72rem;
  font-weight: 850;
}

.dashboard-tools strong {
  grid-area: title;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.2;
}

.dashboard-tools small {
  grid-area: meta;
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.dashboard-tools button:hover,
.dashboard-tools button:focus-visible {
  background: #eef6f0;
  outline: 2px solid var(--leaf);
  outline-offset: -2px;
}

.dashboard-tools button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

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

.panel-heading h3 {
  font-size: 1.36rem;
  line-height: 1.18;
}

.copy-button {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 13px 16px;
}

.field-unit {
  position: absolute;
  right: 10px;
  top: 0;
  max-width: 48%;
  overflow: hidden;
  color: #748078;
  font-size: 0.76rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 106px;
  gap: 8px;
}

.conversion-direct {
  display: grid;
  grid-template-columns: minmax(90px, 0.55fr) minmax(190px, 1.25fr) 46px minmax(120px, 0.75fr) minmax(190px, 1.25fr);
  align-items: center;
  padding: 16px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8f3e8;
}

.conversion-output {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid rgba(43, 115, 80, 0.26);
  border-radius: var(--radius);
  background: #eaf3ed;
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 820;
  overflow-wrap: anywhere;
}

.conversion-equation {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border: 1px solid rgba(43, 115, 80, 0.24);
  border-radius: var(--radius);
  background: #eaf3ed;
  color: var(--ink);
  padding: 14px 18px;
  text-align: center;
}

.conversion-equation strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.35;
}

.conversion-equation.is-empty {
  color: var(--muted);
}

.conversion-swap {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(43, 115, 80, 0.28);
  border-radius: 50%;
  background: #ffffff;
  color: var(--leaf-dark);
  font-size: 1.35rem;
  font-weight: 820;
  transition: background-color 140ms ease, transform 140ms ease;
}

.conversion-swap:hover,
.conversion-swap:focus-visible {
  background: #eaf3ed;
  outline: none;
  transform: rotate(180deg);
}

.quality-panel,
.nutrient-panel {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.crop-selector {
  display: grid;
  gap: 7px;
}

.crop-selector-label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 780;
}

.crop-tabs {
  width: min(100%, 390px);
}

.crop-tabs .sub-tab {
  flex: 1 1 0;
  min-width: 92px;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f3eee3;
}

.sub-tab {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.88rem;
  font-weight: 820;
}

.sub-tab:hover,
.sub-tab:focus-visible {
  color: var(--leaf-dark);
  outline: none;
}

.sub-tab.is-active {
  border-color: rgba(43, 115, 80, 0.22);
  background: #ffffff;
  color: var(--leaf-dark);
  box-shadow: 0 2px 8px rgba(42, 35, 24, 0.08);
}

.quality-fields {
  padding-top: 2px;
}

.info-strip {
  border: 1px solid rgba(44, 106, 120, 0.16);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: #eef6f5;
  color: #21434d;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 690;
  line-height: 1.45;
}

.warning-strip {
  border: 1px solid rgba(154, 59, 50, 0.12);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  background: #fff4ef;
  color: #52312b;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 690;
  line-height: 1.45;
}

.result-box {
  display: grid;
  gap: 14px;
  min-height: 160px;
  min-width: 0;
  padding: 16px 18px 18px;
  border: 1px solid #d8d0c0;
  border-radius: var(--radius);
  background: #f8f3e8;
}

.result-box.is-empty {
  align-content: center;
  color: var(--muted);
}

.result-state {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 8px;
  text-align: center;
}

.result-state span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d6cdbb;
  border-radius: 50%;
  background: #fffefa;
  color: var(--soil);
  font-family: var(--font-display);
  font-weight: 850;
}

.result-state p {
  max-width: 520px;
  margin: 0;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(148px, 1fr));
  gap: 11px;
}

.metric {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 94px;
  padding: 13px 14px;
  border: 1px solid rgba(40, 76, 64, 0.14);
  border-radius: var(--radius);
  background: #fffefa;
  box-shadow: 0 5px 16px rgba(42, 35, 24, 0.05);
}

.metric span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 780;
  line-height: 1.25;
}

.metric strong {
  align-self: end;
  color: var(--ink);
  font-size: 1.24rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.metric.is-accent {
  border-color: rgba(43, 115, 80, 0.26);
  background: #eaf3ed;
}

.connection-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  padding: 9px 12px;
  border: 1px solid #d9b796;
  border-radius: var(--radius);
  background: #fff9f1;
  color: #583c24;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.13);
}

.connection-banner > span {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b96032;
}

.connection-banner strong {
  font-size: 0.78rem;
  line-height: 1.35;
}

.connection-banner.is-online {
  border-color: rgba(43, 115, 80, 0.28);
  background: #f1f8f3;
  color: var(--leaf-dark);
}

.connection-banner.is-online > span {
  background: var(--leaf);
}

.consent-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: min(760px, calc(100vw - 36px));
  padding: 16px 18px;
  border: 1px solid rgba(43, 115, 80, 0.25);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.18);
}

.consent-banner > div:first-child {
  display: grid;
  gap: 5px;
}

.consent-banner strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.consent-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.consent-banner a {
  width: fit-content;
  color: var(--leaf-dark);
  font-size: 0.74rem;
  font-weight: 760;
}

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

.consent-actions button {
  min-height: 40px;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 820;
}

.consent-reject {
  border: 1px solid #cfd7d1;
  background: #ffffff;
  color: var(--ink);
}

.consent-accept {
  border: 1px solid var(--leaf-dark);
  background: var(--leaf-dark);
  color: #ffffff;
}

.consent-actions button:hover,
.consent-actions button:focus-visible {
  outline: 3px solid rgba(43, 115, 80, 0.16);
  outline-offset: 1px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 24px);
  border-radius: var(--radius);
  background: #1f2a26;
  color: #ffffff;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 720;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 286px minmax(0, 1fr);
  }

  .form-grid,
  .metrics {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 860px) {
  .public-hero {
    min-height: 68svh;
    background-position: 58% center;
  }

  .public-tool-list {
    grid-template-columns: 1fr;
  }

  .public-tool-list article {
    min-height: 0;
  }

  .auth-screen {
    padding: 16px;
  }

  .auth-card {
    min-height: calc(100vh - 32px);
  }

  .auth-brand-logo-large {
    max-width: 360px;
  }

  .auth-content {
    padding: 0;
  }

  .app-shell {
    display: block;
  }

  .side-panel {
    position: sticky;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 0.85fr);
    grid-template-areas:
      "utilities user"
      "nav nav";
    align-items: center;
    gap: 8px 12px;
    min-height: auto;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(38, 31, 22, 0.08);
  }

  .brand-visual,
  .brand-tagline,
  .support-link,
  .app-legal-links {
    display: none;
  }

  .side-utilities {
    grid-area: utilities;
  }

  .user-panel {
    grid-area: user;
  }

  .tool-nav {
    grid-area: nav;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(124px, max-content);
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .nav-button {
    min-width: 124px;
    min-height: 40px;
    padding: 4px 8px;
    font-size: 0.84rem;
    scroll-snap-align: start;
  }

  .nav-mark {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
  }

  .workspace {
    padding: 16px;
  }

  .conversion-direct {
    grid-template-columns: minmax(90px, 0.65fr) minmax(0, 1.35fr);
  }

  .conversion-swap {
    grid-column: 1 / -1;
    justify-self: center;
    transform: rotate(90deg);
  }

  .conversion-swap:hover,
  .conversion-swap:focus-visible {
    transform: rotate(270deg);
  }

}

@media (max-width: 620px) {
  .public-header {
    min-height: 62px;
    padding: 8px 12px;
  }

  .public-logo {
    width: 148px;
    height: 42px;
  }

  .public-login-link {
    display: none;
  }

  .public-hero {
    min-height: 72svh;
    padding: 28px 18px;
    background-position: 66% center;
  }

  .public-hero-content {
    gap: 13px;
  }

  .public-hero h1 {
    font-size: 2.65rem;
  }

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

  .public-tools {
    padding: 38px 16px 44px;
  }

  .public-tools-heading h2 {
    font-size: 1.45rem;
  }

  .auth-screen {
    padding: 12px;
  }

  .auth-content {
    gap: 18px;
    padding: 0;
  }

  .auth-mode-title {
    font-size: 1.24rem;
  }

  .auth-form input {
    min-height: 64px;
    border-radius: 16px;
  }

  .side-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "utilities"
      "user"
      "nav";
    padding: 8px 10px 7px;
    gap: 7px;
  }

  .side-utilities {
    width: 100%;
    max-width: none;
  }

  .user-panel {
    padding: 6px 8px;
  }

  .dashboard-welcome {
    padding: 20px 16px 17px;
  }

  .dashboard-welcome h3 {
    font-size: 1.32rem;
  }

  .dashboard-tools {
    grid-template-columns: 1fr;
  }

  .dashboard-tools button {
    min-height: 76px;
    padding: 13px 15px;
  }

  .consent-banner {
    right: 10px;
    bottom: 10px;
    grid-template-columns: 1fr;
    gap: 12px;
    width: calc(100vw - 20px);
    padding: 14px;
  }

  .consent-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 12px;
  }

  .calc-panel {
    padding: 14px;
  }

  .calc-panel.is-active {
    gap: 14px;
  }

  .panel-heading {
    display: grid;
  }

  .copy-button {
    width: 100%;
  }

  .form-grid,
  .metrics,
  .inline-field {
    grid-template-columns: 1fr;
  }

  .metrics {
    gap: 9px;
  }

  .result-box {
    padding: 12px;
  }

  .metric {
    min-height: 82px;
  }

  .metric strong {
    font-size: 1.12rem;
  }

  .info-strip,
  .warning-strip {
    font-size: 0.84rem;
  }

  .sub-tabs {
    width: 100%;
  }

  .sub-tab {
    flex: 1 1 auto;
  }

  .field-unit {
    position: static;
    max-width: none;
    white-space: normal;
  }

  .ghost-button {
    width: 100%;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .auth-screen {
    padding: 16px;
  }

  .auth-content {
    padding: 0;
  }

  .auth-form input,
  .auth-submit,
  .auth-switch {
    min-height: 54px;
  }

  .side-panel {
    padding: 10px;
  }

  .side-utilities {
    max-width: none;
  }

  .weather-popover {
    right: 0;
  }

  .workspace {
    padding: 10px;
  }

  .auth-brand-logo-large {
    max-width: 270px;
  }

  .nav-button {
    min-width: 118px;
    font-size: 0.88rem;
  }

  .nav-mark {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
  }

  .panel-heading h3 {
    font-size: 1.12rem;
  }
}

/* Agricultural library */
.library-panel {
  overflow: hidden;
  padding: 0;
}

.library-panel.is-active {
  gap: 0;
}

.library-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
  background: #f7fbf8;
}

.library-heading h3,
.library-heading p {
  margin: 0;
}

.library-heading h3 {
  font-family: var(--font-display);
  font-size: 1.56rem;
  line-height: 1.15;
}

.library-heading > div:first-child > p:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.library-count {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(43, 115, 80, 0.2);
  border-radius: 6px;
  background: #ffffff;
  color: var(--leaf-dark);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #fffefa;
}

.library-search {
  position: relative;
  flex: 1 1 360px;
  min-width: 180px;
}

.library-search::before {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  width: 12px;
  height: 12px;
  transform: translateY(-62%);
  border: 2px solid var(--muted);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.library-search::after {
  position: absolute;
  top: calc(50% + 6px);
  left: 25px;
  z-index: 1;
  width: 7px;
  height: 2px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: var(--muted);
  content: "";
  pointer-events: none;
}

.library-search input {
  min-height: 42px;
  padding-left: 40px;
  background: #ffffff;
}

.library-view-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f3eee3;
}

.library-view-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.library-view-switch button:hover,
.library-view-switch button:focus-visible {
  color: var(--leaf-dark);
  outline: none;
}

.library-view-switch button.is-active {
  background: #ffffff;
  color: var(--leaf-dark);
  box-shadow: 0 2px 7px rgba(42, 35, 24, 0.08);
}

.library-groups {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: #f8f4ea;
  scrollbar-width: thin;
}

.library-groups button {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.library-groups button span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--soil);
  font-size: 0.62rem;
  box-shadow: inset 0 0 0 1px rgba(114, 82, 58, 0.14);
}

.library-groups button:hover,
.library-groups button:focus-visible,
.library-groups button.is-active {
  border-color: rgba(43, 115, 80, 0.24);
  background: #ffffff;
  color: var(--leaf-dark);
  outline: none;
}

.library-groups button.is-active span {
  background: #e5efe7;
  color: var(--leaf-dark);
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.45fr);
  min-height: 600px;
  background: #fffefa;
}

.library-catalog {
  max-height: 740px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbf9f3;
  scrollbar-width: thin;
}

.library-tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: stretch;
  min-height: 76px;
  border-bottom: 1px solid rgba(215, 208, 193, 0.72);
  background: transparent;
}

.library-tool-row.is-active {
  background: #eaf3ed;
  box-shadow: inset 3px 0 0 var(--leaf);
}

.library-tool-open {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 12px 7px 12px 14px;
  text-align: left;
}

.library-tool-open > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.library-tool-open strong,
.library-tool-open small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-tool-open strong {
  font-family: var(--font-display);
  font-size: 0.84rem;
  line-height: 1.25;
  white-space: nowrap;
}

.library-tool-open small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.28;
  white-space: nowrap;
}

.library-tool-open:hover,
.library-tool-open:focus-visible {
  background: rgba(43, 115, 80, 0.06);
  outline: none;
}

.library-tool-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(43, 115, 80, 0.18);
  border-radius: 50%;
  background: #ffffff;
  color: var(--leaf-dark);
  font-size: 0.61rem;
  font-weight: 850;
}

.library-favorite {
  align-self: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8b918d;
  padding: 0;
  font-size: 1.12rem;
  line-height: 1;
}

.library-favorite:hover,
.library-favorite:focus-visible {
  background: #ffffff;
  color: var(--amber);
  outline: 2px solid rgba(201, 136, 44, 0.24);
}

.library-favorite.is-active {
  color: var(--amber);
}

.library-workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 24px;
  background: #fffefa;
}

.library-tool-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.library-tool-heading span,
.library-tool-heading h4,
.library-tool-heading p {
  margin: 0;
}

.library-tool-heading > div > span {
  color: var(--leaf);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.library-tool-heading h4 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.28rem;
  line-height: 1.2;
}

.library-tool-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.library-favorite-large {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.library-form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.library-result {
  display: grid;
  gap: 12px;
  min-height: 140px;
  padding: 16px;
  border: 1px solid rgba(43, 115, 80, 0.22);
  border-radius: var(--radius);
  background: #f0f6f1;
}

.library-result.is-empty {
  align-content: center;
  border-color: var(--line);
  background: #f8f4ea;
}

.library-result-title {
  color: var(--leaf-dark);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.library-result .metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(43, 115, 80, 0.16);
  border-radius: 7px;
  background: rgba(43, 115, 80, 0.14);
}

.library-result .metric {
  min-height: 86px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.library-result .metric.is-accent {
  background: #e5efe7;
}

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

.primary-action {
  min-height: 44px;
  border: 1px solid var(--leaf-dark);
  border-radius: var(--radius);
  background: var(--leaf);
  color: #ffffff;
  padding: 9px 14px;
  font-family: var(--font-display);
  font-weight: 820;
  transition: background-color 140ms ease, transform 140ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--leaf-dark);
  outline: none;
}

.library-method {
  display: grid;
  gap: 7px;
  padding: 13px 14px;
  border-left: 3px solid var(--blue);
  background: #eef6f5;
  color: #36505a;
  font-size: 0.78rem;
  line-height: 1.45;
}

.library-method p {
  margin: 0;
}

.library-method a {
  color: var(--blue);
  font-weight: 760;
}

.library-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 160px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.library-empty span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--soil);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 850;
}

.library-empty p {
  max-width: 440px;
  margin: 0;
}

.library-history {
  display: grid;
  gap: 0;
  min-height: 420px;
  background: #fffefa;
}

.library-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
}

.library-history-list {
  display: grid;
  align-content: start;
}

.library-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
}

.library-history-row > div:first-child {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 5px 10px;
  min-width: 0;
}

.library-history-row > div:first-child > span {
  color: var(--leaf);
  font-size: 0.68rem;
  font-weight: 850;
}

.library-history-row strong {
  font-family: var(--font-display);
  font-size: 0.88rem;
}

.library-history-row time {
  color: var(--muted);
  font-size: 0.72rem;
}

.library-history-row p {
  grid-column: 2 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.library-history-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.library-history-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--leaf-dark);
  padding: 6px 9px;
  font-size: 0.72rem;
  font-weight: 780;
}

.library-history-actions button:hover,
.library-history-actions button:focus-visible {
  border-color: rgba(43, 115, 80, 0.36);
  background: #eef5ef;
  outline: none;
}

@media (max-width: 1000px) {
  .library-layout {
    grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.35fr);
  }

  .library-workspace {
    padding: 20px;
  }

  .library-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .library-heading {
    padding: 20px 18px 17px;
  }

  .library-heading h3 {
    font-size: 1.28rem;
  }

  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 14px;
  }

  .library-search {
    flex-basis: auto;
  }

  .library-view-switch {
    width: 100%;
  }

  .library-view-switch button {
    flex: 1 1 0;
  }

  .library-groups {
    padding: 9px 14px;
  }

  .library-layout {
    grid-template-columns: 1fr;
  }

  .library-catalog {
    max-height: 300px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .library-workspace {
    padding: 18px 14px;
  }

  .library-history-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px 14px;
  }

  .library-history-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .library-heading {
    display: grid;
    gap: 12px;
  }

  .library-count {
    justify-self: start;
  }

  .library-tool-heading h4 {
    font-size: 1.12rem;
  }

  .library-result .metrics {
    grid-template-columns: 1fr;
  }

  .library-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .library-actions .ghost-button,
  .library-actions .primary-action {
    width: 100%;
  }

  .library-history-header {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .library-history-row > div:first-child {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .library-history-row time,
  .library-history-row p {
    grid-column: 2;
  }
}
