/* Stock farms (app-farms.js). Built from the finish's pieces (finish.css tokens, cards, facts, the Markets table, the
   segmented control, Your APR, the risk card); only what they lack is here. Loaded before finish.css, so everything
   here uses the finish's tokens and stays quiet: hairlines, surfaces, mint for what earns, yellow for the one action. */

/* The totals: a strip of five figures, like the shelf's. */
.fm-sum {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 24px; border: 1px solid var(--line); border-radius: var(--r3);
  background: var(--surface); box-shadow: var(--e1); overflow: hidden;
}
.fm-fig { min-width: 0; padding: 18px 20px; border-left: 1px solid var(--line); }
.fm-fig:first-child { border-left: 0; }
.fm-fig span { display: block; font-size: 13px; font-weight: 500; color: var(--text-3); }
.fm-fig b { display: block; margin-top: 4px; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.03em; color: var(--text); white-space: nowrap; }
.fm-fig b.fm-mint { color: var(--mint); }
.fm-fig small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.fm-fig small:empty { display: none; }

/* The farms table: the Markets table's look; a row picks its farm. */
#fmTable { margin-top: 0; }
#fmTable > .empty { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.mt.fm-t { min-width: 1020px; }
.mt.fm-t th, .mt.fm-t td { padding-left: 9px; padding-right: 9px; }
.mt.fm-t th:first-child { padding-left: 18px; }
.mt.fm-t th:last-child, .mt.fm-t td:last-child { padding-right: 18px; }
.fm-t thead th { text-align: right; }
.fm-t thead th.c-sym { text-align: left; }
.fm-t tbody tr { cursor: pointer; }
.fm-t tbody tr:focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px; }
.fm-t tbody tr.on > * { background-color: var(--surface-2); }
.fm-t tbody tr.on > .c-sym { box-shadow: inset 3px 0 0 var(--yellow), 1px 0 0 var(--line); }
.fm-t .c-apr b { color: var(--mint); font-size: 16px; font-weight: 700; }
.fm-t b.ok { color: var(--mint); }
.fm-t b.warn { color: var(--yellow); }
.fm-t .c-split { min-width: 140px; }
.fm-split { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.fm-bar { display: flex; width: 120px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.fm-bar > i { display: block; height: 100%; }
.fm-bar > i.k { background: var(--text-3); }
.fm-bar > i.l { background: var(--mint); }

/* The form and the side column. */
.fm-cols { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); align-items: start; }
.fm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.fm-head h2 { margin: 0; }
.fm-card .yapr { margin-top: 0; }
.e-tag.e-lent { background: rgba(63, 224, 181, .13); color: var(--mint); }
.fm-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; align-items: start; }
.fm-side { min-width: 0; }
.fm-side .ethpay { margin-top: 8px; }
.fm-card .help:empty { display: none; }
#fmRatio { margin: 10px 0 0; }
.fm-slip, .fm-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fm-slip { margin: 14px 0 4px; font-size: 13.5px; color: var(--text-3); }
.fm-quick { margin-top: 10px; }
.fm-slip .chip, .fm-quick .chip {
  font: 600 13px/1.2 var(--ui); padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer;
}
.fm-slip .chip:hover, .fm-quick .chip:hover { color: var(--text); border-color: rgba(146, 156, 255, .45); }
.fm-slip .chip[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.fm-card .check { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 4px; }
.fm-card .check input { flex: none; margin-top: 4px; }
.fm-card .row-btns { margin-top: 16px; }
.fm-card .row-btns .btn { min-width: 160px; }
.fm-handed { padding: 10px 12px; border-radius: var(--r2); background: rgba(255, 216, 58, .06); box-shadow: inset 0 0 0 1px rgba(255, 216, 58, .26); color: var(--text-2); }
#fmState.ok { color: var(--mint); }
#fmState.warn { color: var(--yellow); }

/* Your farms: one block each, the value and its one APR on top. */
.fm-mine { display: grid; gap: 12px; }
.fm-pos { padding: 14px 16px; border-radius: var(--r2); background: var(--bg-2); border: 1px solid var(--line); }
.fm-pos-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fm-pos-name b, .fm-pos-val b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.fm-pos-name small, .fm-pos-val small { display: block; font-size: 12.5px; color: var(--text-3); }
.fm-pos-val { text-align: right; }
.fm-pos-val small { color: var(--mint); font-weight: 600; font-size: 13px; }
.fm-pos-facts { margin-top: 8px; }
.fm-pos-facts li { padding: 8px 0; font-size: 13.5px; }
.fm-pos-facts li:last-child { border-bottom: 0; }
.fm-earn { margin-top: 4px; }
.fm-pos .btn { margin-top: 8px; }

@media (max-width: 1100px) {
  .fm-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fm-fig:nth-child(4) { border-left: 0; }
  .fm-fig:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .fm-cols { grid-template-columns: minmax(0, 1fr); }
  .fm-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fm-fig:nth-child(n) { border-left: 0; border-top: 1px solid var(--line); }
  .fm-fig:nth-child(even) { border-left: 1px solid var(--line); }
  .fm-fig:first-child, .fm-fig:nth-child(2) { border-top: 0; }
  .fm-fig:last-child { grid-column: 1 / -1; border-left: 0; }
}
@media (max-width: 620px) {
  .fm-fig { padding: 14px 16px; }
  .fm-fig b { font-size: 24px; }
  .fm-two { grid-template-columns: minmax(0, 1fr); }
  .fm-card .row-btns .btn { width: 100%; }
}
