/* LEO My Farm — light theme, accent #C93D3D, no dark sections */
:root {
  --bg: #F7F7F8;
  --card: #ffffff;
  --text: #2C2C2E;
  --muted: #6B6B70;
  --line: #E6E6E8;
  --red: #C93D3D;
  --red-soft: #F8EAEA;
  --red-hover: #B33333;
  --ok: #1F7A4D;
  --ok-soft: #E7F5EE;
  --warn: #9A5B00;
  --warn-soft: #FFF3E0;
  --idle: #6B6B70;
  --shadow: 0 1px 2px rgba(20, 20, 24, 0.04), 0 8px 24px rgba(20, 20, 24, 0.04);
  --radius: 14px;
  --sidebar: 240px;
  --bar: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
}
.mark { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.mark-dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--red); color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: 13px; letter-spacing: 0.02em;
}
.mark-name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.mark-name span { color: var(--muted); font-weight: 500; }
h1 { font-size: 24px; letter-spacing: -0.03em; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.field { margin: 0 0 14px; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600;
  cursor: pointer; background: var(--red); color: #fff;
}
.btn:hover { background: var(--red-hover); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--bg); }
.btn.ghost { background: transparent; color: var(--red); padding-left: 0; padding-right: 0; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }
.fine { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.banner {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 0 0 18px;
}
.banner.info { background: var(--red-soft); color: #7A2424; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.pending { background: var(--warn-soft); color: var(--warn); }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; flex: 1; }
.nav a, .nav button.linkish {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; color: var(--text);
  text-decoration: none; background: none; border: 0; width: 100%;
  text-align: left; cursor: pointer; font-weight: 550;
}
.nav a:hover, .nav button.linkish:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--red-soft); color: var(--red); }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav .group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 16px 12px 6px; }
.sidebar-foot { font-size: 12px; color: var(--muted); padding: 8px 12px; overflow-wrap: anywhere; word-break: break-word; }
.sidebar-signout { padding-top: 0; }
@media (min-width: 961px) { .sidebar-signout { display: none; } }

.main { min-width: 0; }
.topbar {
  height: var(--bar); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.search {
  flex: 1; max-width: 420px; position: relative;
}
.search input { padding-left: 36px; background: var(--bg); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 650;
}
.pill.live { background: var(--ok-soft); color: var(--ok); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 700; font-size: 12px; }

.content { padding: 24px; max-width: 1120px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-h h1 { margin: 0; }
.page-h p { margin: 4px 0 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 8px; font-size: 15px; letter-spacing: -0.01em; }
.stat-k { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-v { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }
.stat-s { color: var(--muted); font-size: 12px; margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mixer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.weight { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.weight small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.meta { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.bar > span { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.status { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.status.on { background: var(--ok-soft); color: var(--ok); }
.status.stale { background: var(--warn-soft); color: var(--warn); }
.status.off { background: var(--bg); color: var(--idle); }

.map {
  height: 280px; border-radius: 12px; border: 1px dashed var(--line);
  background:
    linear-gradient(#eef1ee, #eef1ee),
    repeating-linear-gradient(90deg, #e4e8e4 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, #e4e8e4 0 1px, transparent 1px 28px);
  background-blend-mode: multiply;
  position: relative; overflow: hidden;
}
.dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 6px rgba(201, 61, 61, 0.2); }
.trail { position: absolute; border: 0; height: 3px; background: var(--red); opacity: 0.45; transform-origin: left center; }
.map-caption { position: absolute; left: 12px; bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; color: var(--muted); }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.tl-row .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-size: 12px; font-weight: 650; }
.table tfoot td { font-weight: 700; border-bottom: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.tick {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; flex: 0 0 24px; margin-top: 1px;
}
.tick.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.progress { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; width: 100%; max-width: 280px; }
.progress > span { display: block; height: 100%; background: var(--red); }
.placeholder { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bottom-nav { display: none; }
.ex { font-size: 11px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: 0.04em; }

@media (max-width: 1200px) and (min-width: 961px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .cards, .grid-2, .grid-3, .row-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; align-items: center; }
  .sidebar {
    display: flex;
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 20; width: min(var(--sidebar), 86vw);
    height: 100vh; height: 100dvh;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .menu-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(44, 44, 46, 0.28); z-index: 15;
  }
  .menu-backdrop.open { display: block; }
  .topbar { height: auto; min-height: var(--bar); flex-wrap: wrap; padding: 8px 16px; }
  .search { flex: 1 1 160px; max-width: none; }
  .top-meta .btn { padding: 8px 10px; }
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    background: #fff; border-top: 1px solid var(--line);
    justify-content: space-around;
    padding: 8px 4px calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  }
  .bottom-nav a, .bottom-nav button {
    color: var(--muted); font-size: 11px; text-align: center;
    text-decoration: none; flex: 1; background: none; border: 0;
    cursor: pointer; font-weight: 550; padding: 6px 2px;
  }
  .bottom-nav a.active, .bottom-nav button.active { color: var(--red); font-weight: 700; }
  .auth-card { padding: 28px 20px 22px; }
  .weight { font-size: 28px; }
}

.err { color: var(--red); font-size: 13px; margin: 8px 0 0; }
.config-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.config-box summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--muted); }
.msg { font-size: 13px; margin: 8px 0 0; color: var(--muted); }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--red); }

.menu-btn {
  display: none;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-weight: 650; cursor: pointer;
}
.menu-backdrop { display: none; }
.card { overflow-x: auto; }
.howto h2 { margin-top: 22px; }
.howto h2:first-child { margin-top: 0; }
.howto ol { margin: 8px 0 0; padding-left: 20px; }
.howto li { margin: 0 0 6px; }
.howto .card + .card { margin-top: 14px; }


.auth-wide { max-width: 560px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fff;
}
.status.live { color: var(--ok); font-weight: 650; text-transform: lowercase; }
details.config-box { margin-top: 16px; }

/* ---- Signed-out site bar (mirrors leo-ag.com header) ---- */
.site-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(20,20,24,0.04); }
.site-bar + .auth-wrap { min-height: calc(100vh - 84px); }
.site-logo { display: flex; align-items: center; flex: 0 0 auto; }
.site-logo img { height: 56px; width: auto; display: block; }
.site-menu ul { list-style: none; margin: 0; padding: 0; }
.site-menu > ul { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px; }
.site-menu a, .site-menu .sub-toggle { display: block; padding: 8px 10px; border: 0; background: none; color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border-radius: 8px; white-space: nowrap; }
.site-menu a:hover, .site-menu .sub-toggle:hover, .site-menu a.current, .site-menu .has-sub.open > .sub-toggle { color: var(--red); text-decoration: none; }
.site-menu .caret { display: inline-block; margin-left: 6px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; vertical-align: middle; }
.site-menu .has-sub { position: relative; }
.site-menu .sub { display: none; position: absolute; right: 0; top: 100%; min-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.site-menu .sub a { font-weight: 500; white-space: normal; }
.site-menu .sub a:hover { background: var(--red-soft); }
.site-menu .has-sub.open > .sub { display: block; }
@media (hover: hover) and (min-width: 1101px) { .site-menu .has-sub:hover > .sub { display: block; } }
.site-burger { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 11px 10px; flex-direction: column; justify-content: space-between; }
.site-burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.site-burger:hover span { background: var(--red); }
@media (max-width: 1100px) {
  .site-bar { flex-wrap: wrap; padding: 8px 16px; }
  .site-logo img { height: 44px; }
  .site-burger { display: flex; }
  .site-menu { display: none; width: 100%; }
  .site-bar.menu-open .site-menu { display: block; }
  .site-menu > ul { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0 10px; }
  .site-menu a, .site-menu .sub-toggle { width: 100%; text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
  .site-menu .sub { position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; min-width: 0; }
}

/* ---- Live map (Leaflet) ---- */
.live-map { height: 320px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; background: #F7F7F8; }
.live-map .leaflet-control-layers { border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); font: 13px/1.4 inherit; color: var(--text); }
.live-map .leaflet-control-layers-selector { accent-color: var(--red); }
.live-map-caption { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---- Ration ingredient rows ---- */
.ing-editor { overflow-x: auto; margin: 4px 0 10px; }
.ing-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.ing-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ing-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ing-table input, .ing-table select { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.ing-table input:focus, .ing-table select:focus { outline: 2px solid var(--red-soft); border-color: var(--red); }
.ing-table input:disabled, .ing-table select:disabled { background: #F7F7F8; color: var(--muted); }
.ing-table .ing-order { display: flex; gap: 4px; align-items: center; }
.ing-table .ing-order input { width: 52px; }
.ing-table .mini { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 26px; line-height: 1; cursor: pointer; color: var(--text); padding: 0; }
.ing-table .mini:hover { color: var(--red); border-color: var(--red); }
.ing-table .ing-remove { color: var(--red); font-weight: 700; }
.ing-table tr.bad input.invalid, .ing-table input.invalid { border-color: var(--red); background: var(--red-soft); }
.ing-table .err { color: var(--red); font-size: 12px; margin-top: 2px; }
.ing-table tfoot td { font-weight: 600; font-size: 13px; }
.ing-note { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.ing-removed { font-size: 13px; color: var(--muted); }
.ing-removed button { margin-left: 6px; }
.smart-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .smart-row { grid-template-columns: 1fr; } }
.smart-row > .field, .row-2 > .field { min-width: 0; }
.smart-row .field input:not([type=checkbox]), .row-2 .field input { width: 100%; max-width: 100%; min-width: 0; }
.ing-table select[data-f=kind] { min-width: 118px; }
.sub-h { font-size: 14px; margin: 6px 0 8px; color: var(--text); }
.nut-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.nut-grid .field { min-width: 0; margin-bottom: 6px; }
.nut-grid input { width: 100%; min-width: 0; }
@media (max-width: 900px) { .nut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.btn.danger { color: var(--red); border-color: #E8C4C4; }
.btn.danger:hover { background: var(--red-soft); }
.cmp-table tr.changed td { background: #FFF8E6; }
.cmp-table tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.cmp-table tr.nut td { color: var(--muted); }
.table tr.sel td { background: var(--red-soft); }
.advice { margin: 6px 0 0; padding-left: 18px; }
.advice li { margin: 4px 0; font-size: 14px; }
.ing-table { min-width: 1280px; }
.ing-table td.dm-kg { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 14px; }
.ing-table input[data-f=supplier] { min-width: 120px; }
/* ---- Bundle B: pens, leaderboard tiles, road cards ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; align-self: flex-start; }
.seg a { padding: 8px 14px; color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.seg a.on { background: var(--red); color: #fff; }
.seg a:not(.on):hover { color: var(--red); }
.days { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.table tr.archived td { color: var(--muted); }
.stat-v.small { font-size: 18px; }
.pen-map { height: 460px; }
.shape-json { background: #F7F7F8; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; max-height: 160px; overflow: auto; white-space: pre-wrap; margin: 0; color: var(--text); }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lb-grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.lb-tile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px 12px; text-align: center; box-shadow: var(--shadow); }
.lb-tile.first { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.lb-rank { position: absolute; top: 8px; left: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lb-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; display: block; }
.lb-initials { display: flex; align-items: center; justify-content: center; background: var(--red-soft); color: var(--red); font-weight: 800; font-size: 22px; }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-grade { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin: 4px 0; color: var(--muted); }
.lb-letter { font-size: 26px; font-weight: 800; color: var(--text); }
.lb-stats { font-size: 12px; color: var(--muted); }
.lb-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 8px; }
.lb-badge { font-size: 11px; background: #F7F7F8; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--text); }
.road-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.road-card { border: 1px solid var(--line); border-left: 5px solid var(--ok); border-radius: 12px; padding: 12px 14px; background: #fff; }
.road-card.mid { border-left-color: #F28C00; }
.road-card.high { border-left-color: var(--red); }
.road-card p { margin: 6px 0; font-size: 14px; }
.road-head { display: flex; align-items: center; gap: 8px; }
.road-head .meta { margin-left: auto; }
.road-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.road-card.mid .road-dot { background: #F28C00; }
.road-card.high .road-dot { background: var(--red); }
.road-todo { background: #F7F7F8; border-radius: 8px; padding: 6px 8px; }
.road-map { height: 140px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
td.actions { white-space: nowrap; }
/* ---- Bundle B (0.8.15.1): pens detail, targets, trail map, photo ---- */
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .row-3 { grid-template-columns: 1fr; } }
.flag-card { border-left: 5px solid #F28C00; margin-bottom: 14px; }
.flag-card p { margin: 6px 0 0; }
.table tr.warn-row td { background: #FFF6EA; }
.nut-badge { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.nut-badge.ok { color: #1F7A45; }
.nut-badge.bad { color: var(--red); }
.nut-t input { border-width: 1px; }
.pen-mini { height: 180px; margin-top: 10px; }
.road-trail { height: 380px; }
.road-detail { margin-top: 8px; padding: 8px 10px; background: #F7F7F8; border: 1px solid var(--line); border-radius: 8px; }
.photo-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.photo-row .lb-photo { margin: 0; width: 80px; height: 80px; }
.price-hist .table { margin-top: 6px; }
.fixed-val { margin: 6px 0 0; padding: 8px 10px; background: #F7F7F8; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

/* Field help markers (JD Nov 10, 2026): small gray (?) circle, light popup */
.help-q {
  all: unset; box-sizing: border-box; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px; vertical-align: -2px;
  border-radius: 50%; border: 1px solid #C7C7CC; background: #F7F7F8;
  color: #6B6B70; font: 700 11px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  cursor: pointer; flex: none; text-transform: none; letter-spacing: 0;
}
.help-q::after { content: ""; position: absolute; inset: -8px; } /* bigger tap area, same look */
.help-q:hover, .help-q[aria-expanded="true"] { border-color: #8E8E93; color: #2C2C2E; background: #fff; }
.help-q:focus-visible { outline: 2px solid #8E8E93; outline-offset: 2px; }
.help-off .help-q { display: none !important; }
th .help-q { margin-left: 4px; }
.help-pop {
  position: fixed; z-index: 3000; max-width: 300px; padding: 10px 30px 10px 12px;
  background: #fff; color: #2C2C2E; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(20, 20, 24, 0.10); font-size: 13px; line-height: 1.4; text-align: left;
  font-weight: 400; text-transform: none; letter-spacing: 0; white-space: normal;
}
.help-pop[hidden] { display: none; }
.help-pop p { margin: 0; }
.help-pop .help-pop-ex { margin-top: 6px; padding: 4px 8px; background: #F7F7F8; border-radius: 6px; color: #2C2C2E; }
.help-pop .help-pop-ex span { color: #6B6B70; }
.help-pop .help-pop-ex b { font-weight: 600; }
.help-pop-x {
  all: unset; position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #6B6B70; font-size: 18px; cursor: pointer;
}
.help-pop-x:hover, .help-pop-x:focus-visible { background: #F7F7F8; color: #2C2C2E; outline: none; }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #D1D1D6; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch-row input:checked + .switch { background: var(--red); }
.switch-row input:checked + .switch::after { left: 18px; }
.switch-row input:focus-visible + .switch { outline: 2px solid #8E8E93; outline-offset: 2px; }
.topbar .search { position: relative; }
.topbar .search > .help-q { position: absolute; right: 10px; top: 50%; margin: -8px 0 0; vertical-align: 0; }
.topbar .search input { padding-right: 34px; }

/* Modules (JD's four) and LEO Smart Feed — light, grayed when off */
.nav a.mod-off, .bottom-nav a.mod-off { color: #8E8E93; }
.nav a.mod-off svg { opacity: .55; }
.nav-off { margin-left: auto; font-size: 11px; font-weight: 600; color: #8E8E93; background: #F7F7F8; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.mod-note { background: #F7F7F8; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: 14px; }
.card .mod-note { margin: 8px 0 12px; }
.mod-off .card, .card.mod-off { background: #FBFBFC; }
.mod-off h2, .mod-off h3, .mod-off .table, .mod-off p:not(.msg), .mod-off label { color: #6B6B70; }
.mod-off input, .mod-off select, .mod-off textarea { background: #F7F7F8; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.mod-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mod-row:last-of-type { border-bottom: 0; }
.mod-row.mod-off label { color: #8E8E93; }
.always-on { list-style: none; margin: 6px 0 0; padding: 0; }
.always-on li { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.always-on li:last-child { border-bottom: 0; }
.sf-answer { padding: 10px 0; border-bottom: 1px solid var(--line); }
.sf-answer:last-child { border-bottom: 0; }
.sf-answer .sf-q { color: #6B6B70; margin: 4px 0; }
.sf-steps { margin: 0 0 8px; padding-left: 20px; }
.sf-steps li { margin: 4px 0; }
#sf-form textarea { width: 100%; font: inherit; }
.pill.on { background: var(--ok-soft); color: var(--ok); }

/* ---- Luna fixes (staging, Nov 12 2026) ---- */
/* Help (?) to the RIGHT of the entry field: help.js wraps the control in .help-row. */
.help-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.help-row > input, .help-row > select, .help-row > textarea { flex: 1 1 auto; min-width: 0; width: 100%; }
.help-row:has(> textarea) { align-items: flex-start; }
.help-row:has(> textarea) > .help-q { margin-top: 12px; }
.help-row > .help-q { margin-left: 0; vertical-align: 0; width: 20px; height: 20px; font-size: 12px; }
.help-off .help-row { gap: 0; }

/* Modern sign-in / farm sign-up / dealer application fields (JD Nov 12: "very old style") */
.auth-card { --leo: #1a4a2e; --leo-hover: #143a24; --leo-soft: rgba(26, 74, 46, 0.14); --leo-ring: rgba(26, 74, 46, 0.24); }
.auth-card .mark-dot { background: var(--leo); }
.auth-card a { color: var(--leo); }
.auth-card h1 { font-size: 26px; }
.auth-card .field { margin: 0 0 18px; }
.auth-card label { font-size: 13.5px; font-weight: 600; color: #23302A; margin-bottom: 7px; }
/* B1 (Chief send-back): resting and hover rules are wrapped in :where() so they stay at (0,1,1)
   and can never outrank the focus (0,2,1) or invalid (0,3,2) rules below. Keep it that way. */
.auth-card input:where(:not([type=checkbox]):not([type=radio]):not([type=hidden])), .auth-card select {
  height: 46px; padding: 0 14px; border: 1.5px solid #D5DAD6; border-radius: 10px; background: #fff;
  font-size: 15px; box-shadow: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.auth-card input:where(:hover:not(:focus):not([readonly])) { border-color: #AEB8B1; }
.auth-card input:focus, .auth-card select:focus { border-color: var(--leo); box-shadow: 0 0 0 1px var(--leo), 0 0 0 5px var(--leo-ring); outline: none; }
.auth-card input[readonly] { background: #F4F6F4; color: var(--muted); }
.auth-card input::placeholder { color: #9AA29C; }
.auth-card form.tried input:invalid, .auth-card form.tried select:invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.auth-card form.tried input:invalid:focus, .auth-card form.tried select:invalid:focus { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 0 5px rgba(201, 61, 61, 0.22); }
.auth-card .btn:not(.secondary) { background: var(--leo); height: 48px; border-radius: 10px; font-size: 15px; }
.auth-card .btn:not(.secondary):hover { background: var(--leo-hover); }
.auth-card .btn:focus-visible { outline: 3px solid var(--leo-soft); outline-offset: 2px; }
.auth-card .btn.secondary { height: 44px; }
.field-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
/* Submit feedback: immediate busy state, then a clear result */
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: leo-spin .8s linear infinite; }
.btn.secondary .spin { border-color: rgba(0,0,0,.15); border-top-color: var(--text); }
@keyframes leo-spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { opacity: 1; cursor: progress; }
.form-status { display: none; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 12px 0 0; }
.form-status.show { display: block; }
.form-status.busy { background: #EEF4F0; color: #1a4a2e; }
.form-status.slow { background: var(--warn-soft); color: var(--warn); }
.form-status.ok { background: var(--ok-soft); color: var(--ok); }
.form-status.err { background: var(--red-soft); color: #8E2A2A; }
/* Demo honesty */
.msg.demo { color: var(--warn); }
.pill.demo { background: var(--warn-soft); color: var(--warn); }
/* Admin: dealer status, orphaned applications, logins paging */
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.disabled, .status.orphan { background: #EFEFF1; color: #5A5A60; }
.status.active { background: var(--ok-soft); color: var(--ok); }
.table tr.orphan td { color: #8E8E93; background: #FAFAFB; }
.table tr.orphan td.co { text-decoration: line-through; }
.orphan-note { display: block; font-size: 12px; color: #6B6B70; margin-top: 2px; }
.logins-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.auth-card .err:not(:empty) { background: var(--red-soft); color: #8E2A2A; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* Luna audit 2: a blocked or failed button action (Delete ration, Remove machine) is shown right under the
   action in a red box with dark-red text (contrast ~8:1), announced via role=alert, never a small grey line. */
.action-alert { margin: 10px 0 0; padding: 10px 12px; border: 1px solid #E3A1A1; border-left: 4px solid var(--red); border-radius: 8px; background: #FDEDED; color: #7A1F1F; font-size: 14px; font-weight: 600; line-height: 1.4; }
.action-alert[hidden] { display: none; }
.action-alert.flash { animation: leo-alert-in .5s ease-out; }
@keyframes leo-alert-in { from { box-shadow: 0 0 0 4px rgba(201, 61, 61, .35); } to { box-shadow: 0 0 0 0 rgba(201, 61, 61, 0); } }
.placeholder.load-fail { color: #7A1F1F; font-style: normal; }
/* Ration editor: an out-of-range amount is marked while typing and left out of the totals. */
.ing-table input.live-bad { border-color: var(--red); background: var(--red-soft); }
.ing-table .live-err { color: #8E2A2A; font-size: 12px; margin-top: 2px; }
.foot-warn { color: #8E2A2A; font-weight: 600; }

/* JD Nov 12 (t478u/t479u): sign-in feedback box. Busy = spinning wheel until the signed-in page opens;
   err = solid red box with the reason, up for at least 3 seconds. The empty #auth-banner leftover (a pale bar
   that showed even with [hidden], also on live C-hotfix) is now really hidden. */
.banner[hidden], .auth-box[hidden] { display: none !important; }
.auth-card .banner { font-size: 14px; font-weight: 600; border: 1px solid rgba(0, 0, 0, .08); }
.auth-box { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.auth-box.busy { background: #EEF4F0; color: #1a4a2e; border: 1.5px solid #1a4a2e; }
.auth-box.err, .auth-card .auth-box.err:not(:empty) { margin: 0 0 18px; padding: 14px 16px; border-radius: 10px; background: #C93D3D; color: #fff; border: 1.5px solid #A92F2F; box-shadow: 0 4px 14px rgba(201, 61, 61, .25); }
.auth-spin { flex: 0 0 auto; width: 22px; height: 22px; border: 3px solid rgba(26, 74, 46, .25); border-top-color: #1a4a2e; border-radius: 50%; animation: leo-spin .8s linear infinite; }

/* t477u dealer application list / detail */
.app-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 150px; }
.app-actions .btn { white-space: nowrap; }
.app-when { white-space: nowrap; font-size: 13px; color: #6B6B70; }
.app-phone a { color: inherit; white-space: nowrap; }
#app-form input[readonly] { background: #F4F6F4; color: var(--muted); }

/* Show/Hide next to password fields (JD 2026-11-12). */
.pw-wrap { display: flex; align-items: stretch; gap: 6px; }
.pw-wrap > input { flex: 1 1 auto; min-width: 0; }
.pw-toggle { flex: 0 0 auto; min-width: 64px; min-height: 44px; padding: 0 12px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.pw-toggle:focus-visible { outline: 2px solid #f5c400; outline-offset: 2px; }
/* Merge (dealer-apply + pw-min6): help.js wraps a password's whole .pw-wrap (box + Show/Hide) in .help-row,
   so the (?) sits after Show/Hide; the pair takes the width a bare input would have. */
.help-row > .pw-wrap { flex: 1 1 auto; min-width: 0; }

/* Dealer view (Nov 12): role label, dashboard tiles, read-only panels. */
.sidebar-foot .role-label { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); }
.sidebar-foot .role-co { font-weight: 650; }
.dv-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dv-tile .dv-tile-l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dv-tile .dv-tile-v { font-size: 26px; font-weight: 700; margin-top: 4px; min-height: 32px; }
.dv-tile.dv-muted .dv-tile-v, .dv-na-v { font-size: 14px; font-weight: 600; color: var(--muted); }
.dv-tile .dv-loading { font-size: 13px; margin: 0; }
.dv-panel { margin-bottom: 14px; }
.dv-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); margin: 6px 0; }
.dv-loading .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: dvspin .8s linear infinite; }
@keyframes dvspin { to { transform: rotate(360deg); } }
.dv-na { color: var(--muted); margin: 6px 0; }
.pill.dv-ro { background: var(--bg); color: var(--muted); font-size: 11px; vertical-align: middle; }
.pill.dv-role-pill { background: var(--ok-soft); color: var(--ok); }
.dv-kv th { text-align: left; width: 34%; color: var(--muted); font-weight: 600; }
.dv-click td:first-child a { font-weight: 650; }
.dv-detail { grid-template-columns: 1fr 1fr; }
.dv-list { margin: 0; padding-left: 18px; color: var(--muted); }
.dv-foot { margin-top: 6px; }
@media (max-width: 760px) { .dv-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dv-detail { grid-template-columns: 1fr; } }
.dv-tile.dv-text .dv-tile-v { font-size: 18px; overflow-wrap: anywhere; }
.dv-detail .dv-panel { margin-bottom: 0; }
.dv-big { font-size: 28px; font-weight: 700; margin: 2px 0 6px; }
.dv-pager-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.dv-pager-row .meta { margin-right: auto; }
.dv-pager[disabled] { opacity: .5; cursor: default; }

/* ===== Modern (Nov 12 2026), v4 dense (JD t870u: more panels on screen, keep it clean). JD on the classic-pro mockups: "I want a cleaner modern look UI. Many tiles, text, and
   stuff overlap, Fix." Signed-in app only (.app); the sign-in / sign-up forms keep their approved look.
   One font family (system sans). 8 px spacing grid. Navy / slate / white, blue for data, LEO red and gold used
   sparingly. No green. v4: a 10-tile KPI grid and 12 panels on one page (no tabs). Text truncates (ellipsis) or wraps inside its
   card; charts and maps size to their card. tests/overlap_check.js must report 0 at 1440/1280/1024/768/390. ===== */
/* MC-CSS-START */
.app {
  --navy: #1b2a41; --navy-2: #263b5e; --slate: #5b6b80; --blue: #2a5ea8; --blue-soft: #edf2f9;
  --gold: #a8843f; --gold-soft: #f7f1e4; --amber: #b7791f; --leo-red: #c8102e;
  --ok: #2a5ea8; --ok-soft: #edf2f9;
  --bg: #f5f6f8; --line: #e4e7ec; --text: #1f2a37; --muted: #667085;
  --shadow: none;
  background: var(--bg);
}
.app .sidebar { background: var(--navy); border-right: 0; color: #d5dce7; }
.app .sidebar .mark-dot { background: #fff; color: var(--navy); border-radius: 6px; box-shadow: inset 0 -3px 0 var(--leo-red); }
.app .sidebar .mark-name { color: #fff; }
.app .sidebar .mark-name span { color: #c3ccd9; }
.app .sidebar .nav a { color: #c3ccd9; border-radius: 8px; }
.app .sidebar .nav a svg { opacity: .85; }
.app .sidebar .nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.app .sidebar .nav a.active { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--leo-red); }
.app .sidebar .sidebar-foot { color: #93a0b3; }
.app .sidebar .sidebar-foot .role-label { color: #e8d3a6; }
.app .sidebar .sidebar-foot .role-co { color: #fff; }
.app .sidebar .btn.secondary { background: transparent; color: #fff; border-color: #43577a; }
.app .topbar { border-bottom-color: var(--line); }
.app .card { box-shadow: none; border-color: var(--line); border-radius: 12px; }
.app .page-h h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; color: var(--navy); }
.app .card h2, .app .dv-panel h2 { font-weight: 600; color: var(--navy); }
.app .pill.dv-role-pill { background: var(--gold-soft); color: #7a5e24; }

/* dealer home: one KPI strip (shared with the dashboard), region / tier as header facts, tables that fit */
.dv-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.dv-fact { display: inline-flex; gap: 8px; align-items: baseline; min-width: 0; max-width: 100%; }
.dv-fact .dv-tile-l { font-weight: 600; color: var(--slate); }
.dv-fact .dv-tile-v { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dv-fact .dv-tile-v .dv-na, .dv-fact .dv-tile-v .na { font-size: 13px; }
.dv-section-h { font-size: 16px; font-weight: 600; color: var(--navy); margin: 32px 0 16px; }
.app .dv-panel { container-type: inline-size; min-width: 0; }
.app .dv-panel .table { table-layout: fixed; width: 100%; }
.app .dv-panel .table th, .app .dv-panel .table td { overflow-wrap: anywhere; }
.app #dv-machines-card .table th, .app #dv-machines-card .table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .dv-panel .table th[scope="row"] { width: 96px; }
@container (max-width: 720px) {
  #dv-machines-card .table th:nth-child(2), #dv-machines-card .table td:nth-child(2),
  #dv-machines-card .table th:nth-child(n+6), #dv-machines-card .table td:nth-child(n+6) { display: none; }
}
@container (max-width: 440px) {
  #dv-machines-card .table th:nth-child(3), #dv-machines-card .table td:nth-child(3),
  #dv-machines-card .table th:nth-child(4), #dv-machines-card .table td:nth-child(4) { display: none; }
}

/* ---- dashboard, v4 dense (JD t870u: "Go back to previous with showing many and multiple things, these look cleaner,
   but too basic"). Classic-pro density (10 KPI tiles, 12 panels, no tabs) with v3 spacing and zero overlap. The page
   is a named container, so the grid follows the space the content really has (sidebar or drawer). ---- */
.content:has(#mc-dash) { max-width: 1680px; container-type: inline-size; container-name: mcpage; }
.mc-dash { margin: 0 0 32px; min-width: 0; }
.mc-page-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.mc-page-h > div { min-width: 0; }
.mc-page-h p { overflow-wrap: anywhere; }
.mc-source { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 20px; color: var(--muted); margin: 0 0 12px; min-width: 0; }
.mc-source .mc-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; }
.mc-source[data-mc="live"] .mc-dot { background: var(--blue); }
.mc-source span { min-width: 0; }
.mc-kpis, .mc-kpis[data-n] { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; background: none; border: 0; border-radius: 0; overflow: visible; margin: 0 0 16px; }
.mc-kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; position: relative; overflow: hidden; }
.mc-kpi-accent { box-shadow: inset 0 3px 0 var(--leo-red); }
.mc-kpi-l, .mc-kpi .dv-tile-l { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; }
.mc-kpi-v, .mc-kpi .dv-tile-v { font-size: 24px; line-height: 32px; font-weight: 650; color: var(--navy); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mc-kpi-s { font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 4px; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-kpi-na .mc-kpi-v { font-size: 13px; font-weight: 500; letter-spacing: 0; }
.mc-kpi-na .mc-kpi-v .mc-na { vertical-align: middle; }
.mc-kpi .dv-loading { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.mc-tabs { display: flex; flex-wrap: wrap; gap: 0 24px; border-bottom: 1px solid var(--line); margin: 0 0 24px; }
.mc-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin: 0 0 -1px; padding: 8px 0 12px; font: inherit; font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; border-radius: 0; }
.mc-tab[aria-selected="true"] { color: var(--navy); font-weight: 600; border-bottom-color: var(--navy); }
.mc-panel[hidden] { display: none; }
.mc-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.mc-span-3 { grid-column: span 3; } .mc-span-4 { grid-column: span 4; } .mc-span-5 { grid-column: span 5; } .mc-span-6 { grid-column: span 6; } .mc-span-7 { grid-column: span 7; } .mc-span-8 { grid-column: span 8; } .mc-span-12 { grid-column: 1 / -1; }
.mc-tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mc-th { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; min-width: 0; }
.mc-th h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 15px; line-height: 24px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-cap { padding: 2px 20px 0; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-tb { padding: 12px 20px 20px; min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; container-type: inline-size; }
.mc-tag { flex: none; display: inline-block; font-size: 11px; line-height: 16px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.mc-tag-soon { background: var(--gold-soft); color: #7a5e24; }
.mc-tag-derived { background: #eef1f5; color: var(--slate); }
.mc-tag-ro { flex: none; align-self: flex-start; background: #eef1f5; color: var(--slate); }
.mc-na { display: inline-block; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--slate); background: #eef1f5; border-radius: 999px; padding: 4px 10px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.mc-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; min-width: 0; min-height: 96px; }
.mc-empty p { margin: 0; font-size: 13px; line-height: 20px; color: var(--muted); max-width: 48ch; overflow-wrap: anywhere; }
.mc-big { font-size: 26px; line-height: 32px; font-weight: 650; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mc-big-l { font-size: 12px; line-height: 16px; color: var(--muted); margin: 2px 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-sub { font-size: 13px; color: var(--muted); font-weight: 400; margin: 8px 0 0; }
.mc-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.mc-table th { text-align: left; font-size: 11px; line-height: 16px; font-weight: 600; color: var(--muted); letter-spacing: .01em; padding: 0 8px 8px; border-bottom: 1px solid var(--line); }
.mc-table td { padding: 6px 8px; height: 44px; border-bottom: 1px solid #eef0f3; vertical-align: middle; color: var(--text); }
.mc-table tr:last-child td { border-bottom: 0; }
.mc-table th:first-child, .mc-table td:first-child { padding-left: 0; }
.mc-table th:last-child, .mc-table td:last-child { padding-right: 0; }
.mc-table th, .mc-table td, .mc-table td > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-table td > .mc-cell-sub, .mc-feed .mc-cell-sub { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.mc-num { text-align: right !important; font-variant-numeric: tabular-nums; }
@container (max-width: 460px) { .mc-opt { display: none; } }
@container (max-width: 340px) { .mc-opt2 { display: none; } .mc-map .mc-labels { display: none; } }
.mc-pill { display: inline-block; max-width: 100%; vertical-align: middle; font-size: 11px; line-height: 16px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-pill-ok { background: var(--blue-soft); color: var(--blue); }
.mc-pill-due { background: #fbe9ec; color: var(--leo-red); }
.mc-pill-warn { background: #fdf3e2; color: #8a5a12; }
.mc-pill-note { background: #eef1f5; color: var(--slate); }
.mc-chart, .mc-map { display: block; width: 100%; height: auto; }
.mc-chart .mc-bar { fill: var(--navy); }
.mc-chart .mc-bar-soft { fill: #9aa8bc; }
.mc-chart .mc-bar-o { fill: var(--leo-red); }
.mc-chart .mc-bar-r { fill: var(--amber); }
.mc-chart .mc-avg { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 5 4; }
.mc-chart .mc-line { fill: none; stroke: var(--blue); stroke-width: 2.5; }
.mc-chart .mc-dot { fill: var(--blue); }
.mc-chart .mc-grid { stroke: #eceef2; stroke-width: 1; }
.mc-chart .mc-ax { font-size: 12px; fill: var(--muted); }
.mc-map { border-radius: 8px; }
.mc-map .mc-map-bg { fill: #f3f5f8; }
.mc-map .mc-grat { stroke: #e6e9ee; stroke-width: 1; }
.mc-map .mc-trail { fill: none; stroke: var(--slate); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.mc-map .mc-drop { fill: var(--amber); stroke: #fff; stroke-width: 1; }
.mc-map .mc-pos circle { fill: var(--blue); stroke: #fff; stroke-width: 2; }
.mc-map text.mc-pos-c { fill: #fff; stroke: none; font-size: 11px; font-weight: 700; }
.mc-map .mc-farm rect { fill: var(--navy); }
.mc-map text { font-size: 12px; font-weight: 600; fill: var(--navy); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 10px; }
.mc-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mc-sw { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; }
.mc-sw-bar, .mc-sw-farm { background: var(--navy); }
.mc-sw-soft { background: #9aa8bc; }
.mc-sw-o { background: var(--leo-red); }
.mc-sw-r { background: var(--amber); }
.mc-sw-avg { background: var(--gold); height: 3px; }
.mc-sw-line { background: var(--blue); height: 3px; }
.mc-sw-pos { background: var(--blue); border-radius: 50%; }
.mc-sw-trail { background: var(--slate); height: 3px; }
.mc-sw-drop { background: var(--amber); transform: rotate(45deg); width: 8px; height: 8px; margin: 0 2px; }
.mc-hbars { display: flex; flex-direction: column; gap: 12px; }
.mc-hbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 64px; gap: 12px; align-items: center; font-size: 13px; }
.mc-hbar-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--navy); }
.mc-hbar-t, .mc-meter-t { display: block; height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; min-width: 0; }
.mc-hbar-t i, .mc-meter-t i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.mc-meter-over i { background: var(--leo-red); }
.mc-hbar-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 12px; margin-top: auto; padding-top: 12px; }
.mc-stat { min-width: 0; border-top: 1px solid var(--line); padding-top: 8px; }
.mc-stat-l { font-size: 11px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-stat-v { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--navy); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
/* accuracy: ring + meters */
.mc-acc { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mc-acc-ring { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mc-ring { flex: none; width: 88px; height: 88px; }
.mc-ring .mc-ring-bg { fill: #fff; stroke: #eef0f3; stroke-width: 10; }
.mc-ring .mc-ring-fg { fill: none; stroke: var(--blue); stroke-width: 10; stroke-linecap: round; }
.mc-ring .mc-ring-v { font-size: 24px; font-weight: 700; fill: var(--navy); }
.mc-acc-l { font-size: 13px; line-height: 18px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.mc-meters { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mc-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; font-size: 13px; }
.mc-meter-l { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-meter-v { font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mc-meter .mc-meter-t { grid-column: 1 / -1; }
/* leaderboard */
.mc-leads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mc-lead { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.mc-lead-r { width: 24px; height: 24px; border-radius: 50%; background: #eef1f5; color: var(--navy); font-size: 12px; font-weight: 700; line-height: 24px; text-align: center; }
.mc-lead:first-child .mc-lead-r { background: var(--navy); color: #fff; }
.mc-lead-n { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mc-lead-t { font-size: 13px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-lead-s { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-lead-v { font-size: 14px; font-weight: 650; color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* warnings feed */
.mc-feed-h { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.mc-feed-h b { font-size: 18px; color: var(--navy); font-weight: 650; margin-right: 2px; }
.mc-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mc-feed li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid #eef0f3; min-width: 0; }
.mc-feed li .mc-pill { justify-self: start; }
.mc-feed-t { min-width: 0; font-size: 13px; font-weight: 600; color: var(--navy); }
.mc-feed-t > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-feed-t .mc-cell-sub { font-weight: 400; }
/* service schedule, regions */
.mc-svc, .mc-regs { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mc-svc-r { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 76px; gap: 10px; align-items: center; font-size: 13px; }
.mc-svc-n { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-svc-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.mc-svc-over { color: var(--leo-red); font-weight: 600; }
.mc-reg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; font-size: 13px; }
.mc-reg-n { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-reg-v { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mc-reg .mc-meter-t { grid-column: 1 / -1; }
/* profile list */
.mc-dl { margin: 0; display: flex; flex-direction: column; }
.mc-dl > div { display: grid; grid-template-columns: minmax(84px, 40%) minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid #eef0f3; min-width: 0; }
.mc-dl > div:first-child { border-top: 0; padding-top: 0; }
.mc-dl dt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-dl dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mc-loading { color: var(--muted); }
/* medium: 3 / 4-column panels go two per row, wide panels full width */
@container mcpage (max-width: 959px) {
  .mc-span-3, .mc-span-4 { grid-column: span 6; }
  .mc-span-5, .mc-span-6, .mc-span-7, .mc-span-8, .mc-dense > [data-tile="leads"] { grid-column: 1 / -1; }
  .mc-kpi { padding: 12px 14px; }
  .mc-kpi-v, .mc-kpi .dv-tile-v { font-size: 20px; line-height: 28px; }
}
/* narrow: one column, KPIs two per row */
@container mcpage (max-width: 639px) {
  .mc-kpis, .mc-kpis[data-n] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mc-kpis[data-n] > * { grid-column: auto !important; }
  .mc-kpi-v, .mc-kpi .dv-tile-v { font-size: 20px; line-height: 28px; }
  .mc-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mc-grid > * { grid-column: 1 / -1 !important; }
  .mc-th { padding: 14px 16px 0; }
  .mc-cap { padding: 2px 16px 0; }
  .mc-tb { padding: 12px 16px 16px; }
  .mc-page-h { flex-direction: column; gap: 8px; }
  .mc-big { font-size: 24px; line-height: 32px; }
}
/* ---- admin "View as" and dealer View as (JD t877u / t880u). The red bar is on every page while viewing as someone; it
   stays at the top when the page scrolls (the topbar scrolls under it). The picker is a page (#/admin/view-as), not an overlay. ---- */
.va-banner { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px;
  background: var(--leo-red, #c8102e); color: #fff; padding: 10px 24px; font-size: 14px; line-height: 20px; font-weight: 500; box-shadow: 0 2px 6px rgba(27,42,65,.18); min-width: 0; }
.va-banner-t { min-width: 0; overflow-wrap: anywhere; text-align: center; }
.va-banner strong { font-weight: 700; }
.va-exit { appearance: none; flex: none; background: #fff; color: var(--leo-red, #c8102e); border: 0; border-radius: 999px; padding: 6px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.va-exit:hover { background: #fbe9ec; }
.va-exit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.app.va-on .topbar { position: static; }
.app .top-meta .va-hdr { white-space: nowrap; }
.page-h .va-open { flex: none; white-space: nowrap; }
.va-card { container-type: inline-size; min-width: 0; }
.va-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 16px; }
.va-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.va-seg-b { appearance: none; background: #fff; border: 0; border-left: 1px solid var(--line); padding: 8px 14px; font: inherit; font-size: 14px; color: var(--slate); cursor: pointer; white-space: nowrap; border-radius: 0; }
.va-seg-b:first-child { border-left: 0; }
.va-seg-b[aria-pressed="true"] { background: var(--navy); color: #fff; font-weight: 600; }
.va-search { flex: 1 1 240px; min-width: 0; display: block; }
.va-search input { width: 100%; min-width: 0; box-sizing: border-box; }
.va-count { margin: 0 0 8px; }
.va-table td .btn.va-go { padding: 6px 14px; font-size: 13px; max-width: 100%; }
.va-na { min-height: 120px; }
.va-why { font-size: 12px; color: var(--slate); white-space: normal; overflow-wrap: anywhere; }
.va-more-p { margin: 12px 0 0; text-align: center; }
@container (max-width: 520px) { .va-table col:nth-child(1) { width: 52% !important; } .va-table col:nth-child(2) { width: 22% !important; } .va-table col:nth-child(4) { width: 26% !important; } }
@media (max-width: 640px) {
  .va-banner { padding: 8px 12px; font-size: 13px; gap: 6px 12px; }
  .page-h:has(.va-open) { flex-wrap: wrap; align-items: flex-start; }
  .va-seg { width: 100%; } .va-seg-b { flex: 1 1 0; padding: 8px 6px; }
}
/* Dealer View as + admin settings (JD t880u). Same red bar; settings switches use existing .switch-row (navy and LEO red only). */
.va-settings h2 { margin: 0 0 12px; font-size: 18px; }
.va-set-row { margin: 8px 0 0; }
.va-set-lab { min-width: 0; overflow-wrap: anywhere; }
.va-set-help { margin: 4px 0 12px 48px; }
.va-set-sub { margin: 8px 0 0 12px; padding: 8px 0 0 16px; border-left: 2px solid var(--line); }
.va-set-sub.is-disabled, .va-set-row.is-disabled { opacity: 0.6; }
/* 0.8.15.19 (contract 603ee548): short notice after the server ended View as. Amber (warn colors only). */
.va-ended { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; background: var(--warn-soft); color: var(--warn);
  padding: 10px 24px; font-size: 14px; line-height: 20px; font-weight: 500; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; text-align: center; }
.va-ended-x { appearance: none; flex: none; background: #fff; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 4px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.app.va-ro .content button:not(.va-exit):not(#signout):not(#signout-side),
.app.va-ro .content [type="submit"] { pointer-events: none; opacity: 0.55; }
/* MC-CSS-END */
