.agc-calc, .agc-chart-wrap {
  --agc-primary: #2b5b43; --agc-primary-fg: #fbfaf4; --agc-card: #fff; --agc-secondary: #f1f1e6;
  --agc-muted: #6b7a70; --agc-border: #dfe3d6; --agc-text: #1f2e26; --agc-warn-bg: #fbf3d3; --agc-warn-fg: #6b5410;
}
@supports (color: oklch(0 0 0)) {
  .agc-calc, .agc-chart-wrap {
    --agc-primary: oklch(0.38 0.075 155); --agc-primary-fg: oklch(0.985 0.008 95);
    --agc-secondary: oklch(0.955 0.014 100); --agc-muted: oklch(0.5 0.02 140);
    --agc-text: oklch(0.24 0.02 150); --agc-warn-bg: oklch(0.955 0.055 85); --agc-warn-fg: oklch(0.4 0.07 70);
  }
}
.agc-calc { max-width: 720px; margin: 1.5rem auto; padding: 1.4rem; border: 1px solid var(--agc-border);
  border-radius: 24px; background: var(--agc-card); color: var(--agc-text); box-shadow: 0 18px 40px -28px rgba(23, 60, 42, .45); }
.agc-calc *, .agc-calc *::before, .agc-calc *::after { box-sizing: border-box; }
.agc-title { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.agc-form { margin-top: 1rem; display: grid; gap: 1rem; }
.agc-controls { display: grid; gap: 1rem; }
.agc-field { display: grid; gap: .35rem; align-content: start; }
.agc-field > label, .agc-label { font-size: .875rem; font-weight: 500; }
.agc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.agc-calc { font-size: 1rem; line-height: 1.5; }
/* Fixed size (not inherited): block themes set a large body font, which also blows up the native dropdown list. */
.agc-calc select, .agc-calc input[type="date"] { width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--agc-border);
  border-radius: 10px; background: var(--agc-card); color: inherit; font-family: inherit; font-size: 1rem; font-weight: 400; line-height: 1.4; }
.agc-calc option, .agc-calc optgroup { font-size: 1rem; font-weight: 400; line-height: 1.4; }
.agc-calc optgroup { font-weight: 600; }
.agc-calc select:focus-visible, .agc-calc input:focus-visible, .agc-calc button:focus-visible { outline: 2px solid var(--agc-primary); outline-offset: 2px; }
.agc-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--agc-secondary); }
.agc-seg button { min-height: 40px; padding: .45rem .6rem; border: 0; border-radius: 10px; background: transparent; color: var(--agc-muted);
  font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; }
.agc-seg button[aria-checked="true"] { background: var(--agc-card); color: var(--agc-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.agc-note { margin: .2rem 0 0; font-size: .78rem; color: var(--agc-muted); }
.agc-warn { margin: 0; padding: .6rem .9rem; border-radius: 12px; background: var(--agc-warn-bg); color: var(--agc-warn-fg); font-size: .8rem; line-height: 1.5; }
.agc-warn summary { cursor: pointer; font-weight: 600; }
.agc-warn p { margin: .5rem 0 0; }
.agc-result { margin-top: 1.4rem; padding: 1.1rem; border-radius: 18px; background: var(--agc-secondary); min-height: 150px; }
.agc-eyebrow { margin: 0; font-size: .72rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--agc-muted); }
.agc-big { margin: .25rem 0 0; font-size: clamp(1.7rem, 6vw, 2.6rem); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--agc-primary); }
.agc-range { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.agc-range > div { background: var(--agc-card); border-radius: 12px; padding: .7rem .8rem; display: grid; gap: .1rem; }
.agc-range span { font-size: .75rem; color: var(--agc-muted); }
.agc-range b { font-size: .9rem; }
.agc-progress { margin-top: 1.2rem; }
.agc-prow { display: flex; justify-content: space-between; gap: 1rem; font-size: .875rem; }
.agc-prow span { color: var(--agc-muted); }
.agc-bar { height: 10px; margin-top: .5rem; border-radius: 999px; background: #e3e5d8; overflow: hidden; }
.agc-bar span { display: block; height: 100%; border-radius: 999px; background: var(--agc-primary); transition: width .3s; }
.agc-h { margin: 1.4rem 0 .4rem; font-size: .9rem; font-weight: 600; }
.agc-table-wrap, .agc-chart-wrap { overflow-x: auto; }
.agc-table, .agc-chart { width: 100%; border-collapse: collapse; font-size: .875rem; text-align: left; }
.agc-table th, .agc-table td { padding: .5rem .4rem; border-top: 1px solid rgba(0, 0, 0, .08); }
.agc-table thead th { border-top: 0; font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--agc-muted); }
.agc-table td:first-child { font-variant-numeric: tabular-nums; }
.agc-r { text-align: right !important; font-variant-numeric: tabular-nums; }
.agc-past { color: rgba(0, 0, 0, .4); }
.agc-soon { background: rgba(43, 91, 67, .1); color: var(--agc-primary); font-weight: 500; }
.agc-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.agc-actions button { min-height: 40px; padding: .45rem .9rem; border: 1px solid var(--agc-border); border-radius: 10px; background: var(--agc-card);
  color: var(--agc-text); font-family: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; }
.agc-actions button:hover { background: var(--agc-secondary); }
.agc-disclaimer { margin: 1.1rem 0 0; font-size: .75rem; color: var(--agc-muted); }
.agc-hint { margin: 0; padding: 2rem 0; text-align: center; font-size: .875rem; color: var(--agc-muted); }
.agc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
/* Server-rendered chart */
.agc-chart { background: var(--agc-card, #fff); border: 1px solid var(--agc-border, #dfe3d6); }
.agc-chart th, .agc-chart td { padding: .6rem .75rem; border-bottom: 1px solid var(--agc-border, #dfe3d6); }
.agc-chart thead th { background: var(--agc-secondary, #f1f1e6); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
/* Reviewed line, related links, FAQ */
.agc-reviewed { max-width: 720px; margin: -.5rem auto 1.5rem; font-size: .8rem; color: #6b7a70; text-align: center; }
.agc-related { max-width: 720px; margin: 1.5rem auto; }
.agc-related-title { margin: 0 0 .5rem; font-weight: 600; }
.agc-related ul { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.agc-related a { display: inline-block; padding: .4rem .85rem; border: 1px solid #dfe3d6; border-radius: 999px; font-size: .9rem; text-decoration: none; }
.agc-related a:hover { background: #f1f1e6; }
.agc-faq { max-width: 720px; margin: 1.5rem auto; }
.agc-q { border-bottom: 1px solid #dfe3d6; }
.agc-q summary { padding: .8rem 0; font-size: 1rem; font-weight: 600; cursor: pointer; }
.agc-a { padding: 0 0 .8rem; font-size: 1rem; line-height: 1.55; }
.agc-a p { margin: 0 0 .6rem; }
/* Herd planner */
.agc-herd textarea { width: 100%; padding: .6rem; border: 1px solid var(--agc-border); border-radius: 10px; font: .8rem/1.4 ui-monospace, Menlo, Consolas, monospace; color: inherit; background: var(--agc-card); }
.agc-herd input[type="text"] { width: 100%; min-height: 44px; padding: .5rem .7rem; border: 1px solid var(--agc-border); border-radius: 10px; background: var(--agc-card); color: inherit; font-family: inherit; font-size: 1rem; }
.agc-herd .agc-form .agc-actions { margin-top: 0; }
.agc-paste summary { cursor: pointer; font-size: .875rem; font-weight: 500; padding: .3rem 0; }
.agc-paste { display: grid; gap: .5rem; }
.agc-muted { color: var(--agc-muted); }
.agc-x { min-height: 32px; min-width: 32px; padding: 0 .5rem; border: 1px solid var(--agc-border); border-radius: 8px; background: var(--agc-card); color: var(--agc-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.agc-more { display: block; width: 100%; margin-top: .5rem; min-height: 40px; padding: .45rem .9rem; border: 1px dashed var(--agc-border); border-radius: 10px; background: var(--agc-card); color: var(--agc-primary); font-family: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; }
.agc-more:hover { background: var(--agc-secondary); }
.agc-sel td { font-weight: 600; color: var(--agc-primary); }
.agc-tag { margin-left: .35rem; padding: .05rem .4rem; border-radius: 999px; background: var(--agc-secondary); font-size: .68rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.agc-extra { display: none; }
@media print { .agc-more { display: none; } .agc-extra { display: table-row; } }
.agc-weeks td:nth-child(2) { min-width: 12rem; }
.agc-weeks td:nth-child(3) { white-space: nowrap; }
/* Searchable species picker */
.agc-field { position: relative; }
.agc-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: -1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0, 0, 0, 0); opacity: 0; pointer-events: none; }
.agc-combo { position: relative; }
.agc-calc .agc-combo-input { width: 100%; min-height: 48px; padding: .55rem 2.4rem .55rem 2.5rem; border: 1px solid var(--agc-border); border-radius: 12px; background: var(--agc-card); color: inherit;
  font-family: inherit; font-size: 1rem; font-weight: 500; line-height: 1.4; cursor: text; transition: border-color .15s, box-shadow .15s; }
.agc-calc .agc-combo-input::placeholder { color: var(--agc-muted); font-weight: 400; }
.agc-calc .agc-combo-input:hover { border-color: #c3cab6; }
.agc-calc .agc-combo-input:focus, .agc-open .agc-combo-input { outline: none; border-color: var(--agc-primary); box-shadow: 0 0 0 3px rgba(43, 91, 67, .16); }
.agc-combo-icon, .agc-combo-caret { position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--agc-muted); pointer-events: none; }
.agc-combo-icon { left: .85rem; }
.agc-combo-caret { right: .8rem; pointer-events: auto; cursor: pointer; transition: transform .15s; }
.agc-open .agc-combo-caret { transform: rotate(180deg); }
.agc-combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); max-height: min(340px, 55vh); overflow-y: auto; overscroll-behavior: contain;
  padding: .35rem; border: 1px solid var(--agc-border); border-radius: 14px; background: var(--agc-card); box-shadow: 0 18px 40px -12px rgba(23, 60, 42, .35); }
.agc-combo-list[hidden] { display: none; }
.agc-combo-group { position: sticky; top: -.35rem; z-index: 1; margin: 0 -.35rem; padding: .5rem .9rem .3rem; background: var(--agc-card); color: var(--agc-muted); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.agc-combo-opt { position: relative; padding: .6rem .9rem; border-radius: 9px; font-size: 1rem; line-height: 1.3; cursor: pointer; }
.agc-combo-opt.agc-active { background: var(--agc-secondary); }
.agc-combo-opt[aria-selected="true"] { color: var(--agc-primary); font-weight: 600; padding-right: 2.2rem; }
.agc-combo-opt[aria-selected="true"]::after { content: ""; position: absolute; right: .9rem; top: 50%; width: 5px; height: 10px; margin-top: -7px; border: solid var(--agc-primary); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.agc-combo-empty { padding: 1rem; text-align: center; color: var(--agc-muted); font-size: .9rem; }
@media (prefers-reduced-motion: reduce) { .agc-combo-caret, .agc-calc .agc-combo-input { transition: none; } }
@media print { .agc-combo-list { display: none; } }
@media print {
  .agc-form, .agc-actions { display: none !important; }
  .agc-calc { border: 0; box-shadow: none; padding: 0; }
  .agc-result { background: #fff; }
}

/* Breathing room between the action buttons and the sections after them */
.agc-calc:not(.agc-herd) .agc-actions + * { margin-top: 1.75rem; }

/* Printable breeding-date to due-date chart */
.agc-dc { margin: 0; }
.agc-dc-note { margin: 0 0 1.2rem; font-size: .9rem; color: var(--agc-muted, #5d6b62); }
.agc-dc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.agc-dc-month { width: 100%; border-collapse: collapse; background: var(--agc-card, #fff); border: 1px solid var(--agc-border, #dfe3d6); border-radius: 14px; overflow: hidden; font-size: .85rem; font-variant-numeric: tabular-nums; }
.agc-dc-month caption { padding: .6rem .9rem; text-align: left; font-weight: 700; background: var(--agc-secondary, #f1efe7); border: 1px solid var(--agc-border, #dfe3d6); border-bottom: 0; border-radius: 14px 14px 0 0; caption-side: top; }
.agc-dc-month th { padding: .35rem .9rem; text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--agc-muted, #5d6b62); border-bottom: 1px solid var(--agc-border, #dfe3d6); }
.agc-dc-month td { padding: .22rem .9rem; border-bottom: 1px solid rgba(0, 0, 0, .05); }
.agc-dc-month tbody tr:nth-child(even) td { background: rgba(0, 0, 0, .02); }
.agc-dc-month td:first-child { font-weight: 600; width: 3.2rem; }
.agc-dc-y { margin-left: .25rem; font-size: .75rem; color: var(--agc-muted, #5d6b62); }
@media print {
  .agc-dc-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .agc-dc-month { font-size: 8.5pt; break-inside: avoid; }
  .agc-dc-month td { padding: .1rem .5rem; }
}

/* Optional own gestation length */
.agc-custom { margin-top: .9rem; }
.agc-custom > summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--agc-primary, #2b5b43); }
.agc-custom .agc-field { margin-top: .7rem; max-width: 18rem; }
.agc-customnote { margin-top: .5rem; font-weight: 600; }
@media print { .agc-custom { display: none; } }

/* Reserve space before the script draws the calculator, to avoid layout shift. */
.agc-calc:empty { min-height: 600px; }
@media (max-width: 700px) { .agc-calc:empty { min-height: 640px; } }
