:root {
  --green: #00a65a; --green-d: #008d4c; --side: #222d32; --side-d: #1a2226;
  --side-link: #b8c7ce; --ink: #2f3640; --muted: #7b8a8b; --line: #e6e9ed;
  --card: #fff; --bg: #ecf0f5;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between;
  background: var(--green); color: #fff; height: 50px; padding: 0 16px; }
.brand { font-weight: 700; font-size: 18px; }
.brand span { font-weight: 400; opacity: .85; font-size: 13px; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.country-form label { font-size: 12px; margin-right: 4px; }
.country-form select, .country-chip { border-radius: 4px; }
.country-chip { background: #1e40af; color: #fff; padding: 2px 10px;
  font-family: monospace; font-size: 13px; }
.country-chip.sm { padding: 1px 8px; font-size: 12px; }

/* layout */
.layout { display: flex; min-height: calc(100vh - 50px); }
.sidebar { width: 230px; background: var(--side); color: var(--side-link);
  flex-shrink: 0; padding-bottom: 30px; }
.side-header { color: #4b646f; font-size: 11px; font-weight: 700; letter-spacing: .5px;
  padding: 14px 16px 6px; text-transform: uppercase; }
.side-link { display: flex; align-items: center; gap: 10px; color: var(--side-link);
  text-decoration: none; padding: 11px 16px; border-left: 3px solid transparent; }
.side-link:hover { background: var(--side-d); color: #fff; }
.side-link.active { background: var(--side-d); color: #fff; border-left-color: var(--green); }
.side-link .ic { width: 18px; text-align: center; }

/* content */
.content { flex: 1; padding: 16px 20px; min-width: 0; }
h1 { font-size: 22px; font-weight: 400; margin: 4px 0 14px; }
h4 { margin: 14px 0 6px; }
.muted { color: var(--muted); }
.flow-banner { background: #f4f6f8; border-left: 4px solid #2d6cdf; padding: 7px 12px;
  margin-bottom: 12px; font-size: 13px; }
.flow-banner .dot { color: #aaa; margin: 0 8px; }
.f-in { color: #2d6cdf; } .f-proc { color: #d97706; } .f-out { color: #16a34a; }

/* value boxes */
.vbox-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.vbox { color: #fff; border-radius: 4px; padding: 14px 16px; min-height: 86px; }
.vbox-value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.vbox-label { font-size: 13px; opacity: .95; }
.vbox-sub { font-size: 11px; opacity: .8; margin-top: 4px; }
.vbox-green{background:#00a65a}.vbox-blue{background:#0073b7}.vbox-aqua{background:#00c0ef}
.vbox-yellow{background:#f39c12}.vbox-red{background:#dd4b39}.vbox-purple{background:#605ca8}
.vbox-teal{background:#39cccc}.vbox-olive{background:#3d9970}.vbox-navy{background:#001f3f}

/* cards */
.card { background: var(--card); border-top: 3px solid var(--green); border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0,0,0,.1); margin-bottom: 16px; }
.card-head { font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.card-head.primary { border-top-color: #3c8dbc; } .card-head.success { color: #00733e; }
.card-head.warning { color: #c87f0a; } .card-head.info { color: #0073b7; }
.card-body { padding: 14px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 9px;
  text-align: left; white-space: nowrap; }
table.grid th { background: #f7f9fa; font-weight: 600; }
table.grid tr:hover td { background: #f5faf7; }
td.path { font-family: monospace; font-size: 11px; color: var(--muted); white-space: normal; }
.status-pill { padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #222; }

/* forms / buttons */
.form-row, .toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 10px; }
.toolbar.inline, .inline { align-items: center; }
label { font-size: 13px; }
input, select { font: inherit; padding: 6px 8px; border: 1px solid #ccd2d8; border-radius: 4px; background: #fff; }
.check { display: inline-flex; gap: 8px; align-items: center; margin: 8px 0; }
.btn { background: var(--green); color: #fff; border: none; padding: 8px 14px; border-radius: 4px;
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--green-d); }
.btn.ghost { background: #6c757d; } .btn.info { background: #0073b7; }
.btn.warning { background: #f39c12; } .btn.danger { background: #dd4b39; }
.btn.lg { padding: 11px 22px; font-size: 16px; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.xs { padding: 2px 8px; font-size: 11px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* alerts */
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.alert-success { background: #dff0d8; color: #3c763d; }
.alert-error { background: #f2dede; color: #a94442; }
.alert-key { background: #fcf8e3; color: #8a6d3b; font-family: monospace; word-break: break-all; }

/* misc */
.badge-in { background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-out { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.endpoint { background: #0f172a; color: #a5f3fc; padding: 8px 10px; border-radius: 4px;
  font-family: monospace; font-size: 13px; margin: 4px 0; }
.console { background: #0f172a; color: #d1fae5; padding: 12px; border-radius: 4px;
  font-family: Consolas, monospace; font-size: 12px; max-height: 460px; overflow: auto; white-space: pre-wrap; }
.run-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; }
.run-meta { margin-top: 12px; }
.pill { padding: 3px 10px; border-radius: 10px; font-size: 12px; }
.pill.running { background: #fff3cd; color: #856404; }
.pill.done { background: #d4edda; color: #155724; }
.pill.err { background: #f8d7da; color: #721c24; }
.spark .spark-lo { font-size: 9px; fill: #94a3b8; }
.barlist { display: flex; flex-direction: column; gap: 8px; }
.barlist-row { display: grid; grid-template-columns: 180px 1fr 64px; align-items: center; gap: 10px; }
.barlist-label { font-size: 13px; color: #334155; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.barlist-track { background: #eef2f6; border-radius: 4px; height: 18px; overflow: hidden; }
.barlist-fill { height: 100%; border-radius: 4px; min-width: 2px; }
.barlist-value { font-size: 13px; font-weight: 600; text-align: right; color: #1f2937;
  font-variant-numeric: tabular-nums; }
.stats-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.season-note { border-left: 4px solid #39cccc; background: #f0fdff; padding: 10px 14px;
  border-radius: 0 4px 4px 0; margin: 4px 0 16px; font-size: 13px; color: #0b5563; }
@media (max-width: 900px) {
  .stats-two { grid-template-columns: 1fr; }
  .barlist-row { grid-template-columns: 120px 1fr 52px; }
}
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
@media (max-width: 900px) {
  .vbox-row { grid-template-columns: repeat(2, 1fr); }
  .run-grid { grid-template-columns: 1fr; }
  .sidebar { width: 60px; } .side-link { font-size: 0; } .side-link .ic { font-size: 16px; }
  .side-header { font-size: 0; }
}

/* planting window */
.logout { color: #fff; font-size: 13px; opacity: .9; }
.status-chip { padding: 1px 7px; border-radius: 9px; font-size: 11px; color: #222;
               margin: 1px 2px; display: inline-block; white-space: nowrap; }
.msg-text { min-width: 360px; white-space: normal; }
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.warn-box { border-left: 4px solid #f39c12; background: #fff8e6; padding: 10px 14px;
            margin-bottom: 12px; font-size: 13px; }
.tr-row textarea { width: 100%; min-height: 70px; font-family: inherit; font-size: 13px; }
.tr-src { color: #475569; font-size: 12px; }
.login-box { max-width: 360px; margin: 10vh auto; }
.login-box input { width: 100%; padding: 8px; margin: 6px 0 12px; box-sizing: border-box; }
@media (max-width: 800px) {

  .run-grid, .send-grid, .stats-two { grid-template-columns: 1fr; }
  .vbox-row { grid-template-columns: repeat(2, 1fr); }
}
.vbox-row.vbox-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 800px) { .vbox-row.vbox-5 { grid-template-columns: repeat(2, 1fr); } }

/* crop monitor map */
.map-wrap { position: relative; border: 1px solid var(--line); border-radius: 4px; background: #f8fafc; }
#map { width: 100%; height: 620px; display: block; cursor: grab; touch-action: none; }
canvas#map { background: #f8fafc; }
#map .adm { fill: #ffffff; stroke: #94a3b8; stroke-width: 1; vector-effect: non-scaling-stroke; }
#map .cell { stroke: #ffffff; stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; }
#map .cell:hover { stroke: #111827; stroke-width: 2; }
.map-tip { position: absolute; pointer-events: none; background: #111827; color: #f9fafb; font-size: 12px;
           padding: 7px 9px; border-radius: 4px; max-width: 250px; line-height: 1.35; z-index: 2; }
.map-legend { background: #fff; border-top: 1px solid var(--line); padding: 8px 10px; font-size: 12px;
              display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px;
                vertical-align: -2px; border: 1px solid rgba(0,0,0,.1); }
@media (max-width: 800px) { #map { height: 420px; } }

/* cell viewer charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
.charts-grid h4 { margin: 4px 0 6px; }
svg.chart { width: 100%; height: auto; background: #fff; }
svg.chart .ax { font-size: 10px; fill: #64748b; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: #475569; margin-top: 2px; }
.chart-legend i { display: inline-block; width: 14px; height: 8px; margin-right: 5px; vertical-align: middle; }
.dk-bars { display: flex; flex-direction: column; gap: 3px; }
.dk-row { display: grid; grid-template-columns: 70px 1fr 48px; gap: 8px; align-items: center; font-size: 12px; }
.dk-track { background: #f1f3f5; height: 14px; border-radius: 3px; overflow: hidden; }
.dk-fill { height: 100%; background: #74c0fc; } .dk-fill.best { background: #1c7ed6; } .dk-fill.none { background: #ced4da; }
.ond { display: flex; gap: 22px; height: 170px; align-items: flex-end; padding: 0 8px; }
.ond-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; }
.ond-bars { display: flex; gap: 4px; align-items: flex-end; flex: 1; width: 100%; justify-content: center; position: relative; }
.ond-bar { width: 26px; position: relative; border-radius: 3px 3px 0 0; }
.ond-bar.fc { background: #1c7ed6; } .ond-bar.nm { background: #ced4da; }
.ond-bars .whisk { position: absolute; left: calc(50% - 16px); width: 3px; background: #0b3d6e; }
.ond-lab { font-size: 11px; text-align: center; margin-top: 4px; color: #334155; }
.terc { display: flex; height: 20px; border-radius: 4px; overflow: hidden; font-size: 11px; color: #fff; margin: 4px 0; }
.terc span { display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* interactive cell charts */
.chart-tools { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 10px 0 4px; font-size: 12px; }
.chart-box { min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; z-index: 3; background: #111827; color: #f9fafb; font-size: 11px; line-height: 1.45;
             padding: 6px 8px; border-radius: 4px; pointer-events: none; min-width: 150px; max-width: 220px; }
.chart-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-legend .lg-item { background: none; border: 1px solid transparent; border-radius: 3px; padding: 1px 5px;
                         font: inherit; font-size: 11px; color: #475569; cursor: pointer; }
.chart-legend .lg-item:hover { border-color: #cbd5e1; }
.chart-legend .lg-item.off { opacity: .4; text-decoration: line-through; }
svg.chart .hit { cursor: crosshair; }
.ond-range { position: absolute; left: calc(50% - 30px); width: 26px; background: #d0ebff; border-radius: 3px; z-index: 0; }
.ond-bar { z-index: 1; }
.dk-row { cursor: help; } .ond-col { cursor: help; }

/* farm-with-crop banner (static/img/farm.png, 34 KB) */
.farm-banner { display: block; width: 100%; max-width: 1200px; height: auto; max-height: 180px;
  object-fit: cover; object-position: center 70%; border-radius: 8px; margin: 0 0 14px; }
.login-banner { max-width: 760px; max-height: 200px; margin: 24px auto 0; }
.login-banner + .login-box { margin-top: 20px; }
