/* ============================================================
   무인화 노지 스마트팜 — 농가 앱 (MVP 프로토타입)
   화면 시안(인삼/블루베리)의 .a-* UI 시스템을 앱 셸로 이식

   토큰 규칙
   - 공통 상태색(ok/warn/crit/run/frost)은 품종 무관
   - 품종별로 갈리는 것은 바탕/먹색/브랜드 계열뿐
     ginseng   = 녹색 계열 (기본)
     blueberry = 보라 계열
   ============================================================ */

/* ---------- LIGHT · 인삼(기본) ---------- */
:root {
  --ground:      #E9ECE8;
  --ground-2:    #DFE4DF;
  --surface:     #FFFFFF;
  --surface-2:   #F3F5F2;
  --line:        #D3DAD5;
  --line-soft:   #E4E9E5;

  --ink:         #111815;
  --ink-2:       #3D4842;
  --muted:       #69736E;
  --faint:       #98A29D;

  --brand:       #0F3B2D;
  --brand-ink:   #FFFFFF;
  --brand-soft:  #E2EDE7;

  --ok:          #1B8F52;
  --warn:        #C97B0A;
  --crit:        #C8372A;
  --idle:        #98A29D;
  --run:         #1C6FB8;
  --frost:       #0E7C9B;

  --ok-bg:       #E3F3EA;
  --warn-bg:     #FBEFD9;
  --crit-bg:     #FAE6E3;
  --idle-bg:     #ECEFEC;
  --run-bg:      #E1EDF8;
  --frost-bg:    #DFF1F6;

  --shadow-sm: 0 1px 2px rgba(17,24,21,.06), 0 1px 1px rgba(17,24,21,.04);
  --shadow-md: 0 4px 16px rgba(17,24,21,.08), 0 1px 3px rgba(17,24,21,.06);
  --shadow-lg: 0 24px 60px rgba(17,24,21,.16), 0 4px 14px rgba(17,24,21,.10);

  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", "맑은 고딕", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "D2Coding", monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

/* ---------- LIGHT · 블루베리 ---------- */
:root[data-crop="blueberry"] {
  --ground:      #ECEAEF;
  --ground-2:    #E1DEE7;
  --surface:     #FFFFFF;
  --surface-2:   #F4F3F7;
  --line:        #D6D2DE;
  --line-soft:   #E6E3EC;

  --ink:         #16131C;
  --ink-2:       #423D4D;
  --muted:       #6B6676;
  --faint:       #9B95A6;

  --brand:       #3B2E5E;
  --brand-ink:   #FFFFFF;
  --brand-soft:  #EAE5F3;

  --idle:        #9B95A6;
  --idle-bg:     #EDEBF1;

  --shadow-sm: 0 1px 2px rgba(22,19,28,.06), 0 1px 1px rgba(22,19,28,.04);
  --shadow-md: 0 4px 16px rgba(22,19,28,.08), 0 1px 3px rgba(22,19,28,.06);
  --shadow-lg: 0 24px 60px rgba(22,19,28,.18), 0 4px 14px rgba(22,19,28,.10);
}

/* ---------- DARK 토큰 (품종별) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:     #0C110F;  --ground-2:   #141B18;
    --surface:    #161D1A;  --surface-2:  #1D2622;
    --line:       #2A342F;  --line-soft:  #222B27;
    --ink:        #E7ECE8;  --ink-2:      #C2CCC7;
    --muted:      #8B9691;  --faint:      #6B7570;
    --brand:      #4FA383;  --brand-ink:  #06120D;  --brand-soft: #17332A;
    --ok:         #43BC7C;  --warn:       #E0A03C;  --crit:       #E8695A;
    --idle:       #7B857F;  --run:        #59A0DC;  --frost:      #4FB6D0;
    --ok-bg:      #122A1F;  --warn-bg:    #2E2413;  --crit-bg:    #301A17;
    --idle-bg:    #1E2622;  --run-bg:     #14252F;  --frost-bg:   #102C34;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
    --shadow-md: 0 4px 16px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  }
  :root:not([data-theme="light"])[data-crop="blueberry"] {
    --ground:     #0E0C12;  --ground-2:   #17141D;
    --surface:    #1A1722;  --surface-2:  #221E2C;
    --line:       #322D3E;  --line-soft:  #282435;
    --ink:        #E9E6EF;  --ink-2:      #C6C1D2;
    --muted:      #918BA0;  --faint:      #6E6880;
    --brand:      #A394D9;  --brand-ink:  #120E1E;  --brand-soft: #241E3A;
    --idle:       #7E7890;  --idle-bg:    #221E2C;
  }
}

:root[data-theme="dark"] {
  --ground:     #0C110F;  --ground-2:   #141B18;
  --surface:    #161D1A;  --surface-2:  #1D2622;
  --line:       #2A342F;  --line-soft:  #222B27;
  --ink:        #E7ECE8;  --ink-2:      #C2CCC7;
  --muted:      #8B9691;  --faint:      #6B7570;
  --brand:      #4FA383;  --brand-ink:  #06120D;  --brand-soft: #17332A;
  --ok:         #43BC7C;  --warn:       #E0A03C;  --crit:       #E8695A;
  --idle:       #7B857F;  --run:        #59A0DC;  --frost:      #4FB6D0;
  --ok-bg:      #122A1F;  --warn-bg:    #2E2413;  --crit-bg:    #301A17;
  --idle-bg:    #1E2622;  --run-bg:     #14252F;  --frost-bg:   #102C34;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
}
:root[data-theme="dark"][data-crop="blueberry"] {
  --ground:     #0E0C12;  --ground-2:   #17141D;
  --surface:    #1A1722;  --surface-2:  #221E2C;
  --line:       #322D3E;  --line-soft:  #282435;
  --ink:        #E9E6EF;  --ink-2:      #C6C1D2;
  --muted:      #918BA0;  --faint:      #6E6880;
  --brand:      #A394D9;  --brand-ink:  #120E1E;  --brand-soft: #241E3A;
  --idle:       #7E7890;  --idle-bg:    #221E2C;
}

/* ============================================================
   RESET / SHELL
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 데스크톱: 폰 프레임 안에 앱을 넣어 시연 / 모바일: 전체 화면 */
.device {
  position: relative; width: 100%; height: 100%;
  background: var(--surface); overflow: hidden;
  display: flex; flex-direction: column;
}

@media (min-width: 720px) {
  body {
    display: grid; place-items: center;
    background: var(--ground-2);
    padding: 20px;
  }
  .device {
    width: 390px; height: min(844px, calc(100vh - 40px));
    border: 10px solid #1A211E; border-radius: 44px;
    box-shadow: var(--shadow-lg);
  }
  :root[data-theme="dark"] .device { border-color: #2C3733; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .device { border-color: #2C3733; }
  }
  .device::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 130px; height: 26px; background: #1A211E;
    border-radius: 0 0 16px 16px; z-index: 60;
  }
  :root[data-theme="dark"] .device::before { background: #2C3733; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .device::before { background: #2C3733; }
  }
  .statusbar { display: flex !important; }
}

/* 상단 상태바(데스크톱 폰 프레임에서만 노출) */
.statusbar {
  display: none; flex: none;
  height: 44px; align-items: center; justify-content: space-between;
  padding: 0 22px; font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--ink); background: var(--surface); position: relative; z-index: 50;
}
.statusbar-right { display: flex; gap: 5px; align-items: center; letter-spacing: -.02em; }

/* 스크롤 영역 */
.viewport {
  flex: 1; min-height: 0; position: relative;
  overflow-y: auto; overflow-x: hidden;
  background: var(--surface-2);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.viewport::-webkit-scrollbar { width: 4px; }
.viewport::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in .16s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   IN-APP UI  (senior-first sizing) — 시안 공통 시스템
   ============================================================ */
.a-bar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line-soft);
  padding: 13px 18px; display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.a-bar-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.a-bar-title strong { font-size: 19px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.a-bar-title small { font-size: 13px; color: var(--muted); }
.a-bar-actions { display: flex; gap: 6px; align-items: center; flex: none; }

/* 지금 보고 있는 밭 (인삼 / 블루베리) */
.a-bar-crop {
  flex: none; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  padding: 3px 9px; border-radius: 20px; white-space: nowrap; letter-spacing: 0;
}

/* 상단 아이콘 — 시니어 사용을 고려해 크게 (터치 영역 48px) */
.a-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 24px; line-height: 1; position: relative;
}
.a-icon svg { display: block; }
.a-icon:active { background: var(--ground-2); }
.a-badge {
  position: absolute; top: -1px; right: -3px; min-width: 21px; height: 21px;
  border-radius: 11px; background: var(--crit); color: #fff;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  display: grid; place-items: center; padding: 0 5px;
  border: 2px solid var(--surface);
}
.a-back { font-size: 27px; color: var(--ink); width: 36px; height: 44px; flex: none; text-align: left; line-height: 1; }

.a-body { padding: 16px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 16px; font-size: 16px; }
.a-body.flush { padding: 0 0 24px; }

.a-card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.a-card-pad { padding: 16px; }
.a-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line-soft);
}
.a-card-head h4 { font-size: 16px; font-weight: 700; }
.a-card-head .a-link { font-size: 13.5px; color: var(--brand); font-weight: 600; }

.a-sec-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 0;
}

.a-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 12.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
}
.a-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p-ok    { background: var(--ok-bg);    color: var(--ok); }
.p-warn  { background: var(--warn-bg);  color: var(--warn); }
.p-crit  { background: var(--crit-bg);  color: var(--crit); }
.p-idle  { background: var(--idle-bg);  color: var(--muted); }
.p-run   { background: var(--run-bg);   color: var(--run); }
.p-frost { background: var(--frost-bg); color: var(--frost); }

.a-num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.a-num-xxl { font-size: 40px; font-weight: 700; line-height: 1.05; }
.a-num-xl { font-size: 30px; font-weight: 700; line-height: 1.1; }
.a-num-lg { font-size: 22px; font-weight: 700; line-height: 1.15; }
.a-num-md { font-size: 17px; font-weight: 600; }
.a-unit { font-size: .6em; font-weight: 500; color: var(--muted); margin-left: 2px; }
.a-stamp { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: -.01em; }

.a-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-family: var(--sans); font-size: 17px; font-weight: 600;
  transition: transform .1s ease, opacity .1s ease;
}
.a-btn:active { transform: scale(.99); opacity: .9; }
.a-btn[disabled] { opacity: .5; pointer-events: none; }
.a-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); min-height: 62px; font-size: 18px; }
.a-btn-danger  { background: var(--crit); border-color: var(--crit); color: #fff; min-height: 60px; font-size: 18px; font-weight: 700; }
.a-btn-frost   { background: var(--frost); border-color: var(--frost); color: #fff; min-height: 64px; font-size: 19px; font-weight: 700; }
.a-btn-sm { min-height: 42px; font-size: 14px; width: auto; padding: 0 14px; }
.a-btn-row { display: flex; gap: 10px; }

/* 탭바는 .viewport 밖(#tabbar)에 그려져 스크롤과 무관하게 하단에 남습니다 */
.tabbar-host { flex: none; }

.a-tabbar {
  height: 80px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center;
}
.a-tabbar button { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--faint); height: 100%; justify-content: center; }
.a-tabbar button.on { color: var(--brand); }
.a-tabbar .ic { font-size: 21px; line-height: 1; }
.a-tabbar .lb { font-size: 12px; font-weight: 700; }
.a-tabbar .ic { position: relative; }
.a-tabbar .tab-badge {
  position: absolute; top: -4px; right: -10px; min-width: 16px; height: 16px;
  border-radius: 8px; background: var(--crit); color: #fff;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center; padding: 0 4px;
}

.a-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); width: 100%; text-align: left; }
.a-row:last-child { border-bottom: 0; }
.a-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.a-row-main .t { font-size: 16.5px; font-weight: 600; }
.a-row-main .s { font-size: 13.5px; color: var(--muted); }
.a-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }

.a-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 0; }
.a-kv + .a-kv { border-top: 1px solid var(--line-soft); }
.a-kv .k { font-size: 16px; color: var(--ink-2); }
.a-kv .v { display: flex; align-items: baseline; gap: 8px; }

.a-meter { height: 8px; border-radius: 4px; background: var(--ground-2); overflow: hidden; }
.a-meter i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .4s ease; }
.a-meter i.crit  { background: var(--crit); }
.a-meter i.ok    { background: var(--ok); }
.a-meter i.run   { background: var(--run); }
.a-meter i.warn  { background: var(--warn); }
.a-meter i.frost { background: var(--frost); }

.a-alert { display: flex; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.a-alert .stripe { width: 5px; flex: none; }
.a-alert.crit .stripe  { background: var(--crit); }
.a-alert.warn .stripe  { background: var(--warn); }
.a-alert.ok .stripe    { background: var(--ok); }
.a-alert.frost .stripe { background: var(--frost); }
.a-alert-body { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.a-alert-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.a-alert-top .t { font-size: 16.5px; font-weight: 700; }
.a-alert-top .s { font-size: 13.5px; color: var(--muted); margin-top: 3px; }

.a-input {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 52px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface); font-size: 16px;
}
textarea.a-input {
  min-height: 100px; padding: 14px; resize: none;
  font-family: var(--sans); color: var(--ink); line-height: 1.55; display: block; width: 100%;
}
textarea.a-input::placeholder { color: var(--faint); }
.a-input .ph { color: var(--faint); }
.a-field { display: flex; flex-direction: column; gap: 7px; }
.a-field-label { font-size: 14px; font-weight: 700; color: var(--muted); }

.a-banner { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border-radius: var(--r-md); font-size: 14.5px; line-height: 1.55; }
.a-banner .ic { flex: none; font-size: 15px; line-height: 1.4; }
.b-info  { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft); }
.b-warn  { background: var(--warn-bg); color: var(--warn); }
.b-crit  { background: var(--crit-bg); color: var(--crit); }
.b-ok    { background: var(--ok-bg); color: var(--ok); }
.b-frost { background: var(--frost-bg); color: var(--frost); }
.a-banner strong { font-weight: 700; }

.a-day-label { font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; color: var(--muted); padding: 6px 2px 0; }

/* 3초 판단 블록 */
.a-verdict { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 18px 24px; text-align: center; }
.a-verdict .mark { font-size: 46px; line-height: 1; }
.a-verdict .head { font-size: 27px; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
.a-verdict .sub { font-size: 15.5px; color: var(--muted); }

/* 사진 스트립 */
.a-photos { display: flex; gap: 10px; }
.a-photo { flex: 1; aspect-ratio: 1; border-radius: var(--r-md); background: var(--ground-2); display: grid; place-items: center; font-size: 26px; color: var(--faint); border: 1px solid var(--line-soft); position: relative; }
.a-photo .cap { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* 촬영 이미지 자리 (서버 연동 시 <img>로 교체) */
.a-shot { border-radius: var(--r-lg); background: var(--ground-2); display: grid; place-items: center; border: 1px solid var(--line-soft); position: relative; overflow: hidden; }
.a-shot .glyph { font-size: 52px; }
.a-shot .bbox { position: absolute; border: 3px solid var(--crit); border-radius: 6px; }
.a-shot .a-stamp { position: absolute; bottom: 10px; right: 12px; }

/* 레일 맵 / 도해 */
.a-map { position: relative; background: var(--ground-2); }
.a-map svg { display: block; width: 100%; height: auto; }
.a-map-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 11px 16px; background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.a-legend-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.a-legend-sw { width: 13px; height: 13px; border-radius: 3px; flex: none; }

.a-figure { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line-soft); padding: 10px; }
.a-figure svg { display: block; width: 100%; height: auto; }

.a-choice { display: flex; flex-direction: column; gap: 10px; }

.a-chart { padding: 4px 4px 0; }
.a-chart svg { display: block; width: 100%; height: auto; }
.a-chart-x { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--faint); padding: 5px 2px 0; }

.a-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.a-stat { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.a-stat .lb { font-size: 13px; color: var(--muted); }
.a-stat .cmp { font-size: 12.5px; font-weight: 600; }

.a-check { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.a-check:last-child { border-bottom: 0; }
.a-check .bx { width: 22px; height: 22px; border-radius: 5px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--ok-bg); color: var(--ok); margin-top: 1px; }
.a-check .bx.no { background: var(--idle-bg); color: var(--faint); }
.a-check .bx.step { background: var(--brand-soft); color: var(--brand); }
.a-check-main { flex: 1; }
.a-check-main .t { font-size: 15.5px; font-weight: 600; }
.a-check-main .s { font-size: 13px; color: var(--muted); }

/* ============================================================
   앱 셸 전용 — 부팅 / 농장 선택 / 로딩 / 토스트 / 데모 패널
   ============================================================ */

/* 부팅 화면 */
.boot {
  position: absolute; inset: 0; z-index: 90;
  background: var(--brand); color: var(--brand-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .3s ease, visibility .3s ease;
}
.boot.is-hidden { opacity: 0; visibility: hidden; }
.boot .logo { font-size: 54px; }
.boot h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.boot p { font-size: 14px; opacity: .8; }
.boot .spinner { margin-top: 6px; }

/* 농장 선택 */
.picker { position: absolute; inset: 0; z-index: 45; background: var(--surface-2); overflow-y: auto; }
/* 상태바가 보이는 폰 프레임에서는 그 아래에서 시작합니다 */
@media (min-width: 720px) { .picker { top: 44px; } }
.picker-inner { padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.picker-head { display: flex; flex-direction: column; gap: 6px; }
.picker-head h2 { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.picker-head p { font-size: 15px; color: var(--muted); }
.farm-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 16px; box-shadow: var(--shadow-sm);
}
.farm-card .glyph { font-size: 34px; flex: none; }
.farm-card .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.farm-card .body .t { font-size: 18px; font-weight: 700; }
.farm-card .body .s { font-size: 13.5px; color: var(--muted); }
.farm-card .arrow { font-size: 20px; color: var(--faint); flex: none; }

/* 로딩 */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; opacity: .9;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-veil {
  position: absolute; inset: 0; z-index: 45;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  display: none; align-items: flex-start; justify-content: center; padding-top: 120px;
  color: var(--brand);
}
.loading-veil.on { display: flex; }
.loading-veil .box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.loading-veil .msg { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* 스켈레톤 */
.skeleton { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sk-line { height: 14px; border-radius: 7px; background: var(--ground-2); animation: pulse 1.2s ease-in-out infinite; }
.sk-block { height: 120px; border-radius: var(--r-lg); background: var(--ground-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* 토스트 */
.toast-host { position: absolute; left: 0; right: 0; bottom: 96px; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 100%; background: var(--ink); color: var(--surface);
  border-radius: var(--r-md); padding: 13px 16px; font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow-md); animation: toast-in .18s ease-out;
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 데이터 출처 배지 — 시연에서 "서버에서 받아온다"를 보이는 자리 */
.source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 20px; padding: 4px 10px;
}
.source-chip .led { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.source-chip.is-mock .led { background: var(--warn); }

/* 설정 시트 */
.sheet { position: absolute; inset: 0; z-index: 75; display: none; }
.sheet.on { display: block; }
.sheet-veil { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82%;
  background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg); overflow-y: auto;
  padding: 8px 16px 28px; display: flex; flex-direction: column; gap: 14px;
  animation: sheet-in .2s ease-out;
}
@keyframes sheet-in { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 4px; }
.sheet-panel h3 { font-size: 18px; font-weight: 700; }
.sheet-panel .sec { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .03em; padding-top: 6px; }
.opt-row { display: flex; gap: 8px; }
.opt {
  flex: 1; min-height: 46px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2); font-size: 14.5px; font-weight: 600;
  display: grid; place-items: center;
}
.opt.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
