:root {
  --fb-green: #2f7d32;
  --fb-green-soft: #e8f3e8;
  --fb-sidebar-w: 232px;
  --fb-border: #e3e6e3;
  --bs-font-sans-serif: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

.fb-body { background: #f6f7f5; }

/* 사이드바 */
.fb-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--fb-sidebar-w);
  background: #fff; border-right: 1px solid var(--fb-border); z-index: 1030;
}
.fb-brand {
  display: flex; align-items: center; gap: .5rem; padding: 1.1rem 1.25rem;
  font-weight: 800; font-size: 1.15rem; color: var(--fb-green); text-decoration: none;
}
.fb-brand-mark { display: block; flex: 0 0 auto; }
.fb-nav .nav-link {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem;
  border-radius: .5rem; color: #333; font-size: .95rem;
}
.fb-nav .nav-link .bi { font-size: 1.05rem; width: 1.2rem; }
.fb-nav .nav-link.sub { padding-left: 2.6rem; font-size: .9rem; }
.fb-nav .nav-link:hover { background: #f1f3f1; }
.fb-nav .nav-link.active { background: var(--fb-green-soft); color: var(--fb-green); font-weight: 600; }
.fb-nav .nav-link.disabled { color: #9aa19a; }
.fb-nav .nav-link .badge { background: #eef0ee; color: #8a918a; font-weight: 500; font-size: .68rem; }
.fb-nav-heading { margin: .9rem .8rem .25rem; font-size: .75rem; font-weight: 700; color: #8a918a; }

/* 본문 */
.fb-main { min-height: 100vh; }
@media (min-width: 992px) { .fb-main { margin-left: var(--fb-sidebar-w); } }
.fb-topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem;
  height: 56px; padding: 0 1rem; background: #fff; border-bottom: 1px solid var(--fb-border);
}
.fb-content { padding: 1.25rem; max-width: 1400px; }
@media (min-width: 992px) { .fb-content { padding: 1.75rem 2rem; } }

.card { border-color: var(--fb-border); }
.fb-stat-label { font-size: .85rem; color: #6b736b; }
.fb-stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fb-stat-value small { font-size: .85rem; font-weight: 500; margin-left: .15rem; color: #6b736b; }
.fb-steps li { padding: .35rem 0; }

/* 인증 화면 */
.fb-auth-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #eef6ee, #f7f7f2); padding: 1.5rem; }
.fb-auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 1rem; padding: 2rem 1.75rem; box-shadow: 0 10px 30px rgba(30, 60, 30, .08); }
.fb-auth-logo { width: 56px; height: 56px; margin: 0 auto .75rem; line-height: 0; }

/* 마스터 목록·폼 */
[x-cloak] { display: none !important; }
.fb-num { font-variant-numeric: tabular-nums; }
.table > thead th { font-size: .82rem; font-weight: 600; color: #5d655d; white-space: nowrap; }
.table > tbody td { font-size: .92rem; }
.fb-dl dt { font-weight: 600; color: #5d655d; padding: .35rem 0; }
.fb-dl dd { padding: .35rem 0; margin-bottom: 0; }
.fb-status-planned    { background: #eef0ee; color: #5d655d; }
.fb-status-growing    { background: #e3f0e3; color: #2f7d32; }
.fb-status-harvesting { background: #fff1d6; color: #9a6a00; }
.fb-status-closed     { background: #e8eaf6; color: #46509a; }
.pagination { margin-top: 1rem; }
.page-link { color: var(--fb-green); }
.page-item.active .page-link { background: var(--fb-green); border-color: var(--fb-green); }

/* 목록 페이징 (web/partials/pager.php) — 밭에서 엄지로 누르기 쉽게 버튼을 크게 */
.fb-pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-top: 1rem;
}
.fb-pager-summary { font-size: .875rem; color: #6b736b; }
.fb-pager-summary strong { color: #222; font-weight: 700; }
.fb-pager-list {
  display: flex; align-items: center; gap: .25rem;
  margin: 0 0 0 auto; padding: 0; list-style: none;
}
.fb-pager-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  min-width: 2.5rem; height: 2.5rem; padding: 0 .6rem;
  border: 1px solid var(--fb-border); border-radius: .5rem; background: #fff;
  color: #333; font-size: .9rem; font-variant-numeric: tabular-nums;
  text-decoration: none; transition: background .12s, border-color .12s;
}
a.fb-pager-btn:hover { background: var(--fb-green-soft); border-color: #cfe3cf; color: var(--fb-green); }
a.fb-pager-btn:focus-visible { outline: 2px solid var(--fb-green); outline-offset: 2px; }
.fb-pager-btn.is-current { background: var(--fb-green); border-color: var(--fb-green); color: #fff; font-weight: 700; }
.fb-pager-btn.is-disabled { color: #c3c8c3; background: #fafbfa; cursor: default; }
.fb-pager-gap { min-width: 1.5rem; text-align: center; color: #9aa19a; user-select: none; }
.fb-pager-where { padding: 0 .75rem; font-size: .9rem; font-weight: 600; color: #333; white-space: nowrap; }

/* 휴대폰: 요약은 위, 이전 · 위치 · 다음 은 한 줄 전체 */
@media (max-width: 575.98px) {
  .fb-pager { flex-direction: column; align-items: stretch; gap: .5rem; }
  .fb-pager-summary { text-align: center; }
  .fb-pager-list { margin: 0; justify-content: space-between; }
  .fb-pager-step { min-width: 5.5rem; height: 2.75rem; }
}

/* 영농일지 */
.fb-worktype { background: var(--fb-green-soft); color: var(--fb-green); font-weight: 600; }
.fb-worktype-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; }
.fb-worktype-pick input { position: absolute; opacity: 0; }
.fb-worktype-pick span {
  display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .3rem;
  border: 1px solid var(--fb-border); border-radius: .6rem; cursor: pointer; font-size: .85rem; background: #fff;
}
.fb-worktype-pick span .bi { font-size: 1.2rem; color: #6b736b; }
.fb-worktype-pick input:checked + span { border-color: var(--fb-green); background: var(--fb-green-soft); color: var(--fb-green); font-weight: 600; }
.fb-worktype-pick input:checked + span .bi { color: var(--fb-green); }
.fb-worktype-pick input:focus-visible + span { outline: 2px solid var(--fb-green); outline-offset: 2px; }

/* 달력 */
.fb-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--fb-border); border: 1px solid var(--fb-border); }
.fb-cal-dow { background: #f7f8f7; text-align: center; padding: .4rem 0; font-size: .8rem; font-weight: 600; }
.fb-cal-cell { background: #fff; min-height: 92px; padding: .35rem; }
.fb-cal-empty { background: #fafbfa; }
.fb-cal-today { background: #f4fbf4; box-shadow: inset 0 0 0 2px var(--fb-green-soft); }
.fb-cal-day { font-size: .85rem; font-weight: 600; color: #444; }
.fb-cal-add { font-size: .9rem; color: #b9bfb9; text-decoration: none; line-height: 1; padding: 0 .2rem; }
.fb-cal-cell:hover .fb-cal-add { color: var(--fb-green); }
.fb-cal-item {
  display: block; margin-top: .2rem; padding: .1rem .3rem; border-radius: .3rem;
  background: var(--fb-green-soft); color: var(--fb-green); font-size: .72rem; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fb-cal-item:hover { background: #d8ecd8; }

/* 사진 */
.fb-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; }
.fb-photo { position: relative; aspect-ratio: 1; border-radius: .5rem; overflow: hidden; background: #f1f3f1; }
.fb-photo img { width: 100%; height: 100%; object-fit: cover; }
.fb-photo-file { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #7a827a; gap: .2rem; text-decoration: none; }
.fb-photo-file .bi { font-size: 1.6rem; }
.fb-photo-del { position: absolute; top: .2rem; right: .2rem; padding: 0 .35rem; line-height: 1.4; opacity: .85; }

/* 방제 */
.fb-row-violation { background: #fff5f5; }
.fb-input-row:first-of-type { border-top: 0 !important; padding-top: 0 !important; margin-top: 0 !important; }

/* 고객·판매·택배 */
.fb-grade { font-weight: 600; }
.fb-grade-vip      { background: #fff1d6; color: #8a6100; }
.fb-grade-regular  { background: #e3f0e3; color: #2f7d32; }
.fb-grade-new      { background: #e8eaf6; color: #46509a; }
.fb-grade-dormant  { background: #eef0ee; color: #6b736b; }
.fb-pay-unpaid  { background: #fdeaea; color: #b3261e; }
.fb-pay-paid    { background: #e3f0e3; color: #2f7d32; }
.fb-pay-partial { background: #fff1d6; color: #8a6100; }
.fb-pay-refund  { background: #eef0ee; color: #6b736b; }
.fb-ship-ready     { background: #fff1d6; color: #8a6100; }
.fb-ship-packed    { background: #e8eaf6; color: #46509a; }
.fb-ship-shipped   { background: #e3eefc; color: #1b5fae; }
.fb-ship-delivered { background: #e3f0e3; color: #2f7d32; }
.fb-ship-hold      { background: #fdeaea; color: #b3261e; }
.fb-ship-cancel    { background: #eef0ee; color: #6b736b; }

/* 경영분석 차트 (dataviz 기준 팔레트 — 검증 통과한 고정 순서) */
:root, .viz-root {
  --viz-surface: #ffffff;
  --viz-ink: #1d211d;
  --viz-muted: #6b736b;
  --viz-grid: #e8ebe8;
  --viz-neutral: #c3c7c3;
  --viz-series-1: #2a78d6;
  --viz-series-2: #eb6834;
  --viz-series-3: #1baf7a;
  --viz-series-4: #eda100;
  --viz-series-5: #e87ba4;
  --viz-series-6: #008300;
}
.fb-chart { position: relative; height: 260px; }
.fb-chart-donut { position: relative; width: 168px; height: 168px; flex: none; }
.fb-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--viz-neutral); }
.fb-swatch[data-slot="1"] { background: var(--viz-series-1); }
.fb-swatch[data-slot="2"] { background: var(--viz-series-2); }
.fb-swatch[data-slot="3"] { background: var(--viz-series-3); }
.fb-swatch[data-slot="4"] { background: var(--viz-series-4); }
.fb-swatch[data-slot="5"] { background: var(--viz-series-5); }
.fb-swatch[data-slot="6"] { background: var(--viz-series-6); }

/* 소득분석표 */
.fb-report th { font-weight: 600; }
.fb-report-head td, .fb-report-head th { background: #f7f9f7; }
.fb-report-total td, .fb-report-total th { background: var(--fb-green-soft); font-weight: 700; }
.fb-report-total td { font-size: 1.05rem; }

/* ---------------------------------------------------------------------------
   공개 메인(랜딩) 페이지
   --------------------------------------------------------------------------- */
.fb-public { background: #fff; color: #1d211d; }
.fb-public-wrap { max-width: 1120px; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.fb-public-bar {
  position: sticky; top: 0; z-index: 1020; height: 68px; display: flex; align-items: center;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--fb-border);
}
/* 바가 flex 라 wrap 이 내용만큼 줄어든다 — ms-auto 가 먹으려면 폭을 채워야 한다 */
.fb-public-bar .fb-public-wrap { width: 100%; }
.fb-public-bar .fb-brand { font-size: 1.1rem; }

/* 상단 메뉴 — 밭에서 장갑 낀 손으로도 눌리게 글자와 터치영역을 넉넉히 */
.fb-public-nav { gap: .15rem; }
.fb-public-nav a {
  padding: .55rem .85rem; border-radius: .5rem; font-size: 1rem; font-weight: 600;
  color: #49514a; text-decoration: none; white-space: nowrap;
}
.fb-public-nav a:hover, .fb-public-nav a:focus-visible { background: var(--fb-green-soft); color: var(--fb-green); }
.fb-public-cta { font-weight: 600; padding: .5rem 1.05rem; white-space: nowrap; }

/* 좁은 화면에선 로고·버튼을 다시 줄여야 두 버튼이 한 줄에 들어간다 */
@media (max-width: 575.98px) {
  .fb-public-bar { height: 60px; }
  .fb-public-bar .fb-public-wrap { padding-left: 1rem; padding-right: 1rem; }
  .fb-public-bar .fb-brand { font-size: 1rem; gap: .4rem; }
  .fb-public-bar .fb-brand-mark { width: 24px; height: 24px; }
  .fb-public-cta { padding: .4rem .7rem; font-size: .875rem; }
}
.fb-public-footer { border-top: 1px solid var(--fb-border); padding: 1.5rem 0; color: #6b736b; }
.fb-public-footer .fb-brand, .fb-public-footer .fw-semibold { color: var(--fb-green); }

.fb-hero { padding: 3.5rem 0 3rem; background: linear-gradient(170deg, #f1f8f1 0%, #fbfbf8 70%, #fff 100%); }
@media (min-width: 992px) { .fb-hero { padding: 5rem 0 4.5rem; } }
.fb-hero-badge { background: var(--fb-green-soft); color: var(--fb-green); font-weight: 600; font-size: .8rem; padding: .45rem .75rem; border-radius: 2rem; }
.fb-hero-title { font-size: clamp(1.9rem, 4.4vw, 3rem); font-weight: 800; line-height: 1.25; letter-spacing: -.02em; margin-bottom: 1rem; }
.fb-hero-lead { font-size: 1.05rem; color: #545c54; line-height: 1.75; margin-bottom: 1.75rem; max-width: 34em; }

/* 히어로 우측 화면 미리보기 */
.fb-preview { background: #fff; border: 1px solid var(--fb-border); border-radius: .9rem; overflow: hidden; box-shadow: 0 18px 44px rgba(30, 60, 30, .10); }
.fb-preview-bar { display: flex; align-items: center; gap: .3rem; padding: .6rem .8rem; background: #f7f8f7; border-bottom: 1px solid var(--fb-border); }
.fb-preview-dot { width: 9px; height: 9px; border-radius: 50%; background: #d8dcd8; }
.fb-preview-body { padding: 1rem; }
.fb-preview-stat { border: 1px solid var(--fb-border); border-radius: .6rem; padding: .7rem .8rem; }
.fb-preview-stat .fb-stat-value { font-size: 1.15rem; }
.fb-preview-alert { display: flex; align-items: center; gap: .4rem; background: #fff8e8; color: #8a6100; border-radius: .5rem; padding: .5rem .7rem; font-size: .85rem; margin-bottom: .6rem; }
.fb-preview-row { display: flex; align-items: center; gap: .5rem; font-size: .88rem; padding: .45rem .1rem; border-bottom: 1px solid #f0f2f0; }
.fb-preview-row:last-child { border-bottom: 0; }

.fb-section { padding: 3.5rem 0; }
@media (min-width: 992px) { .fb-section { padding: 4.5rem 0; } }
.fb-section-alt { background: #f7f9f7; border-top: 1px solid var(--fb-border); border-bottom: 1px solid var(--fb-border); }

.fb-value { background: #fff; border: 1px solid var(--fb-border); border-radius: .9rem; padding: 1.5rem; }
.fb-value-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--fb-green-soft); color: var(--fb-green); font-size: 1.4rem; }

.fb-feature { display: flex; align-items: flex-start; gap: .75rem; background: #fff; border: 1px solid var(--fb-border); border-radius: .75rem; padding: 1rem 1.1rem; }
.fb-feature > .bi { font-size: 1.25rem; color: var(--fb-green); line-height: 1.35; }

.fb-step { background: #fff; border: 1px solid var(--fb-border); border-radius: .9rem; padding: 1.5rem; }
.fb-step-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--fb-green); color: #fff; font-weight: 700; }

/* 메인 — Google Play 출시 안내 */
.fb-play-note {
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .9rem;
  border: 1px solid var(--fb-border); border-radius: 2rem; background: #fff;
  color: inherit; text-decoration: none; font-size: .9rem;
}
.fb-play-note .bi-google-play { color: var(--fb-green); font-size: 1.1rem; }
.fb-play-note:hover { border-color: #cfe3cf; background: var(--fb-green-soft); }
.fb-play-note:focus-visible { outline: 2px solid var(--fb-green); outline-offset: 2px; }
.fb-cta { padding: 3.5rem 0 4rem; background: linear-gradient(180deg, #fff 0%, #f1f8f1 100%); }
.accordion-button:not(.collapsed) { background: var(--fb-green-soft); color: var(--fb-green); box-shadow: none; }
.accordion-button:focus { box-shadow: none; border-color: var(--fb-border); }

/* 모달에서 방금 추가한 항목 — 어디에 들어갔는지 잠깐 보여준다 */
.fb-just-added { border-color: var(--fb-green); box-shadow: 0 0 0 .2rem var(--fb-green-soft); transition: box-shadow .2s ease; }

/* 일지 내용 — 세로로만 늘리고, 늘린 만큼 카드도 따라 커지게 */
.fb-textarea { resize: vertical; min-height: 6.5rem; }
