/* AgriLM Studio */
:root {
  color-scheme: light;
  --bg: #f6f7f2; --card: #ffffff; --ink: #1d2a1f; --muted: #5f6f60; --line: #dfe5d8;
  --brand: #2f7d32; --brand-ink: #ffffff; --brand-soft: #e7f3e3;
  --warn: #9a5b00; --warn-soft: #fff4e0; --bad: #b3261e; --user: #e9f1ff;
  --surface-1: #fcfcfb; --grid: #e4e6e0;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --ref: #8b8b85;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,40,20,.06), 0 4px 16px rgba(20,40,20,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f140f; --card: #171e17; --ink: #e6eee3; --muted: #9fb09c; --line: #2a352a;
    --brand: #6cc24a; --brand-ink: #0d1a0b; --brand-soft: #1d2b1b;
    --warn: #f0b35a; --warn-soft: #2b2214; --bad: #f2867f; --user: #1b2433;
    --surface-1: #1a1a19; --grid: #2c2f2b;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --ref: #9a9a92;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f140f; --card: #171e17; --ink: #e6eee3; --muted: #9fb09c; --line: #2a352a;
  --brand: #6cc24a; --brand-ink: #0d1a0b; --brand-soft: #1d2b1b;
  --warn: #f0b35a; --warn-soft: #2b2214; --bad: #f2867f; --user: #1b2433;
  --surface-1: #1a1a19; --grid: #2c2f2b;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --ref: #9a9a92;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
code { font-size: .9em; background: var(--brand-soft); padding: 1px 5px; border-radius: 5px; }
h1 { font-size: 30px; line-height: 1.15; margin: 4px 0 8px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 17px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 19px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs a { padding: 7px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 15px;
  white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.status { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.status.ok { color: var(--brand); border-color: var(--brand); }
.status.slow { color: var(--warn); border-color: var(--warn); }

/* layout */
.tab { padding-bottom: 40px; }
.hero { padding: 28px 0 14px; max-width: 760px; }
.hero.small { padding: 22px 0 8px; }
.hero.small h1 { font-size: 26px; }
.hero p { color: var(--muted); font-size: 16.5px; margin: 0; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); font-weight: 700; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin: 14px 0; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.grow { flex: 1; min-width: 180px; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface-1);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
.btn { font: inherit; font-size: 15px; font-weight: 600; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { background: none; }
.btn.small { font-size: 13px; padding: 5px 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link { font: inherit; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--line);
  font-size: 14px; margin: 14px 0; }
.note.ok { background: var(--brand-soft); }
.status-line { font-size: 14px; color: var(--muted); margin-top: 8px; min-height: 1em; }
.status-line.err { color: var(--bad); }
.badge { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.badge.ok { background: var(--brand-soft); color: var(--brand); }
.badge.plan { background: var(--warn-soft); color: var(--warn); }
.badge.run { background: var(--user); color: var(--series-1); }
.badge.bad { background: var(--warn-soft); color: var(--bad); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 10px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); }
.tile .v { font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.tile .k { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card .tiles .tile { box-shadow: none; background: var(--surface-1); }

/* ask */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { font: inherit; font-size: 14px; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--brand); }
.thread { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 160px; }
.msg { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg.user { background: var(--user); align-self: flex-end; max-width: 85%; }
.msg.bot { background: var(--card); box-shadow: var(--shadow); }
.msg .who { font-size: 12.5px; font-weight: 650; color: var(--brand); margin-bottom: 6px; display: flex; gap: 8px;
  align-items: center; flex-wrap: wrap; }
.answer { white-space: pre-wrap; }
.answer .fix { background: var(--brand-soft); border-bottom: 2px solid var(--brand); border-radius: 3px; }
.answer .unv { background: var(--warn-soft); border-bottom: 2px dotted var(--warn); border-radius: 3px; }
.foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.check { font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: var(--surface-1); color: var(--muted);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.check.ok { color: var(--brand); border-color: var(--brand); }
.check.warn { color: var(--warn); border-color: var(--warn); }
.detail { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-1);
  border: 1px solid var(--line); font-size: 13.5px; }
.detail .ref { white-space: pre-wrap; max-height: 240px; overflow: auto; margin-top: 6px; color: var(--ink); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: b 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes b { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { position: fixed; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, var(--bg) 78%, transparent);
  padding: 16px 0 10px; z-index: 5; }
.composer > * { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 50px; max-height: 160px; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; background: var(--card); }
.composer .btn { height: 50px; border-radius: var(--radius); }
.opts { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.opts label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
body:not(.on-ask) .composer { display: none; }

/* model */
.compare { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-1); }
.compare h3 { display: flex; justify-content: space-between; gap: 8px; }
.compare .txt { white-space: pre-wrap; font-size: 14.5px; max-height: 320px; overflow: auto; }
.compare .about { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.kv td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
table.kv td:first-child { color: var(--muted); width: 45%; }
.downloads { list-style: none; padding: 0; margin: 0 0 10px; }
.downloads li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14.5px; flex-wrap: wrap; }
pre.code { background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px;
  overflow-x: auto; white-space: pre; margin: 8px 0; }
pre.code.small { font-size: 12px; }
.bench-out { margin-top: 12px; }
.bench-out .tile .v { font-size: 34px; }

/* charts */
.chart { width: 100%; min-height: 60px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11.5px; }
.chart .lbl { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chart .lbl2 { fill: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0 8px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px;
  vertical-align: middle; background: var(--c); }
.legend span.dot::before { width: 9px; height: 9px; border-radius: 50%; }
.legend span.dash::before { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 18px rgba(0,0,0,.15); max-width: 260px; }
.tip b { font-weight: 650; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.dtable th, .dtable td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.dtable th:first-child, .dtable td:first-child { text-align: left; }

/* train + data */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 8px 0 4px; }
.stepc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; }
.stepc span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand);
  color: var(--brand-ink); font-size: 13px; font-weight: 700; margin-right: 6px; }
.stepc p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.method p { font-size: 14.5px; margin: 6px 0; }
.upl { display: grid; gap: 10px; }
.drop { display: flex; flex-direction: column; gap: 3px; border: 2px dashed var(--line); border-radius: 12px; padding: 16px;
  text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; }
.drop b { color: var(--ink); }
.drop.over, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop input { display: none; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-1); font-size: 14px; }
.item .t { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.item .t b { overflow-wrap: anywhere; }
.item p { margin: 6px 0 0; color: var(--muted); }
.item ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.item ol li.done { color: var(--brand); }
.item ol li.now { color: var(--ink); font-weight: 600; }
.item pre { max-height: 220px; overflow: auto; font-size: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; white-space: pre-wrap; }
.preview { font-size: 13px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.preview div { padding: 8px 10px; white-space: pre-wrap; }
.preview .p { background: var(--surface-1); color: var(--muted); }
.preview .a { background: var(--brand-soft); }
.preview small { display: block; font-weight: 650; margin-bottom: 3px; }
.jobform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.jobform label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.jobform fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; }
.jobform legend { font-size: 14px; color: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.docs { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.docs li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.docs li span { flex: 1; overflow-wrap: anywhere; }
.conn { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 10px; }
.conn p { color: var(--muted); margin: 6px 0 0; }
.tablewrap { overflow-x: auto; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th, table.log td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--muted); font-weight: 600; }
table.log td.q { min-width: 220px; }

@media (max-width: 820px) {
  .grid2, .grid3, .cols, .jobform { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 25px; }
  .msg.user { max-width: 100%; }
}

/* version picker (Ask) */
.picker { position: relative; display: inline-block; margin-bottom: 6px; }
.ver-btn { font: inherit; font-size: 15px; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 12px; cursor: pointer; box-shadow: var(--shadow); }
.ver-btn:hover, .ver-btn[aria-expanded="true"] { border-color: var(--brand); }
.ver-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(420px, 92vw); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; }
.ver-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; font: inherit; background: none;
  border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer; color: var(--ink); }
.ver-item:hover:not(:disabled), .ver-item.sel { background: var(--brand-soft); }
.ver-item:disabled { cursor: not-allowed; opacity: .6; }
.ver-top { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ver-top .tick { margin-left: auto; color: var(--brand); font-weight: 700; }
.ver-sum { font-size: 13.5px; }
.ver-meta { font-size: 12px; color: var(--muted); }
/* answer variants */
.vnav { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); font-weight: 600; }
.vnav button { font: inherit; background: none; border: 1px solid var(--line); border-radius: 7px; width: 24px; height: 24px;
  cursor: pointer; color: var(--ink); line-height: 1; padding: 0; }
.vnav button:disabled { opacity: .35; cursor: default; }
.msg .who { width: 100%; }
.alt { position: relative; }
.alt-menu { position: absolute; z-index: 15; bottom: calc(100% + 6px); left: 0; min-width: 200px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 4px; }
.alt-menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: 14px; background: none; border: 0;
  border-radius: 7px; padding: 7px 10px; cursor: pointer; color: var(--ink); }
.alt-menu button:hover { background: var(--brand-soft); }
/* version timeline (Model) */
.timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; background: var(--card); border: 3px solid var(--muted); }
.tl-current .tl-dot { border-color: var(--brand); background: var(--brand); }
.tl-available .tl-dot { border-color: var(--series-1); }
.tl-coming .tl-dot { border-style: dashed; }
.tl-body { flex: 1; min-width: 0; }
.tl-body p { margin: 3px 0; font-size: 14.5px; }
.tl-retired .tl-body { opacity: .75; }
.ver-origin { font-size: 12px; font-weight: 600; }
.ver-origin.own { color: var(--brand); }
.ver-origin.ext { color: var(--warn); }
.tl-body .ver-origin { display: block; margin: 2px 0; }
