/* ═══════════════════════════════════════════════
   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: row; }
.config-nav   { border-right: 1px solid var(--border); background: var(--surface);
                display: flex; flex-direction: column; align-items: stretch;
                width: 188px; flex-shrink: 0; overflow-y: auto; }
.cn-section   { display: none; }
.cn-item      { display: flex; align-items: center; gap: 9px; padding: 12px 16px;
                font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer;
                border-left: 3px 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-left-color: var(--green); font-weight: 600; }
.cn-item .cn-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; line-height: 1; }
/* Cross-app link (Field) — never shows the active state; reads as a link out. */
.cn-link { color: var(--text-3); font-weight: 500; }
.cn-link:hover { color: var(--green-dark); }
/* the flex spacer pushes the Users link to the bottom of the sidebar */
.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: 290px 1fr; flex: 1; overflow: hidden; }
/* Accordion: the selected paddock expands to show its split layouts inline,
   like the Field paddock sheet. */
.pad-splits-inline { background: var(--surface); border-bottom: 1px solid var(--border); }
.pad-splits-inline .sl-row { padding-left: 20px; }
.sl-empty { padding: 12px 20px; font-size: 11px; color: var(--text-3); }
.pad-splits-hint { padding: 7px 20px; font-size: 10px; color: var(--green-dark);
                   background: var(--green-light); display: flex; align-items: center; gap: 6px; }
.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; }
/* White card on the grey page + a soft shadow so each mob clearly separates from
   the background and from its neighbours (the rows were grey-on-grey before). */
.mob-card { border: 1px solid var(--border-2); border-radius: var(--radius); overflow: hidden;
            margin-bottom: 14px; background: var(--card); box-shadow: 0 1px 3px rgba(20,28,18,.07); }
.mob-card-hdr { display: flex; align-items: center; justify-content: space-between;
                padding: 9px 13px; border-bottom: 1px solid var(--border-2); 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: 8px 13px; border-bottom: 1px solid var(--border); font-size: 11px; }
.mob-grid:hover { background: var(--surface); }
.mob-grid-hdr { padding: 6px 13px 4px; font-size: 9px; font-weight: 700; color: var(--text-2);
                text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border-2);
                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-rot   { font-size: 12px; color: var(--green-dark); background: var(--green-light);
                  border-bottom: 1px solid var(--border); padding: 7px 14px; flex-shrink: 0; }
.cal-ctrl-rot:empty { display: none; }
.cal-ctrl-rot strong { font-weight: 700; }
.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: flex; flex-direction: column; background: var(--card);
                 border-top: 8px solid var(--bg, #f1f5f9);
                 padding: 10px 16px 16px; user-select: none; }
/* flex:1 so the chart grows to fill the pane (it's the only flexible child);
   min-height keeps it usable before layout settles. The SVG is height:100%. */
.wedge-canvas  { position: relative; flex: 1 1 auto; 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; }

/* 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; }
/* Two-pane placement modal (form + satellite map) */
.modal-wide { width: 72vw; min-width: 900px; }
.pl-panes { display: flex; gap: 14px; }
.pl-form-pane { width: 468px; flex-shrink: 0; }
.pl-map-pane { flex: 1; position: relative; min-height: 372px; border-radius: 10px;
               overflow: hidden; border: 1px solid var(--border); background: #2f4a32; }
.pl-mapbox { position: absolute; inset: 0; }
.pl-map-toolbar { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 5;
                  display: flex; gap: 6px; justify-content: flex-end; }
.pl-map-toolbar .btn { background: rgba(255,255,255,.92); }
.pl-map-toolbar #pl-draw-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
.pl-map-status { position: absolute; top: 40px; left: 8px; z-index: 5; max-width: 70%;
                 background: rgba(26,61,43,.85); color: #fff; font-size: 10px;
                 padding: 4px 8px; border-radius: 7px; pointer-events: none; }
.pl-map-status:empty { display: none; }
.pl-map-readout { position: absolute; bottom: 8px; left: 8px; right: 8px; z-index: 5;
                  display: flex; flex-wrap: wrap; gap: 5px; pointer-events: none; }
.pl-sec-chip { background: rgba(45,106,79,.9); color: #fff; border-radius: 12px;
               padding: 3px 9px; font-size: 10px; font-weight: 600; white-space: nowrap; }
@media (max-width: 960px) {
  .modal-wide { width: 94vw; min-width: 0; }
  .pl-panes { flex-direction: column; }
  .pl-form-pane { width: auto; }
  .pl-map-pane { min-height: 300px; }
}
.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) {
  .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 { min-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; }

/* ── Summary pane (ported from the landing dashboard) ───────────────────── */
.dash-section { margin-top: 20px; }
.dash-section-title { font-size:13px; font-weight:700; color:#1a3d2b; margin-bottom:8px; }
.dash-src { font-size:10px; color:var(--text-3); cursor:help; vertical-align:super; }
.dash-sources { margin-top:18px; border:1px solid #e4e7df; border-radius:10px; background:#fafbf8; }
.dash-sources > summary { cursor:pointer; padding:11px 14px; font-size:13px; font-weight:600; color:var(--green-dark); list-style:none; }
.dash-sources > summary::-webkit-details-marker { display:none; }
.dash-sources > summary::before { content:"▸ "; color:var(--text-3); }
.dash-sources[open] > summary::before { content:"▾ "; }
.dash-sources-body { padding:4px 14px 14px; }
.dash-src-row { display:grid; grid-template-columns:200px 1fr; gap:12px; padding:9px 0; border-top:1px solid #eef0ea; font-size:12px; line-height:1.55; }
.dash-src-k { font-weight:600; color:#1a3d2b; }
.dash-src-v { color:var(--text-2); }
.dash-src-v sup { font-size:9px; }
.dash-src-foot { margin-top:10px; font-size:11px; color:var(--text-3); font-style:italic; }
@media (max-width:640px){ .dash-src-row { grid-template-columns:1fr; gap:2px; } }
.dash-rot-line { font-size:13px; color:var(--green-dark); background:var(--green-light);
                 border:1px solid #d7e3d2; border-radius:10px; padding:10px 14px; margin-bottom:14px; }
.dash-rot-line strong { font-weight:700; }
.dash-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin-bottom:12px; }
.dash-stat { background:#fff; border:1px solid #e4e7df; border-radius:12px; padding:14px 16px; }
.dash-stat-good { border-color:#86efac; background:#f0fdf4; }
.dash-stat-warn { border-color:#fcd34d; background:#fffbeb; }
.dash-stat-bad  { border-color:#fca5a5; background:#fef2f2; }
.dash-stat-label { font-size:11px; font-weight:600; color:#6b7b66; text-transform:uppercase; letter-spacing:.04em; margin-bottom:4px; }
.dash-stat-value { font-size:22px; font-weight:700; color:#1a3d2b; line-height:1.1; }
.dash-stat-unit  { font-size:13px; font-weight:400; color:#7a8a74; }
.dash-stat-sub   { font-size:11px; color:#7a8a74; margin-top:6px; }
.dash-overdue    { color:#b45309; font-weight:600; }
.dash-bar-track { height:5px; background:#e4e7df; border-radius:3px; margin:8px 0 6px; overflow:hidden; }
.dash-bar-fill  { height:100%; border-radius:3px; transition:width .3s; }
.dash-bar-good  { background:#2d6a4f; }
.dash-bar-warn  { background:#b45309; }
.dash-bar-bad   { background:#dc2626; }
.dash-alerts { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.dash-alert { font-size:12px; padding:8px 12px; border-radius:8px; border:1px solid; }
.dash-alert-warn { background:#fffbeb; border-color:#fcd34d; color:#92400e; }
.dash-alert-bad  { background:#fef2f2; border-color:#fca5a5; color:#991b1b; }
.dash-mobs-title { font-size:13px; font-weight:600; color:#1a3d2b; margin:18px 0 8px; }
.dash-mobs-list { background:#fff; border:1px solid #e4e7df; border-radius:12px; overflow:hidden; }
.dash-mob-row { display:flex; align-items:center; flex-wrap:wrap; gap:4px 10px; padding:10px 14px; border-bottom:1px solid #f0f2ed; font-size:13px; }
.dash-mob-row:last-child { border-bottom:none; }
.dash-pad-group { border-bottom:1px solid #e4e7df; }
.dash-pad-group:last-child { border-bottom:none; }
.dash-pad-head { font-size:11px; font-weight:700; color:#1a3d2b; text-transform:uppercase; letter-spacing:.03em; padding:8px 14px 2px; background:#f7f9f4; }
.dash-mob-dot  { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.dash-mob-name { font-weight:600; color:#1a3d2b; min-width:80px; }
.dash-mob-tag  { font-size:10px; background:#dcfce7; color:#166534; border-radius:4px; padding:1px 5px; margin-left:5px; font-weight:500; }
.dash-mob-loc  { color:#6b7b66; white-space:nowrap; }
.dash-mob-loc::after, .dash-mob-next::after, .dash-mob-demand::after { content:"·"; margin-left:10px; color:#c5ccc0; }
.dash-mob-warn { color:#dc2626; font-weight:600; }
.dash-mob-next { color:#6b7b66; white-space:nowrap; }
.dash-mob-demand { color:#1a3d2b; font-weight:500; white-space:nowrap; }
.dash-mob-weighed { font-size:11px; color:#9aa595; white-space:nowrap; }
.task-row { display:flex; align-items:center; gap:10px; padding:11px 14px; border-bottom:1px solid #f0f2ed; font-size:13px; }
.task-row:last-child { border-bottom:none; }
.task-icon { font-size:16px; flex-shrink:0; }
.task-title { font-weight:600; color:#1a3d2b; }
.task-sub { font-size:11px; color:#7a8a74; margin-top:2px; }
.task-overdue { color:#b45309; font-weight:600; }
.dash-empty-note { font-size:13px; color:#9aa595; padding:8px 2px; }

/* ── Weights pane (ported from Herd) ───────────────────────────────────── */
.wt-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.wt-card { background:#fff; border:1px solid #e4e7df; border-radius:10px; padding:12px 14px; cursor:pointer; transition:all .15s; }
.wt-card:hover { border-color:var(--green); }
.wt-card.active { border-color:var(--text); background:#f3f5ef; }
.wt-card.wt-flag.active { border-color:#dc2626; background:#fee2e2; }
.wt-card-n { font-size:22px; font-weight:700; color:#1a3d2b; line-height:1.1; }
.wt-card-l { font-size:11px; color:#6b7b66; margin-top:2px; }
.wt-table td, .wt-table th { white-space:nowrap; }
.wt-table tr.wt-flagged { background:#fff7ed; }
.wt-badge { font-size:10px; font-weight:600; padding:2px 7px; border-radius:8px; white-space:nowrap; }
.wt-under { background:#fee2e2; color:#991b1b; }
.wt-over  { background:#dbeafe; color:#1e40af; }
.wt-on    { background:#dcfce7; color:#166534; }

/* ── Users & farms pane ── */
.usr-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.usr-head h2{font-family:var(--font-head);font-size:18px;color:var(--green-dark);margin:0}
.usr-farms{display:flex;flex-direction:column;gap:10px}
.usr-farm{display:flex;align-items:center;gap:12px;padding:14px 16px;background:#fff;border:1px solid var(--line,#e2e8f0);border-radius:10px}
.usr-farm.usr-active{border-color:var(--green);box-shadow:0 0 0 1px var(--green) inset}
.usr-farm-info{flex:1;min-width:0}
.usr-farm-name{font-weight:600;color:var(--text-1,#1e293b);display:flex;align-items:center;gap:8px}
.usr-farm-meta{font-size:12px;color:var(--text-3);margin-top:2px;text-transform:capitalize}
.usr-farm-actions{display:flex;gap:8px;flex-shrink:0}
.usr-badge{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--green-dark);background:var(--green-pale,#e6f0ea);border-radius:5px;padding:2px 7px}
.usr-note{font-size:12px;color:var(--text-3);margin-top:16px;line-height:1.55;max-width:640px}

/* (Per-mob feed-model / dairy CSS removed — the dairy model now lives on the
   breed class, not the mob; the per-mob feedModelBlock and its styles are gone.) */

/* ── Breed & class models (visual editor) ── */
.bc-breed { margin-bottom:10px; }
.bc-curve { margin-left:6px; opacity:.95; }
.bc-classes { padding:6px 12px 10px; display:flex; flex-direction:column; gap:7px; }
.bc-class { border:0.5px solid var(--border); border-radius:9px; padding:8px 10px; background:var(--surface); }
.bc-class-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bc-class-bot { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-top:7px; }
.bc-fld { font-size:11px; color:var(--text-2); display:inline-flex; align-items:center; gap:5px; }
.bc-shape { line-height:0; }
.bc-dmd { font-size:11px; color:var(--text-3); }
.bc-dmd strong { font-size:15px; color:var(--green); font-weight:700; }
.bc-del { width:22px; height:22px; border-radius:5px; border:0.5px solid #fca5a5; background:var(--red-light); color:var(--red); cursor:pointer; font-size:11px; margin-left:auto; flex-shrink:0; }
