/* ═══════════════════════════════════════════════
   FARM PLANNER — style.css  v3
═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --green:       #2d6a4f;
  --green-mid:   #3a8060;
  --green-light: #e8f5ee;
  --green-dark:  #1a3d2b;
  --amber:       #d97706;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --blue:        #1d6fa4;
  --blue-light:  #eff6ff;
  --text:        #1a1a18;
  --text-2:      #4a4a44;
  --text-3:      #8a8a82;
  --border:      #e4e4dc;
  --border-2:    #d0d0c8;
  --bg:          #f5f5f1;
  --card:        #ffffff;
  --surface:     #fafaf7;
  --sidebar:     230px;
  --radius:      10px;
  --radius-sm:   6px;
  --font-head:   'DM Sans', system-ui, sans-serif;
  --font-body:   system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text);
       line-height: 1.5; -webkit-font-smoothing: antialiased; }

#app { display: flex; flex-direction: column; height: 100dvh;
       padding-bottom: env(safe-area-inset-bottom, 0); }

/* ── Top bar ── */
#app-topbar { display: flex; align-items: center; gap: 10px; padding: 0 18px;
              height: 50px; background: var(--green-dark); flex-shrink: 0; }
.app-logo { font-family: var(--font-head); font-size: 16px; font-weight: 700;
            color: white; letter-spacing: -.3px; flex: 1; }
.app-logo span { color: rgba(255,255,255,.45); font-weight: 400; font-size: 12px; margin-left: 8px; }
#topbar-meta { font-size: 11px; color: rgba(255,255,255,.45); }
.topbar-btn { background: rgba(255,255,255,.12); color: white;
              border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius-sm);
              padding: 5px 12px; font-size: 11px; font-weight: 500; cursor: pointer; }
.topbar-btn:hover { background: rgba(255,255,255,.22); }

/* ── App tabs ── */
#app-tabs { display: flex; background: var(--green-dark); border-bottom: 1px solid rgba(255,255,255,.1);
            flex-shrink: 0; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
#app-tabs::-webkit-scrollbar { display: none; }
.app-tab { padding: 0 18px; height: 40px; display: flex; align-items: center; gap: 5px;
           font-size: 12px; font-weight: 500; color: rgba(255,255,255,.5);
           cursor: pointer; border-bottom: 2px solid transparent;
           margin-bottom: -1px; white-space: nowrap; flex-shrink: 0; }
.app-tab:hover { color: rgba(255,255,255,.85); }
.app-tab.active { color: white; border-bottom-color: rgba(255,255,255,.7); }
.tab-badge { font-size: 9px; background: #ef4444; color: white;
             border-radius: 8px; padding: 1px 5px; font-weight: 700; margin-left: 2px; }

/* ── Body / panes ── */
#app-body { flex: 1; display: flex; overflow: hidden; }
.pane { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.pane.active { display: flex; }

/* ── Shared ── */
.card { border: 1px solid var(--border); border-radius: var(--radius);
        background: var(--card); overflow: hidden; margin-bottom: 10px; }
.card-hdr { display: flex; align-items: flex-start; justify-content: space-between;
            padding: 8px 13px; border-bottom: 1px solid var(--border); gap: 8px; background: var(--surface); }
.card-title { font-size: 12px; font-weight: 600; color: var(--text); }
.card-sub   { font-size: 10px; color: var(--text-3); margin-top: 1px; }

.btn { padding: 5px 12px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 500;
       cursor: pointer; border: 1px solid var(--border-2); background: var(--card); color: var(--text);
       display: inline-flex; align-items: center; gap: 5px; transition: background .12s; }
.btn:hover { background: var(--surface); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--green); color: white; border-color: var(--green); }
.btn-primary:hover { background: var(--green-mid); }
.btn-danger  { background: var(--red-light); color: var(--red); border-color: #fca5a5; }
.btn-sm { padding: 4px 9px; font-size: 11px; }

.badge { font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 8px;
         white-space: nowrap; display: inline-block; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f3ef; color: #4b5563; }

.alert { display: flex; align-items: flex-start; gap: 7px; padding: 8px 12px;
         border-radius: var(--radius-sm); font-size: 11px; line-height: 1.5; margin-bottom: 10px; }
.alert-warn   { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.alert-good   { background: var(--green-light); color: var(--green-dark); border: 1px solid #a7d4b8; }
.alert-info   { background: var(--blue-light); color: #1e40af; border: 1px solid #bfdbfe; }

.fi { border: 1px solid var(--border-2); border-radius: var(--radius-sm);
      padding: 4px 8px; font-size: 11px; background: var(--surface); color: var(--text); }
.fi:focus { outline: none; border-color: var(--green); }
.form-row { display: flex; align-items: center; gap: 10px; padding: 7px 0;
            border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text-3); }
.form-row:last-of-type { border-bottom: none; }
.form-label { flex: 1; }

.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table th { padding: 6px 10px; text-align: left; font-size: 9px; font-weight: 600;
                 color: var(--text-3); text-transform: uppercase; letter-spacing: .4px;
                 background: var(--surface); border-bottom: 1px solid var(--border); }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }

.scroll { flex: 1; overflow-y: auto; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ── Empty state ── */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center;
               justify-content: center; gap: 14px; background: var(--surface); padding: 40px; }
.empty-icon  { font-size: 52px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text); font-family: var(--font-head); }
.empty-sub   { font-size: 12px; color: var(--text-3); text-align: center; max-width: 280px; line-height: 1.6; }
.empty-steps { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 300px; }
.empty-step  { display: flex; align-items: center; gap: 10px; background: var(--card);
               border: 1px solid var(--border); border-radius: 8px; padding: 10px 13px;
               cursor: pointer; transition: all .12s; }
.empty-step:hover { border-color: var(--green); background: var(--green-light); }
.empty-step-num  { width: 24px; height: 24px; border-radius: 50%; background: var(--green);
                   color: white; font-size: 11px; font-weight: 700;
                   display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.empty-step-text { font-size: 12px; font-weight: 600; color: var(--text); }
.empty-step-sub  { font-size: 10px; color: var(--text-3); margin-top: 1px; }

/* ══════════════════════════
   CONFIG TAB
══════════════════════════ */
/* Top tab bar (consistent with Herd / Fieldwork) instead of a left rail */
.config-shell { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.config-nav   { border-bottom: 1px solid var(--border); background: var(--surface);
                display: flex; flex-direction: row; align-items: stretch;
                overflow-x: auto; flex-shrink: 0; }
.cn-section   { display: none; }
.cn-item      { display: flex; align-items: center; gap: 7px; padding: 11px 16px;
                font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer;
                border-bottom: 2px solid transparent; white-space: nowrap; transition: all .1s; }
.cn-item:hover  { background: #f0f0e8; color: var(--green-dark); }
.cn-item.active { background: var(--green-light); color: var(--green-dark);
                  border-bottom-color: var(--green); font-weight: 600; }
.cn-item .cn-icon { font-size: 14px; flex-shrink: 0; }
/* the flex spacer pushes the cross-view link to the right end */
.config-nav > div[style*="flex:1"] { flex: 1; }

.config-main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.cp { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.cp.active { display: flex; }

/* Paddocks two-panel */
.pad-two { display: grid; grid-template-columns: 220px 1fr; flex: 1; overflow: hidden; }
.pad-list-panel { border-right: 1px solid var(--border); display: flex;
                  flex-direction: column; overflow: hidden; background: var(--card); }
.pad-list-hdr { padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
                display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.pad-list-scroll { flex: 1; overflow-y: auto; }

.pad-item-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
                border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.pad-item-row:hover { background: var(--surface); }
.pad-item-row.selected { background: var(--green-light); border-left: 2px solid var(--green); }
.pad-dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center;
           justify-content: center; font-size: 9px; font-weight: 700; color: white; flex-shrink: 0; }
.pad-iname { font-size: 12px; font-weight: 600; color: var(--text); }
.pad-imeta { font-size: 10px; color: var(--text-3); margin-top: 1px; }
/* Delete button — hidden until hover */
.pad-del { width: 22px; height: 22px; border-radius: 4px; border: 1px solid #fca5a5;
           background: var(--red-light); color: var(--red); display: flex;
           align-items: center; justify-content: center; font-size: 11px;
           cursor: pointer; flex-shrink: 0; opacity: 0; transition: opacity .15s; }
.pad-item-row:hover .pad-del { opacity: 1; }

/* Satellite map — fills all available height */
.pad-right  { display: flex; flex-direction: column; overflow: hidden; }
.sat-zone   { flex: 1; position: relative; min-height: 0;
              background: linear-gradient(135deg,#1e3a1e,#2d4a20,#3a5c28,#2d4a20,#1e3a1e); }
.sat-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 10;
              background: rgba(26,46,26,.92); color: white; padding: 7px 12px;
              display: flex; align-items: center; justify-content: space-between;
              font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); }
.sat-tb-btn { background: rgba(255,255,255,.15); color: white;
              border: 1px solid rgba(255,255,255,.2); border-radius: 5px;
              padding: 3px 9px; font-size: 10px; cursor: pointer; }
.sat-tb-btn:hover   { background: rgba(255,255,255,.26); }
.sat-tb-btn.drawing { background: var(--green); border-color: var(--green-mid); }
.sat-legend { position: absolute; bottom: 7px; left: 8px; z-index: 10;
              display: flex; flex-direction: column; gap: 2px; }
.sat-legend-item { background: rgba(0,0,0,.58); color: white; border-radius: 4px;
                   padding: 2px 7px; font-size: 9px; display: flex; align-items: center; gap: 4px; }

/* Split library — compact strip below map */
.split-lib-strip { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--card);
                   max-height: 200px; overflow-y: auto; }
.sl-hdr  { padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border);
           display: flex; align-items: center; justify-content: space-between;
           font-size: 11px; font-weight: 700; color: var(--text); flex-shrink: 0; position: sticky; top: 0; }
.sl-row  { display: flex; align-items: center; gap: 8px; padding: 7px 12px;
           border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.sl-row:hover   { background: var(--surface); }
.sl-row.sl-active { background: var(--green-light); border-left: 2px solid var(--green); }
.sl-swatch { width: 22px; height: 22px; border-radius: 4px; display: flex;
             align-items: center; justify-content: center; font-size: 10px;
             font-weight: 700; color: white; flex-shrink: 0; }
.sl-name   { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
.sl-detail { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.sl-del    { width: 20px; height: 20px; border-radius: 4px; border: 1px solid #fca5a5;
             background: var(--red-light); color: var(--red); display: flex;
             align-items: center; justify-content: center; font-size: 10px;
             cursor: pointer; flex-shrink: 0; opacity: 0; transition: opacity .15s; }
.sl-row:hover .sl-del { opacity: 1; }
.sl-new { display: flex; align-items: center; gap: 7px; padding: 7px 12px;
          color: var(--green); font-size: 11px; font-weight: 600; cursor: pointer; }
.sl-new:hover { background: var(--green-light); }

/* Mobs panel */
.mobs-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }
.mob-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.mob-card-hdr { display: flex; align-items: center; justify-content: space-between;
                padding: 9px 13px; border-bottom: 1px solid var(--border); background: var(--surface); gap: 8px; }
.mob-title  { font-size: 12px; font-weight: 700; color: var(--text); }
.mob-sub    { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.mob-grid   { display: grid; align-items: center; padding: 7px 13px; border-bottom: 1px solid var(--border); font-size: 11px; }
.mob-grid-hdr { padding: 5px 13px 3px; font-size: 9px; font-weight: 700; color: var(--text-3);
                text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--border);
                background: var(--surface); display: grid; }
.mob-formula { padding: 6px 13px; font-size: 10px; color: var(--text-3);
               background: var(--surface); border-top: 1px solid var(--border);
               display: flex; align-items: center; justify-content: space-between; }

/* Rotation calc */
.rot-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }
.rot-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rot-input-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.ric-label { font-size: 9px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.pad-rot-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.prc-hdr { display: flex; align-items: flex-start; justify-content: space-between;
           padding: 9px 13px; background: var(--surface); border-bottom: 1px solid var(--border); gap: 8px; }
.prc-title  { font-size: 12px; font-weight: 700; color: var(--text); }
.prc-sub    { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.prc-note   { padding: 7px 13px; font-size: 10px; color: var(--text-3); line-height: 1.6;
              border-bottom: 1px solid var(--border); background: var(--surface); }
.sc-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 13px;
          border-bottom: 1px solid var(--border); }
.sc-row:last-child { border-bottom: none; }
.sc-row.deficit { background: #fff9f9; }
.sc-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center;
          justify-content: center; font-size: 10px; font-weight: 700; color: white; flex-shrink: 0; margin-top: 1px; }
.sc-name   { font-size: 11px; font-weight: 600; color: var(--text); }
.sc-detail { font-size: 10px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.sc-result { text-align: right; flex-shrink: 0; }
.sc-ok   { font-size: 9px; color: #166534; margin-top: 2px; }
.sc-supp { font-size: 9px; color: var(--red); margin-top: 2px; }

.silage-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }

/* ══════════════════════════
   CALENDAR TAB
══════════════════════════ */
/* Per-mob card layout (used at all widths): the calendar scrolls vertically and
   the feed wedge flows below it at full size. Each mob is a card — name on its
   own row, that mob's days scroll horizontally below it. No draggable divider. */
.cal-outer { flex: 1; overflow-y: auto; overflow-x: hidden; min-width: 0; display: block; -webkit-overflow-scrolling: touch; }
.cal-ctrl  { padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
             display: flex; align-items: center; gap: 10px; flex-shrink: 0;
             position: sticky; top: 0; z-index: 6; }
.cal-ctrl-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.cal-ctrl-sub   { font-size: 10px; color: var(--text-3); }

.cal-body       { display: block; height: auto; min-height: 0; overflow: visible; }
.cal-table-wrap { display: block; height: auto; overflow: visible; min-width: 0; border-bottom: none; }
.cal-spacer     { display: none; }
.cal-divider    { display: none; }   /* divider removed */

/* Per-mob cards */
.cal-m-mob    { border-bottom: 1px solid var(--border); }
.cal-m-hdr    { display: flex; align-items: center; gap: 7px; padding: 9px 14px 5px;
                font-size: 15px; font-weight: 700; color: var(--text); position: sticky; left: 0; }
.cal-m-dot    { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.cal-m-demand { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: auto; }
/* No scroll-snap: snapping made the programmatically-synced strips jump to the
   nearest whole day instead of mirroring the active strip pixel-for-pixel. */
.cal-m-strip  { display: flex; gap: 4px; overflow-x: auto; padding: 0 10px 12px;
                -webkit-overflow-scrolling: touch; }
.cal-m-day    { flex: 0 0 90px; }
.cal-m-day.cal-m-past { opacity: .55; }
.cal-m-date   { font-size: 11px; color: var(--text-3); text-align: center; padding: 1px 0 4px; font-weight: 600; }
.cal-m-day.cal-m-today .cal-m-date { color: var(--green); font-weight: 700; }

.cal-table    { border-collapse: collapse; min-width: 100%; }
.cal-table th { padding: 6px 7px; font-size: 10px; font-weight: 600; text-align: center;
                border-bottom: 1px solid var(--border); white-space: nowrap; min-width: 84px;
                background: var(--surface); color: var(--text-3); }
.cal-table th.today-col { background: var(--green); color: white; }
.cal-table td { padding: 2px; border-bottom: 1px solid var(--border);
                border-right: 1px solid var(--border); vertical-align: top; min-width: 84px; }
.cal-table td.mob-lbl { font-size: 10px; font-weight: 600; color: var(--text-3); padding: 5px 10px;
                        background: var(--surface); width: 90px; vertical-align: middle;
                        white-space: nowrap; border-right: 1px solid var(--border); }
/* Freeze the mob (first) column when scrolling weeks sideways */
.cal-table thead th:first-child { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.cal-table td.mob-lbl           { position: sticky; left: 0; z-index: 2; }
.cal-table td.today-cell { background: rgba(45,106,79,.04); }
.cal-block      { border-radius: 5px; padding: 4px 6px; margin: 2px; cursor: pointer; }
.cal-block:hover{ opacity: .82; }
.cal-block-name  { font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-block-split { font-size: 9px; opacity: .8; margin-top: 1px; }
.cal-block-supp  { font-size: 9px; color: #991b1b; background: rgba(255,255,255,.65);
                   border-radius: 3px; padding: 1px 4px; margin-top: 2px; display: inline-block; }
.cal-block-enter { font-size: 8px; opacity: .6; margin-top: 1px; }

/* ── Interactive Feed Wedge — fills the space below the calendar table ── */
.wedge-section { min-width: 0; display: block; background: var(--card);
                 border-top: 8px solid var(--bg, #f1f5f9);
                 padding: 10px 16px 16px; user-select: none; }
.wedge-canvas  { position: relative; height: 300px; min-height: 300px; }
.wedge-hdr     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 10px; }
.wedge-title   { font-size: 12px; font-weight: 700; color: var(--text); }
.wedge-hint    { font-size: 10px; color: var(--text-3); }
.wedge-growth-badge { background: var(--green-light); color: var(--green-dark);
                      border: 1px solid #8dc4a8; border-radius: 20px;
                      padding: 3px 10px; font-size: 11px; font-weight: 700;
                      display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.wedge-row     { display: flex; align-items: center; gap: 0; margin-bottom: 5px; position: relative; }
.wedge-row:last-child { margin-bottom: 0; }
.w-label       { font-size: 11px; font-weight: 600; width: 80px; flex-shrink: 0; color: var(--text); padding-right: 8px; }
.w-bar-container { flex: 1; position: relative; height: 22px; cursor: pointer; }
.w-bar-bg      { position: absolute; inset: 4px 0; background: var(--surface); border-radius: 5px; overflow: hidden; }
.w-bar-container:hover .w-bar-bg { background: #e8e8e2; }
.w-bar-fill    { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 5px; transition: width .3s ease; }
/* Inline cover input — appears on click */
.w-cover-input { position: absolute; right: 0; top: 50%; transform: translateY(-50%);
                 background: var(--card); border: 1.5px solid var(--green); border-radius: 6px;
                 padding: 2px 7px; font-size: 11px; width: 75px; text-align: right; z-index: 30;
                 box-shadow: 0 2px 8px rgba(0,0,0,.14); display: none; }
.w-cover-input:focus { outline: none; }
.w-val   { font-size: 10px; color: var(--text-3); width: 52px; text-align: right; flex-shrink: 0; }
.w-badge { font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 6px;
           white-space: nowrap; margin-left: 6px; flex-shrink: 0; width: 68px; text-align: right; }
/* Draggable red target line */
.wedge-target-line { position: absolute; top: 0; width: 3px; border-radius: 1.5px;
                     background: var(--red); opacity: .85; cursor: ew-resize; z-index: 20; }
.wedge-target-line::after { content: ''; position: absolute; top: -8px; bottom: -8px; left: -8px; right: -8px; }
.wedge-tooltip { position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
                 background: var(--text); color: white; border-radius: 5px;
                 padding: 3px 8px; font-size: 10px; font-weight: 700; white-space: nowrap;
                 pointer-events: none; opacity: 0; transition: opacity .15s; }
.wedge-target-line:hover .wedge-tooltip,
.wedge-target-line.dragging .wedge-tooltip { opacity: 1; }
.wedge-ghost { position: absolute; top: 0; width: 1.5px; background: var(--red);
               opacity: .3; pointer-events: none; display: none; z-index: 19; }
.wedge-footer { font-size: 10px; color: var(--text-3); margin-top: 5px;
                display: flex; align-items: center; gap: 6px; }

/* ══════════════════════════
   FARM VIEW TAB
══════════════════════════ */
/* fv-outer fills the pane completely */
.fv-outer   { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }
/* The Mapbox map must fill absolutely */
#fv-mapbox  { position: absolute; inset: 0; width: 100%; height: 100%; }
.fv-toolbar { position: absolute; top: 0; left: 0; right: 0; z-index: 30;
              background: rgba(26,46,26,.92); color: white; padding: 8px 14px;
              display: flex; align-items: center; gap: 10px; backdrop-filter: blur(4px); }
.fv-title   { font-size: 13px; font-weight: 700; flex: 1; }
.toggle-pill { display: flex; background: rgba(255,255,255,.12); border-radius: 20px; padding: 2px; gap: 1px; }
.t-opt      { padding: 4px 12px; border-radius: 18px; font-size: 11px; font-weight: 600;
              cursor: pointer; color: rgba(255,255,255,.55); transition: all .15s; }
.t-opt.active { background: rgba(255,255,255,.22); color: white; }
.fv-legend  { position: absolute; top: 52px; right: 12px; background: rgba(26,46,26,.9);
              border-radius: 8px; padding: 10px 12px; z-index: 25; color: white; display: none; }
.fv-legend-title { font-size: 10px; font-weight: 700; opacity: .75; text-transform: uppercase;
                   letter-spacing: .4px; margin-bottom: 7px; }
.fv-legend-row    { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 10px; }
.fv-legend-row:last-child { margin-bottom: 0; }
.fv-legend-swatch { width: 28px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.fv-infobar { position: absolute; bottom: 0; left: 0; right: 0; z-index: 30;
              background: rgba(26,46,26,.92); color: white; padding: 7px 14px;
              display: flex; align-items: center; gap: 12px; font-size: 10px;
              backdrop-filter: blur(4px);
              padding-bottom: calc(7px + env(safe-area-inset-bottom, 0)); }

/* ══════════════════════════
   JOBS TAB
══════════════════════════ */
.jobs-layout  { flex: 1; overflow: hidden; display: grid; grid-template-columns: 300px 1fr; }
.jobs-left    { border-right: 1px solid var(--border); display: flex; flex-direction: column;
                overflow: hidden; background: var(--card); }
.jobs-left-hdr{ padding: 8px 13px; background: var(--surface); border-bottom: 1px solid var(--border);
                font-size: 11px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.job-section  { padding: 5px 13px 3px; font-size: 9px; font-weight: 700; color: var(--text-3);
                text-transform: uppercase; letter-spacing: .5px;
                background: var(--surface); border-top: 1px solid var(--border);
                border-bottom: 1px solid var(--border); flex-shrink: 0; }
.job-row      { display: flex; align-items: flex-start; gap: 9px; padding: 8px 13px;
                border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.job-row:hover    { background: var(--surface); }
.job-row.selected { background: var(--green-light); border-left: 2px solid var(--green); }
.job-row.dimmed   { opacity: .55; }
.job-check   { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-2);
               flex-shrink: 0; margin-top: 1px; cursor: pointer; display: flex;
               align-items: center; justify-content: center; font-size: 10px; transition: all .15s; }
.job-check.checked { background: var(--green); border-color: var(--green); color: white; }
.job-title   { font-size: 12px; font-weight: 600; color: var(--text); }
.job-sub     { font-size: 10px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.job-date    { font-size: 10px; color: var(--text-3); margin-left: auto; flex-shrink: 0; white-space: nowrap; }
.job-actions { display: flex; gap: 4px; margin-top: 4px; }
.job-btn     { padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 600;
               cursor: pointer; border: 1px solid var(--border-2); background: var(--card); color: var(--text); }
.job-btn.primary { background: var(--green); color: white; border-color: var(--green); }
/* Jobs map panel — Mapbox fills it, all overlays are layers */
.jobs-map-panel { position: relative; overflow: hidden; background: #1a2818; display: flex; flex-direction: column; }
.jmap-topbar    { position: absolute; top: 0; left: 0; right: 0; z-index: 20;
                  background: rgba(22,40,20,.92); color: white; padding: 8px 13px; backdrop-filter: blur(4px); }
.jmap-title { font-size: 12px; font-weight: 700; }
.jmap-sub   { font-size: 10px; opacity: .7; margin-top: 1px; }
.jmap-bottom { position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
               background: rgba(255,255,255,.97); border-top: 1px solid var(--border); padding: 9px 13px;
               padding-bottom: calc(9px + env(safe-area-inset-bottom, 0)); }
.jmap-dist   { position: absolute; bottom: 74px; right: 13px; z-index: 20;
               background: rgba(255,255,255,.96); border-radius: var(--radius-sm);
               padding: 8px 12px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.18);
               border: 1px solid rgba(0,0,0,.06); }
.dist-num  { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }
.dist-unit { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.dist-dir  { font-size: 10px; font-weight: 600; color: var(--green); margin-top: 2px; }
.map-legend { position: absolute; bottom: 78px; left: 12px; z-index: 20;
              display: flex; flex-direction: column; gap: 3px; }
.legend-item { background: rgba(0,0,0,.6); color: white; border-radius: 5px;
               padding: 3px 8px; font-size: 10px; display: flex; align-items: center; gap: 5px; }
/* GPS / nav dots */
.gps-dot { position: absolute; width: 14px; height: 14px; border-radius: 50%;
           background: #3b82f6; border: 2.5px solid white;
           box-shadow: 0 0 0 4px rgba(59,130,246,.22), 0 2px 7px rgba(0,0,0,.3);
           animation: gpspulse 2s infinite; transform: translate(-50%,-50%); z-index: 18; }
.target-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%;
              background: var(--amber); border: 2.5px solid white;
              box-shadow: 0 0 0 5px rgba(217,119,6,.22), 0 2px 7px rgba(0,0,0,.3);
              animation: tgtpulse 2s infinite; transform: translate(-50%,-50%); z-index: 18; }
.arrival-ring { position: absolute; width: 46px; height: 46px; border-radius: 50%;
                border: 2px solid rgba(217,119,6,.42); animation: arrivering 2s ease-in-out infinite;
                transform: translate(-50%,-50%); z-index: 16; }
@keyframes gpspulse  { 0%,100%{box-shadow:0 0 0 4px rgba(59,130,246,.28),0 2px 7px rgba(0,0,0,.3)}50%{box-shadow:0 0 0 10px rgba(59,130,246,0),0 2px 7px rgba(0,0,0,.3)} }
@keyframes tgtpulse  { 0%,100%{box-shadow:0 0 0 5px rgba(217,119,6,.28),0 2px 7px rgba(0,0,0,.3)} 50%{box-shadow:0 0 0 12px rgba(217,119,6,0),0 2px 7px rgba(0,0,0,.3)} }
@keyframes arrivering{ 0%,100%{transform:translate(-50%,-50%) scale(1);opacity:.62} 50%{transform:translate(-50%,-50%) scale(1.18);opacity:.22} }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200;
            display: none; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: var(--card); border-radius: 14px; padding: 20px; width: 380px;
         max-width: 96vw; border: 1px solid var(--border);
         box-shadow: 0 8px 40px rgba(0,0,0,.16); }
.modal-title   { font-size: 15px; font-weight: 700; color: var(--text); font-family: var(--font-head); margin-bottom: 3px; }
.modal-sub     { font-size: 11px; color: var(--text-3); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.info-box { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px;
            font-size: 11px; line-height: 1.9; color: var(--text-3); margin-bottom: 10px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
         background: var(--text); color: white; padding: 8px 16px; border-radius: 20px;
         font-size: 12px; white-space: nowrap; z-index: 300; opacity: 0;
         transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Mobile */
@media (max-width: 899px) {
  .jobs-layout      { grid-template-columns: 1fr; }
  .jobs-map-panel   { display: none; }
  .pad-two          { grid-template-columns: 1fr; }
  .pad-right        { display: none; }
  .config-nav       { display: flex; }   /* keep the top tab bar on mobile (scrollable) */
  #topbar-meta      { display: none; }

  /* Compact calendar header on phone — reclaim vertical space.
     One tight, horizontally-scrollable row; drop the verbose instructions. */
  .cal-ctrl                 { padding: 6px 10px; gap: 6px; overflow-x: auto; flex-wrap: nowrap; }
  .cal-ctrl > div:first-child { flex: 0 0 auto !important; }
  .cal-ctrl-title           { font-size: 12px; white-space: nowrap; }
  .cal-ctrl-sub             { display: none; }
  .cal-ctrl .btn-sm,
  .cal-ctrl #even-stays-toggle { flex: 0 0 auto; white-space: nowrap; }
  /* Slightly tighter day cells + wedge on phones */
  .cal-m-day    { flex: 0 0 86px; }
  .wedge-canvas { height: 260px; }
  /* Drop the verbose wedge instructions on phones — keep the chart + badges */
  .wedge-hint, .wedge-footer { display: none; }
  .wedge-hdr  { flex-wrap: wrap; gap: 6px; }
}

/* Placement modal recommendation hints */
.pl-rec { font-size: 11px; color: var(--text-3); margin-left: 8px; }
