/* Additions to the control panel styles (app.css) for the volume edition:
 * dosing in ml with progress, litre scale on the tank, Activity badge, demo bar. */

/* nav badge: new activity since the page was last opened */
.nav-badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-items: center; background: #34d399; color: #053b2f; font-size: 12px; font-weight: 750;
}

/* sidebar: devices dot (all online / one offline / control unit offline), alerts count */
.nav-badge.alert { background: #f87171; color: #fff; }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; flex: none; }
.nav-dot.ok { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25); }
.nav-dot.warn { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25); }
.nav-dot.off { background: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25); }

/* system pages */
.user-actions { gap: 6px; }
.info-tip { display: inline-flex; color: var(--muted); cursor: help; }
.info-tip svg { width: 15px; height: 15px; }

/* devices page */
.dev-tiles { margin-bottom: 16px; }
.dev-tile { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.dev-tile-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.dev-tile-ico svg { width: 22px; height: 22px; }
.dev-tile-text { min-width: 0; }
.dev-tile-text b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.15; }
.dev-tile-label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.dev-grid { margin-bottom: 16px; }
.dev-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.dev-head { display: flex; align-items: flex-start; gap: 12px; }
.dev-head h3 { font-size: 16px; }
.dev-kind { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.dev-rows { display: grid; grid-template-columns: minmax(140px, auto) minmax(0, 1fr); margin: 0; }
.dev-rows dt, .dev-rows dd { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.dev-rows dt { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dev-rows dt svg { width: 16px; height: 16px; color: var(--brand); flex: none; }
.dev-rows dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.dev-more { width: 100%; background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.dev-more:hover { background: #d3ede7; }
.dev-more svg { width: 16px; height: 16px; }
.dev-guide { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); align-items: center; gap: 16px; padding: 14px 18px; }
.dev-guide-head { display: flex; align-items: center; gap: 12px; }
.dev-guide-head svg { width: 22px; height: 22px; color: var(--brand); flex: none; }
.dev-guide-item { display: flex; align-items: flex-start; gap: 10px; padding-left: 16px; border-left: 1px solid var(--line); }
.dev-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; flex: none; }
.dev-dot.online { background: var(--good); }
.dev-dot.warning { background: var(--warn); }
.dev-dot.offline { background: var(--crit); }
.dev-tile.tone-crit .dev-tile-ico { background: var(--crit-soft); color: var(--crit); }
.dev-tile.tone-water .dev-tile-ico { background: var(--water-soft); color: var(--water); }
.dev-tile.tone-good .dev-tile-ico { background: #e6f6ec; color: var(--good); }
.dev-tile.tone-k .dev-tile-ico { background: var(--k-soft); color: var(--k); }
.dev-tile-text .dev-tile-label + b { margin-top: 2px; }
.tile-sub { gap: 6px; margin-top: 2px; }
.tile-link { width: 100%; color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.tile-link:hover { border-color: var(--line-2); }
.tile-link > svg:last-child { width: 18px; height: 18px; color: var(--muted); flex: none; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; color: var(--brand-ink); }
.delta svg { width: 14px; height: 14px; }
.dev-power { gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }

/* mixes & delivery */
.btn-soft { background: var(--brand-soft); border-color: #c4e6df; color: var(--brand-ink); }
.btn-soft:hover { background: #d3ede7; }
.mix-acts { gap: 6px; }

/* notifications & alerts: one row per alert / notification with a coloured stripe */
.ico-crit { background: var(--crit-soft); color: var(--crit); }
.alert-list { display: flex; flex-direction: column; }
.alert-row { display: grid; grid-template-columns: 4px 40px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.alert-row:first-child { border-top: 0; }
.alert-stripe { align-self: stretch; width: 4px; border-radius: 2px; background: var(--line-2); }
.alert-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.alert-ico svg { width: 20px; height: 20px; }
.alert-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-meta { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px 18px; }
.alert-meta .pill { min-width: 76px; justify-content: center; }
.alert-time { display: flex; align-items: flex-start; gap: 8px; min-width: 150px; font-size: 13px; }
.alert-time svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); flex: none; }
.alert-src { min-width: 110px; }
.sev-critical .alert-stripe, .tone-bad .alert-stripe { background: var(--crit); }
.sev-critical .alert-ico, .tone-bad .alert-ico { background: var(--crit-soft); color: var(--crit); }
.sev-warning .alert-stripe { background: var(--warn); }
.sev-warning .alert-ico { background: var(--warn-soft); color: var(--warn-ink); }
.alert-row.tone-good .alert-stripe { background: var(--good); }
.alert-row.tone-good .alert-ico { background: #e6f6ec; color: var(--good); }
.alert-row.tone-info .alert-stripe { background: var(--water); }
.alert-row.tone-info .alert-ico { background: var(--water-soft); color: var(--water); }
.btn-warn { background: var(--warn-soft); border-color: #f7ddb0; color: var(--warn-ink); }
.alert-empty { display: flex; align-items: center; gap: 10px; padding: 14px 4px; font-weight: 650; color: var(--good-ink); }
.alert-empty svg { width: 22px; height: 22px; }
@media (max-width: 900px) {
  .alert-row { grid-template-columns: 4px 40px minmax(0, 1fr); }
  .alert-meta { grid-column: 3; justify-content: flex-start; }
}
.dev-power p { margin: 0; }
@media (max-width: 900px) { .dev-guide { grid-template-columns: minmax(0, 1fr); } .dev-guide-item { padding-left: 0; border-left: 0; } }

/* demo mode bar (mock only) */
.demo-bar {
  position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 32px; background: var(--warn-soft); color: var(--warn-ink); border-bottom: 1px solid #f7ddb0; font-size: 13.5px; font-weight: 600;
}
.demo-bar svg { width: 16px; height: 16px; flex: none; }
.demo-bar .btn { margin-left: auto; }
.demo-menu {
  position: absolute; right: 32px; top: calc(100% + 6px); z-index: 25; display: flex; flex-direction: column; gap: 10px;
  min-width: 220px; padding: 14px 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
}
@media (max-width: 900px) { .demo-bar { padding: 8px 16px; } .demo-menu { right: 16px; } }

/* tiles: status pill on the left of the foot */
.tile-foot { align-items: center; gap: 8px; }
.tile-foot .pill { padding: 2px 9px; font-size: 12px; }

.main:focus { outline: none; } /* focused on page change for screen readers; no visible ring */

/* water tank: one compact row - tank no., level bar, capacity, water now, auto-fill */
.tank-bar {
  display: grid; grid-template-columns: auto minmax(220px, 2.4fr) auto auto auto; align-items: start;
  gap: 16px 30px; margin-top: 16px;
}
.tb-cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tb-label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tb-val { font-size: 24px; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tb-sub { font-size: 12.5px; font-weight: 650; color: var(--water-ink); }
.lvl-row { display: flex; align-items: center; gap: 14px; min-height: 36px; }
.lvl-track { position: relative; flex: 1; height: 14px; border-radius: 7px; background: var(--water-soft); }
.lvl-fill { display: block; width: 0; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--water-top), var(--water)); transition: width 1s ease; }
.lvl-track.filling .lvl-fill {
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.25) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--water-top), var(--water));
  background-size: 23px 23px, auto; animation: tank-rise 0.9s linear infinite;
}
.lvl-track.low .lvl-fill { background: linear-gradient(90deg, #f3c97a, var(--warn)); }
.lvl-track.stale .lvl-fill { filter: grayscale(0.85); opacity: 0.7; }
.lvl-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink-2); opacity: 0.45; }
.lvl-pct { min-width: 60px; text-align: right; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.tb-auto { padding-left: 26px; border-left: 1px solid var(--line); }
.tb-switch { gap: 10px; }
.tb-onoff { font-size: 15px; color: var(--muted); }
.tb-onoff.on { color: var(--on); }
.tb-autonote { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tb-autonote.busy { color: var(--water-ink); }
.spin { width: 13px; height: 13px; border: 2px solid var(--water-soft); border-top-color: var(--water); border-radius: 50%; flex: none; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.water-card .tank-lock, .water-card .note-warn { margin-top: 14px; }
@media (max-width: 1100px) {
  .tank-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tb-level { grid-column: 1 / -1; order: -1; }
  .tb-auto { padding-left: 0; border-left: 0; }
}
@media (max-width: 560px) { .tank-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* dosing table: one row per nutrient container (console table.data styles) */
.dose-wrap { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.dose-table td.num { white-space: nowrap; }

/* dosing table beside delivered today: the table gets two thirds of the row */
@media (min-width: 1320px) { .dose-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.dose-table th { position: static; }
.dose-table td { padding: 10px; }
.dose-table .dose-nut { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.dose-table .pump-badge { width: 30px; height: 30px; font-size: 13.5px; border-radius: 8px; }
.dose-table .num-wrap { justify-content: flex-end; }
.dose-table .num-in { width: 80px; min-height: 36px; font-size: 16px; }
.dose-table tbody tr.active td { background: var(--brand-soft); }
.dose-table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; font-variant-numeric: tabular-nums; }
.dose-table td .pill { padding: 2px 9px; font-size: 12px; }
.dose-cell { min-width: 130px; }
.dose-edit { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.dose-edit .range { width: 100%; min-width: 100px; height: 22px; }
/* over the dosing limit: red row, red box and slider, short message */
.dose-table tbody tr.over td { background: var(--crit-soft); }
.dose-table .num-in[aria-invalid="true"] { border-color: var(--crit); color: #a52828; }
.dose-table .range.over { accent-color: var(--crit); }
.dose-warn { font-size: 12px; font-weight: 650; color: #a52828; white-space: nowrap; }
.dose-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dose-cell .dose-prog { margin-top: 6px; }
.dose-note { margin: 0; padding: 9px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.dose-prog { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.dose-prog > span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width 0.6s ease; }
.dose-prog.lg { height: 14px; border-radius: 7px; }
.c-brand { background: var(--brand); }
.confirm-time { margin-left: auto; }
.confirm-row .confirm-time + b { margin-left: 12px; min-width: 64px; text-align: right; }
/* phones: each container becomes a labelled block */
@media (max-width: 640px) {
  .dose-table thead { display: none; }
  .dose-table, .dose-table tbody, .dose-table tfoot { display: block; }
  .dose-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px; border-bottom: 1px solid var(--line); }
  .dose-table td { padding: 0; border: 0; text-align: left !important; background: none !important; }
  .dose-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  }
  .dose-table tbody tr.active { background: var(--brand-soft); }
  .dose-table tfoot tr { background: var(--surface-2); border-bottom: 0; }
  .dose-table tfoot .dose-foot-label { grid-column: 1 / -1; }
  .dose-table .num-wrap { justify-content: flex-start; }
  .dose-table td.dose-cell { grid-column: 1 / -1; }
  .dose-edit { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
  .dose-edit .range { min-width: 0; flex: 1; }
  .dose-warn { flex-basis: 100%; }
}
.dose-total { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(135deg, #e3f5f0 0%, #f0f9f4 100%); border: 1px solid #cbe8df; }
.dose-total-text { font-weight: 700; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.dose-total-text b { font-size: 22px; letter-spacing: -0.01em; color: var(--ink); margin-right: 4px; }

/* confirm dialog: volumes to dose */
.confirm-list { display: flex; flex-direction: column; gap: 8px; }
.confirm-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.confirm-row b { margin-left: auto; font-size: 17px; font-variant-numeric: tabular-nums; }
.confirm-row.total { background: var(--brand-soft); color: var(--brand-ink); }
.confirm-row .pump-badge { width: 32px; height: 32px; font-size: 14px; border-radius: 9px; }

/* activity tones */
.feed-ico.t-good { background: #eaf6ee; color: var(--good-ink); }
.feed-ico.t-bad { background: var(--crit-soft); color: #a52828; }
.feed-ico.t-water { background: var(--water-soft); color: var(--water-ink); }
.feed-ico.t-info { background: var(--brand-soft); color: var(--brand); }
.feed-ico.t-n { background: var(--n-soft); color: var(--n); }
.feed-ico.t-p { background: var(--p-soft); color: var(--p); }
.feed-ico.t-k { background: var(--k-soft); color: var(--k); }

/* tank history chart in water blue */
.chart-card.tone-water { --series: var(--water); --series-wash: rgba(47, 134, 196, 0.12); }

/* ---------------------------------------------------------------- slides: control panel, activity, automation */
.pill-info { background: var(--water-soft); color: var(--water-ink); border-color: #c8e1f3; }
.pill-water { background: var(--water-soft); color: var(--water-ink); border-color: #c8e1f3; }
.pill-ack { background: #fdf0e3; color: #9a4a17; border-color: #f6d2b0; }
.delta.down { color: var(--ink-2); }
.ico-water { background: var(--water-soft); color: var(--water); }
.link-btn { padding: 0; border: 0; background: none; color: var(--water-ink); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; white-space: nowrap; }
.link-btn:hover { color: var(--brand-ink); }
dl.kv { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr); margin: 0; }
dl.kv dt, dl.kv dd { margin: 0; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
dl.kv dt { color: var(--muted); padding-right: 16px; }
dl.kv dd { font-weight: 650; overflow-wrap: anywhere; }
.empty-state { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--muted); }
.empty-state svg { width: 22px; height: 22px; flex: none; }

/* status tiles: system, connection, power, water refill */
.st-tile { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; }
.st-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.st-ico svg { width: 21px; height: 21px; }
.st-text { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.st-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.st-sub { font-size: 12.5px; color: var(--muted); }
.st-tile.st-busy { background: #f1f8fd; border-color: #c8e1f3; }
.st-tile.st-busy .st-ico { background: var(--water-soft); color: var(--water); }

/* nutrient delivery: why it cannot start now */
.lock-banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.lock-banner > svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.lock-banner b { display: block; }
.lock-banner.warn { background: var(--warn-soft); border-color: #f7ddb0; color: var(--warn-ink); }
.lock-banner.warn > svg { color: var(--warn); }

/* the dosing table */
table.data.dose-table th { white-space: normal; vertical-align: bottom; font-size: 12px; line-height: 1.3; padding: 9px 8px; }
table.data.dose-table td { padding: 10px 8px; }
.dose-table td:first-child, .dose-table th:first-child { padding-left: 12px; }
.dose-table .dose-cell { min-width: 150px; }
.dose-table th .info-tip { vertical-align: -2px; margin-left: 3px; }
.dose-table th .info-tip svg { width: 13px; height: 13px; }
.dose-table.locked tbody { opacity: 0.55; }
/* even columns: name, tank, size, then the dose control with room to slide */
.dose-table col.c-nut { width: 24%; }
.dose-table col.c-tank { width: 10%; }
.dose-table col.c-max { width: 14%; }
.dose-table col.c-info { width: 14%; }
table.data.dose-table th.center, table.data.dose-table td.center { text-align: center; }
table.data.dose-table th.c-dose, table.data.dose-table td.dose-cell { padding-left: 36px; }
.dose-line { display: flex; align-items: center; gap: 14px; width: 100%; }
.dose-line .range { flex: 1; min-width: 0; max-width: none; }

/* bottom bar: time for dosing, delivered today, start */
.dose-bar { display: flex; align-items: center; gap: 14px 28px; flex-wrap: wrap; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.bar-item { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.bar-item + .bar-item { padding-left: 28px; border-left: 1px solid var(--line-2); }
.bar-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.bar-ico.water { background: var(--water-soft); color: var(--water); }
.bar-ico svg { width: 20px; height: 20px; }
.bar-label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; color: var(--muted); }
.bar-val { display: block; font-size: 21px; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.bar-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-today:hover .bar-val { color: var(--brand-ink); }
.bar-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 760px) {
  .bar-item + .bar-item { padding-left: 0; border-left: 0; }
  .bar-actions { margin-left: 0; width: 100%; }
  .bar-actions .btn { flex: 1; }
}

/* live sensor snapshot */
.snap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
.snap-item { display: flex; flex-direction: column; gap: 4px; padding: 0 22px; border-left: 1px solid var(--line); min-width: 0; }
.snap-item:first-child { padding-left: 0; border-left: 0; }
.snap-item:last-child { padding-right: 0; }
.snap-top { display: flex; align-items: center; gap: 10px; }
.snap-mid { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.snap-mid .tile-value { margin-top: 4px; }
.snap-mid .tile-value b { font-size: 30px; }
.snap-mid .pill { padding: 2px 9px; font-size: 12px; }
.snap-item .tile-spark { height: 36px; }
.snap-item.stale .tile-value b { color: var(--muted); }
@media (max-width: 900px) {
  .snap-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .snap-item { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .snap-item:first-child { padding-top: 0; border-top: 0; }
}

/* activity: filters, search, export; one row per event */
.act-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; }
.act-bar .chip[aria-pressed="true"] { font-weight: 700; }
.act-search { display: flex; align-items: center; gap: 8px; min-width: 220px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.act-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.act-search .input { border: 0; padding-left: 0; min-height: 38px; box-shadow: none; background: transparent; }
.act-search .input:focus { outline: none; }
.act-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.act-table .ev-name { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.ev-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.ev-ico svg { width: 16px; height: 16px; }
.ev-ico.t-good { background: #e6f6ec; color: var(--good); }
.ev-ico.t-water { background: var(--water-soft); color: var(--water); }
.ev-ico.t-bad { background: var(--crit-soft); color: var(--crit); }
.ev-ico.t-warn { background: var(--warn-soft); color: var(--warn); }
.ev-ico.t-info { background: var(--brand-soft); color: var(--brand); }
.ev-ico.t-p { background: var(--p-soft); color: var(--p); }
.act-table .ev-details { color: var(--ink-2); min-width: 220px; }
.act-table .ev-src { color: var(--ink-2); white-space: nowrap; }
.ev-time { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.ev-time svg { width: 15px; height: 15px; color: var(--muted); }
.act-table td .pill { padding: 2px 10px; font-size: 12px; min-width: 92px; justify-content: center; }
@media (max-width: 760px) {
  .act-search { min-width: 0; flex: 1; }
  .act-table thead { display: none; }
  .act-table, .act-table tbody, .act-table tr, .act-table td { display: block; }
  .act-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .act-table td { padding: 2px 0; border: 0; }
  .act-table .ev-src, .act-table .ev-details { white-space: normal; min-width: 0; }
}

/* automation: one row per rule */
.auto-fill-card h2 { margin-bottom: 2px; }
.rule-list { display: flex; flex-direction: column; }
.rule-row { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.rule-row:first-child { border-top: 0; padding-top: 4px; }
.rule-row > .switch { margin-top: 2px; }
.rule-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rule-title { gap: 8px; flex-wrap: wrap; }
.rule-title .pill { padding: 2px 9px; font-size: 12px; }
.rule-desc { color: var(--ink-2); }
.rule-row.paused .rule-desc { color: var(--muted); }
.rule-acts { gap: 6px; flex: none; }
@media (max-width: 640px) { .rule-row { flex-wrap: wrap; } .rule-acts { width: 100%; padding-left: 66px; } }
.refill-row { cursor: pointer; }
.refill-row input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.table-wrap.act-wrap { max-height: none; }
@media (max-width: 640px) {
  .dose-table td { white-space: normal !important; }
  .dose-table td[data-label]::before { line-height: 1.25; }
}
@media (max-width: 640px) { table.data.dose-table td.dose-cell { padding-left: 8px; } }

/* alerts: the control panel card and the Alert History page (critical / warning / event / success) */
.dev-tile.tone-warn .dev-tile-ico { background: var(--warn-soft); color: var(--warn); }
.dev-tile.tone-info .dev-tile-ico { background: var(--water-soft); color: var(--water); }
.sev-pill svg { width: 15px; height: 15px; flex: none; }
.sev-pill, .st-pill { min-width: 92px; justify-content: center; }
.al-card .card-head { border-bottom: 0; }
.al-list { display: flex; flex-direction: column; gap: 8px; }
.al-row {
  display: grid; grid-template-columns: 34px minmax(160px, 1.1fr) minmax(0, 2fr) auto auto auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.al-row.sev-critical { background: var(--crit-soft); border-color: #f4c9c9; }
.al-row.sev-warning { background: var(--warn-soft); border-color: #f7ddb0; }
.al-row.done { opacity: .8; }
.al-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); }
.al-ico svg { width: 19px; height: 19px; }
.al-row.sev-critical .al-ico { color: var(--crit); }
.al-row.sev-warning .al-ico { color: var(--warn); }
.al-title { min-width: 0; }
.al-detail { min-width: 0; color: var(--ink-2); font-size: 13.5px; }
.al-when { white-space: nowrap; }
.al-act { min-width: 72px; justify-content: center; }
.al-more { display: inline-block; margin-top: 10px; }
.al-bar .chips { flex-wrap: nowrap; }
.al-sep { width: 1px; height: 26px; background: var(--line-2); }
.al-label { margin-right: -4px; }
.al-bar .act-search { margin-left: auto; }
.al-table td { vertical-align: middle; }
.al-table .al-text { min-width: 240px; }
.al-table .al-text b { display: block; }
@media (max-width: 1100px) {
  .al-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .al-detail { grid-column: 2 / -1; grid-row: 2; }
  .al-when { grid-column: 2; grid-row: 3; }
  .al-row .sev-pill { grid-column: 3; grid-row: 1; }
  .al-row .al-act { grid-column: 3; grid-row: 3; }
}
@media (max-width: 700px) {
  .al-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .al-sep { display: none; }
  .al-bar .chips { flex-wrap: wrap; }
  .al-label { margin: 2px 0 -4px; }
  .al-bar .act-search { margin-left: 0; min-width: 0; }
}

/* control panel per the reviewer's mockup: nutrient table + Dosing Status card on the right */
.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "dose side" "snap side"; gap: 16px; align-items: start; }
.dash-main > .mix-card { grid-area: dose; }
.dash-main > .ds-card { grid-area: side; }
.dash-main > .snap-card { grid-area: snap; }
@media (max-width: 1500px) { /* the 9-column table needs the full width: the status card goes under it */
  .dash-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "dose" "side" "snap"; }
}
.ds-body { display: flex; flex-direction: column; gap: 0; }
.ds-item { display: grid; grid-template-columns: 34px auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.ds-item:first-child { border-top: 0; padding-top: 4px; }
.ds-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.ds-ico svg { width: 18px; height: 18px; }
.ds-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ds-right { text-align: right; min-width: 0; }
.ds-val { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ds-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ds-prog { text-align: left; }
.ds-prog-line { display: flex; align-items: center; gap: 10px; }
.ds-prog-line .dose-prog { flex: 1; margin: 0; }
.ds-pct { font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.ds-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.ds-btn { width: 100%; justify-content: center; }
.btn-estop-line { color: var(--crit); border: 1.5px solid var(--crit); background: var(--surface); font-weight: 700; }
.btn-estop-line svg { color: var(--crit); }
.btn-estop-line:hover { background: var(--crit-soft); }
.btn-estop-line.off { color: var(--muted); border-color: var(--line-2); }
.btn-estop-line.off svg { color: var(--muted); }
.dose-table td.low { color: var(--crit); font-weight: 700; }
.dose-table .c-nut { width: 15%; }
.dose-table .c-present { width: 9%; }
.dose-table .c-tank { width: 6%; }
.dose-table .c-dose { width: 15%; }

/* the mockup's solid Fix buttons; severity pills in the control panel card without icons */
.al-act.btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.al-act.btn-danger:hover { background: #b91c1c; }
.al-act.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.al-act.btn-warn:hover { background: #d97706; }
.al-row .sev-pill svg { display: none; }
.al-row .sev-pill { min-width: 84px; }
@media (min-width: 701px) and (max-width: 1500px) { /* dosing status as a strip: time, total, progress, buttons */
  .ds-body { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(220px, 0.9fr); gap: 0 20px; align-items: start; }
  .ds-item, .ds-item:first-child { border-top: 0; padding: 2px 0; grid-template-columns: 34px minmax(0, 1fr); }
  .ds-item .ds-right { grid-column: 1 / -1; text-align: left; }
  .ds-actions { margin-top: 0; }
}

/* Alert History is an inner page of the Control Panel: "View All" in, "‹ Control Panel" back */
.view-all { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.view-all svg { width: 16px; height: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.back-link svg { width: 16px; height: 16px; transform: rotate(180deg); }
.al-card { background: linear-gradient(180deg, #fff3ef 0%, #fffaf8 100%); border-color: #f5ddd5; }

/* control panel: the compact sensor snapshot of the mockup (value only; the history page has the lines) */
.dash-main .snap-card .tile-spark, .dash-main .snap-card .snap-item > .small { display: none; }
.dash-main .snap-card .snap-item { gap: 6px; }

/* dosing status: delivered today (links to Mixes), the delivered amount in bold */
.ds-link { color: inherit; text-decoration: none; border-radius: 10px; }
.ds-link:hover .ds-label { color: var(--brand); text-decoration: underline; }
.ds-ico.water { background: var(--water-soft); color: var(--water); }
.ds-done b { color: var(--ink); font-size: 13px; }

/* nutrient table: all 9 columns fit the card (no side scroll bar), like the mockup -
   fixed column widths, small type, headings on two lines, values centred */
@media (min-width: 641px) {
  .dose-wrap { overflow: visible; }
  table.data.dose-table { table-layout: fixed; width: 100%; font-size: 13px; }
  table.data.dose-table th { font-size: 11.5px; line-height: 1.25; text-align: center; vertical-align: middle; padding: 8px 5px; }
  table.data.dose-table td { padding: 9px 5px; text-align: center; }
  table.data.dose-table th:first-child, table.data.dose-table td:first-child { text-align: left; padding-left: 12px; }
  table.data.dose-table th.c-dose, table.data.dose-table td.dose-cell { padding-left: 5px; }
  .dose-table col.c-nut { width: 19%; }
  .dose-table col.c-tank { width: 5%; }
  .dose-table col.c-present { width: 8%; }
  .dose-table col.c-max { width: 10%; }
  .dose-table col.c-avail { width: 10%; }
  .dose-table col.c-dose { width: 15%; }
  .dose-table col.c-pct { width: 10%; }
  .dose-table col.c-after { width: 11%; }
  .dose-table col.c-info { width: 12%; }
  .dose-table .dose-cell { min-width: 0; }
  .dose-table .dose-nut { gap: 7px; white-space: nowrap; }
  .dose-table .dose-nut b { font-size: 12.5px; line-height: 1.2; }
  .dose-table .pump-badge { width: 26px; height: 26px; font-size: 12.5px; border-radius: 7px; flex: none; }
  .dose-table .num-wrap { justify-content: center; gap: 6px; }
  .dose-table .num-in { width: 64px; min-height: 34px; font-size: 15px; }
  .dose-table .dose-amount { text-align: left; }
  .dose-table td .pill { font-size: 11.5px; padding: 2px 8px; white-space: normal; text-align: center; justify-content: center; }
  .dose-table .link-btn { white-space: normal; font-size: 12.5px; }
}
