*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark: #1e4d35;
  --green-mid: #2d6a4f;
  --green-light: #52b788;
  --green-pale: #d8f3dc;
  --cream: #f8fdf9;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-muted: #555;
  --border: #d0e8d8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 10px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

/* ── NAV ── */
nav {
  background: var(--green-dark);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
nav .logo {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
nav .logo span { color: var(--green-light); }

/* Desktop nav list */
nav > ul {
  display: flex;
  gap: 2px;
  list-style: none;
  flex-wrap: nowrap;
  align-items: center;
}
nav > ul > li > a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 6px 9px;
  border-radius: 6px;
  display: block;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
nav > ul > li > a:hover,
nav > ul > li > a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: auto;
  line-height: 1;
  flex-shrink: 0;
}

/* ── DROPDOWN (desktop hover) ── */
.has-dropdown { position: relative; }
.has-dropdown > a::after { content: ' ▾'; font-size: 0.6em; opacity: 0.6; }
.sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #162e23;
  min-width: 200px;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 500;
  padding: 14px 0 8px;
  list-style: none;
  border: 1px solid rgba(255,255,255,0.06);
}
.has-dropdown:hover .sub { display: block; }
.sub li a {
  display: block;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
}
.sub li a:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Two-column dropdowns for large menus */
@media (min-width: 1081px) {
  .sub.two-col {
    min-width: 420px;
    display: none;
  }
  .has-dropdown:hover .sub.two-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    padding: 14px 4px 8px;
  }
  .sub.two-col li a {
    white-space: normal;
    padding: 7px 14px;
  }
}

/* ── MOBILE NAV ── */
@media (max-width: 1080px) {
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  nav {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 0;
  }
  nav .logo { flex: 1; }

  nav > ul {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 8px;
  }
  nav > ul.open { display: flex; }

  nav > ul > li { width: 100%; }
  nav > ul > li > a {
    font-size: 1rem;
    padding: 12px 8px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  /* Show submenus inline on mobile */
  .sub {
    display: block !important;
    position: static;
    background: rgba(0,0,0,0.2);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    min-width: unset;
    width: 100%;
  }
  .sub li a {
    padding: 10px 10px 10px 28px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .has-dropdown > a::after { content: ''; }
}

/* ── HERO ── */
.hero {
  background: linear-gradient(150deg, #0f2d1e 0%, var(--green-dark) 50%, #1a5c3a 100%);
  color: #fff;
  padding: 64px 20px 52px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(82,183,136,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(1.9rem, 6vw, 3.2rem);
  margin-bottom: 14px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero h1 em { font-style: normal; color: var(--green-light); }
.hero p {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  opacity: 0.82;
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-stat {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 40px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
}
.hero-stat strong { color: var(--green-light); font-size: 1.05rem; font-weight: 700; }
@media (max-width: 480px) {
  .hero { padding: 44px 16px 36px; }
  .hero-stat { padding: 7px 14px; font-size: 0.82rem; }
}

/* ── LAYOUT ── */
.container { max-width: 860px; margin: 0 auto; padding: 24px 16px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* ── HOME CARDS ── */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
@media (max-width: 600px) {
  .calc-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 400px) {
  .calc-grid { grid-template-columns: 1fr; }
}
.calc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}
.calc-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green-mid), var(--green-light));
  opacity: 0;
  transition: opacity 0.18s;
}
.calc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.11);
  border-color: var(--green-light);
}
.calc-card:hover::after { opacity: 1; }
.calc-card:active { transform: translateY(0); }
.calc-card .icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  width: 44px;
  height: 44px;
  background: var(--green-pale);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc-card h3 { font-size: 0.93rem; color: var(--green-dark); margin-bottom: 6px; line-height: 1.3; font-weight: 700; }
.calc-card p { font-size: 0.81rem; color: var(--text-muted); line-height: 1.5; }
.calc-card .badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.68rem;
  background: var(--green-pale);
  color: var(--green-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
@media (max-width: 600px) {
  .calc-card { padding: 13px; border-radius: 10px; }
  .calc-card .icon { font-size: 1.4rem; width: 36px; height: 36px; margin-bottom: 8px; border-radius: 8px; }
  .calc-card h3 { font-size: 0.85rem; }
  .calc-card p { display: none; }
  .calc-card .badge { font-size: 0.65rem; margin-top: 7px; }
}

/* ── CATEGORY SECTIONS ── */
.cat-section { margin-top: 44px; }
.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cat-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: 0.01em;
}
.cat-header .cat-icon {
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  background: var(--green-pale);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-header .cat-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--green-pale);
  border-radius: 20px;
  padding: 3px 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── CALC PANEL ── */
.calc-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
@media (max-width: 600px) {
  .calc-panel { padding: 16px; border-radius: 8px; }
}
.calc-panel h2 {
  font-size: 1.2rem;
  color: var(--green-dark);
  margin-bottom: 18px;
  border-bottom: 2px solid var(--green-pale);
  padding-bottom: 10px;
}

/* ── FORM ── */
.field-group { margin-bottom: 16px; }
.field-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field-group label span { font-weight: 400; color: var(--text-muted); font-size: 0.82rem; }
.field-group input,
.field-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.15);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field-row-3 { grid-template-columns: 1fr; gap: 0; }
  .field-row .field-group,
  .field-row-3 .field-group { margin-bottom: 14px; }
}

/* ── BUTTON ── */
.btn {
  background: var(--green-mid);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
  touch-action: manipulation;
  min-height: 48px;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(0.98); }

/* ── RESULTS ── */
.results {
  display: none;
  margin-top: 20px;
  background: var(--green-pale);
  border: 1.5px solid var(--green-light);
  border-radius: var(--radius);
  padding: 20px;
}
.results.show { display: block; }
.results h3 { color: var(--green-dark); font-size: 1.05rem; margin-bottom: 14px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
@media (max-width: 560px) {
  .result-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
@media (max-width: 360px) {
  .result-grid { grid-template-columns: 1fr; }
}
.result-box {
  background: var(--white);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.result-box .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  line-height: 1.3;
}
.result-box .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.2;
  word-break: break-all;
}
.result-box .unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ── ANIMAL / DYNAMIC ROWS ── */
.animal-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.animal-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px 36px;
  gap: 8px;
  align-items: center;
}
@media (max-width: 560px) {
  .animal-row { grid-template-columns: 1fr 64px 64px 32px; gap: 6px; }
}
@media (max-width: 400px) {
  .animal-row { grid-template-columns: 1fr 58px 32px; }
  .animal-row .weight-input { display: none; }
}
.animal-row select,
.animal-row input {
  padding: 9px 8px;
  font-size: 0.88rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  width: 100%;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
}
.animal-row select:focus,
.animal-row input:focus {
  outline: none;
  border-color: var(--green-light);
}
.animal-row-header {
  display: grid;
  grid-template-columns: 1fr 80px 80px 36px;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 4px;
}
@media (max-width: 560px) {
  .animal-row-header { grid-template-columns: 1fr 64px 64px 32px; }
}
@media (max-width: 400px) {
  .animal-row-header { grid-template-columns: 1fr 58px 32px; }
  .animal-row-header .weight-col { display: none; }
}

.btn-remove {
  background: #fee2e2;
  border: none;
  border-radius: 6px;
  color: #dc2626;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  touch-action: manipulation;
}
.btn-remove:hover { background: #fca5a5; }

.btn-add {
  background: var(--green-pale);
  color: var(--green-dark);
  border: 1.5px dashed var(--green-light);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
  touch-action: manipulation;
  min-height: 44px;
}
.btn-add:hover { background: #b7e4c7; }

/* ── AD SLOT ── */
.ad-slot {
  background: #f0f0f0;
  border: 1.5px dashed #ccc;
  border-radius: 8px;
  text-align: center;
  color: #aaa;
  font-size: 0.8rem;
  padding: 10px;
  margin: 18px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── INFO SECTION ── */
.info-section { margin-top: 28px; }
.info-section h2 {
  font-size: 1.1rem;
  color: var(--green-dark);
  margin-bottom: 10px;
}
.info-section p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.info-section li { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 6px; }
.info-section ul { padding-left: 18px; }

/* ── PAGE HEADER ── */
.page-header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: #fff;
  padding: 28px 20px 24px;
}
@media (max-width: 600px) {
  .page-header { padding: 20px 16px 18px; }
}
.page-header h1 {
  font-size: clamp(1.25rem, 4vw, 1.9rem);
  margin-bottom: 6px;
  line-height: 1.2;
}
.page-header p {
  opacity: 0.85;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  max-width: 600px;
  line-height: 1.5;
}
.breadcrumb { font-size: 0.78rem; opacity: 0.7; margin-bottom: 8px; }
.breadcrumb a { color: inherit; text-decoration: underline; }

/* ── RESULT TIP BOX ── */
.result-tip {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.result-tip strong { color: var(--green-dark); }

/* ── FOOTER ── */
footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 24px 20px;
  font-size: 0.85rem;
  margin-top: 48px;
}
footer a { color: var(--green-light); text-decoration: none; }

/* ── CHECKBOX LIST (seed starting) ── */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .check-grid { grid-template-columns: 1fr 1fr; }
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s, background 0.15s;
}
.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--green-mid);
  cursor: pointer;
}
.check-item:has(input:checked) {
  border-color: var(--green-light);
  background: var(--green-pale);
}

/* ── RESULTS TABLE ── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 12px;
}
.results-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--green-mid);
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.results-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:nth-child(even) td { background: #f7fdf9; }
@media (max-width: 480px) {
  .results-table th, .results-table td { padding: 7px 8px; font-size: 0.82rem; }
}

/* ── DYNAMIC ITEM ROWS (CSA, solar, etc.) ── */
.item-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item-row {
  display: grid;
  gap: 8px;
  align-items: center;
}
.item-row input, .item-row select {
  padding: 9px 10px;
  font-size: 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  width: 100%;
  background: #fff;
}
.item-row input:focus, .item-row select:focus {
  outline: none;
  border-color: var(--green-light);
}

/* ── UTILITY ── */
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }
.hidden { display: none; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ── MOBILE INLINE GRID OVERRIDE ── */
/* Dynamic rows in calculators use inline grid styles — override to flex-wrap on mobile */
@media (max-width: 600px) {
  [style*="grid-template-columns"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
  }
  [style*="grid-template-columns"] > input,
  [style*="grid-template-columns"] > select {
    flex: 1 1 90px !important;
    min-width: 70px !important;
    max-width: 100% !important;
    padding: 9px 8px !important;
    font-size: 0.88rem !important;
  }
  /* First select/input in a row (usually name/type) gets full width */
  [style*="grid-template-columns"] > select:first-child,
  [style*="grid-template-columns"] > input[type="text"]:first-child {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
  [style*="grid-template-columns"] > .btn-remove {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 38px !important;
    margin-left: auto;
  }
  /* Header label rows above dynamic rows */
  [style*="grid-template-columns"] > div {
    flex: 1 1 70px !important;
    min-width: 50px !important;
    font-size: 0.7rem !important;
  }
  [style*="grid-template-columns"] > div:last-child:empty {
    display: none !important;
  }
  /* Inputs inside field-group inside calc-panel — ensure full width */
  .calc-panel input[type="number"],
  .calc-panel input[type="text"],
  .calc-panel input[type="time"],
  .calc-panel input[type="date"],
  .calc-panel select {
    font-size: 16px !important; /* prevents iOS zoom on focus */
  }
}

@media (max-width: 400px) {
  [style*="grid-template-columns"] > input,
  [style*="grid-template-columns"] > select {
    flex: 1 1 60px !important;
    min-width: 54px !important;
    padding: 8px 5px !important;
    font-size: 0.82rem !important;
  }
}

/* ── MOBILE NAV OVERLAY + PANEL ── */
#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 190;
  -webkit-tap-highlight-color: transparent;
}
#nav-overlay.show { display: block; }

body.nav-open { overflow: hidden; }

@media (max-width: 1080px) {
  nav > ul {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 82vw !important;
    max-width: 300px !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    background: var(--green-dark) !important;
    z-index: 300 !important;
    flex-direction: column !important;
    padding: 0 0 24px 0 !important;
    margin-top: 0 !important;
    border-top: none !important;
    transform: translateX(110%);
    transition: transform 0.25s ease;
    display: flex !important;
  }
  nav > ul.open {
    transform: translateX(0) !important;
  }

  /* Close button row */
  #nav-close-li {
    width: 100%;
    padding: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    background: var(--green-dark);
    z-index: 10;
  }
  #nav-close {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 18px;
    cursor: pointer;
    width: 100%;
    text-align: left;
  }
  #nav-close:hover { color: #fff; }

  /* Category parent links */
  nav > ul > li.has-dropdown > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px !important;
    font-size: 1rem !important;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  nav > ul > li.has-dropdown > a::after {
    content: '›' !important;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: transform 0.2s;
  }
  nav > ul > li.has-dropdown > a[data-open]::after,
  nav > ul > li:has(.accordion-open) > a::after {
    transform: rotate(90deg);
  }
  nav > ul > li:not(.has-dropdown) > a {
    padding: 14px 18px !important;
    font-size: 1rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  /* Sub menus — accordion, hidden by default */
  .sub {
    display: none !important;
    position: static !important;
    background: rgba(0,0,0,0.25) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
    min-width: unset !important;
    width: 100% !important;
  }
  .sub.accordion-open {
    display: block !important;
  }
  .sub li a {
    padding: 11px 18px 11px 32px !important;
    font-size: 0.92rem !important;
    border-bottom: 1px solid rgba(255,255,255,0.04) !important;
  }
  .has-dropdown > a::after { content: '' !important; }
}

/* ── MOBILE DYNAMIC ROW FIXES ── */
@media (max-width: 600px) {
  /* Make inline-styled grid rows wrap as flex */
  [style*="grid-template-columns"] {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
  }
  /* First select/input (breed, type, name) gets full row */
  [style*="grid-template-columns"] > select:first-child,
  [style*="grid-template-columns"] > input:first-child {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
  }
  /* Other inputs/selects share the remaining row */
  [style*="grid-template-columns"] > input:not(:first-child),
  [style*="grid-template-columns"] > select:not(:first-child) {
    flex: 1 1 80px !important;
    min-width: 60px !important;
    max-width: 140px !important;
    font-size: 16px !important;
    padding: 10px 8px !important;
  }
  /* Remove button always on right of second row */
  [style*="grid-template-columns"] > .btn-remove {
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 40px !important;
    margin-left: auto;
  }
  /* Header label divs */
  [style*="grid-template-columns"] > div {
    flex: 1 1 60px !important;
    font-size: 0.7rem !important;
    min-width: 0 !important;
  }
  [style*="grid-template-columns"] > div:last-child:empty {
    display: none !important;
  }
  /* Prevent iOS zoom on input focus */
  .calc-panel input,
  .calc-panel select,
  .calc-panel textarea {
    font-size: 16px !important;
  }
  .field-group input,
  .field-group select {
    font-size: 16px !important;
  }
}

/* Hide mobile close button on desktop */
@media (min-width: 1081px) {
  #nav-close-li { display: none !important; }
}
