/* M5StamPLC shared theme — cloned from aloha-fertigator-interface */

:root {
  /* Colour palette (HSL) */
  --app-bg:        120 10% 95%;
  --card:          0 0% 100%;
  --card-2:        120 8% 97%;
  --border:        120 6% 86%;
  --fg:            160 20% 12%;
  --muted:         160 6% 45%;
  --accent:        145 52% 32%;   /* #1B7D47 deep forest green */
  --accent-soft:   145 40% 92%;
  --brand-green:   145 52% 32%;
  --warning:       38 95% 50%;    /* amber */
  --danger:        0 75% 50%;     /* red */
  --info:          210 70% 50%;   /* blue */
  --shadow:        0 4px 20px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: hsl(var(--app-bg));
  color: hsl(var(--fg));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* Top bar */
.topBar {
  background: hsl(var(--brand-green));
  padding: 14px 0;
  color: #fff;
}
.topBarInner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topBarBrand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.topBarBrand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  /* Blend the near-white logo background into the green header so the leaf
     appears to float without a visible box. */
  mix-blend-mode: multiply;
  filter: brightness(1.08);
}
.topBarTitle {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: #fff;
}
.topBarSub {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  margin-top: 1px;
}
.topBarActions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topBar .btn,
.topBar .btnPrimary {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-color: transparent;
}
.topBar .btn:hover { background: rgba(255,255,255,.25); }
.topBar .btnPrimary {
  background: #fff;
  color: hsl(var(--accent));
  font-weight: 700;
}

/* Container */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

/* Pills (status badges) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card-2));
  color: hsl(var(--muted));
  white-space: nowrap;
}
.pillLive {
  background: hsl(var(--accent));
  border-color: transparent;
  color: #fff;
}
.pillWarn {
  background: hsl(var(--warning) / .9);
  border-color: transparent;
  color: #fff;
}
.pillDanger {
  background: hsl(var(--danger));
  border-color: transparent;
  color: #fff;
}
.pillInfo {
  background: hsl(var(--info) / .9);
  border-color: transparent;
  color: #fff;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: hsl(var(--muted));
  opacity: .55;
}
.pillLive .dot, .pillWarn .dot, .pillDanger .dot, .pillInfo .dot {
  background: rgba(255,255,255,.95);
  opacity: 1;
}

/* Cards */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.cardHeader {
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cardTitle {
  font-size: 13px;
  color: hsl(var(--muted));
  font-weight: 600;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.cardContent {
  padding: 0 14px 14px;
}
.cardActions {
  display: flex;
  gap: 6px;
}

/* KPI display */
.kpi {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: hsl(var(--fg));
  line-height: 1.1;
}
.kpiBig {
  font-size: 36px;
}
.kpiSub {
  font-size: 12px;
  color: hsl(var(--muted));
  margin-top: 2px;
}
.kpiUnit {
  font-size: 13px;
  color: hsl(var(--muted));
  font-weight: 600;
  margin-left: 4px;
}

/* Buttons */
.btn {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--fg));
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease;
  font-family: inherit;
}
.btn:hover { background: hsl(var(--card-2)); }
.btn:active { transform: translateY(1px); }
.btnPrimary {
  background: hsl(var(--accent));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btnPrimary:hover { background: hsl(145 52% 28%); }
.btnDanger {
  background: hsl(var(--danger));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btnDanger:hover { background: hsl(0 75% 42%); }
.btnLg {
  padding: 16px 24px;
  font-size: 15px;
  border-radius: 16px;
}

/* Switch */
.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card-2));
  padding: 3px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.switch .knob {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: hsl(var(--muted));
  transform: translateX(0);
  transition: transform .18s ease, background .18s ease;
}
.switchOn {
  background: hsl(var(--accent-soft));
  border-color: hsl(var(--accent));
}
.switchOn .knob {
  transform: translateX(18px);
  background: hsl(var(--accent));
}

/* Tabs */
.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card-2));
}
.tab {
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--muted));
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: hsl(var(--fg)); }
.tabActive {
  background: hsl(var(--card));
  border-color: hsl(var(--border));
  color: hsl(var(--fg));
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: hsl(var(--border));
  outline: none;
  width: 100%;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: hsl(var(--accent));
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

/* Inset boxes for nested groups */
.box {
  background: hsl(var(--card-2));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 12px;
}

/* Layout primitives */
.grid     { display: grid; gap: 14px; }
.grid2    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4    { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid5    { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.row      { display: flex; gap: 12px; align-items: center; }
.between  { justify-content: space-between; }
.col      { display: flex; flex-direction: column; gap: 8px; }
.muted    { color: hsl(var(--muted)); }
.small    { font-size: 12px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }

/* LED dots */
.led {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid hsl(var(--border));
  background: hsl(var(--card-2));
  vertical-align: middle;
}
.ledOn  { background: hsl(var(--accent)); border-color: hsl(var(--accent)); box-shadow: 0 0 8px hsl(var(--accent) / .55); }
.ledWarn { background: hsl(var(--warning)); border-color: hsl(var(--warning)); }
.ledDanger { background: hsl(var(--danger)); border-color: hsl(var(--danger)); }

/* Bar gauge */
.bar {
  height: 8px;
  background: hsl(var(--border));
  border-radius: 999px;
  overflow: hidden;
}
.barFill {
  height: 100%;
  background: hsl(var(--accent));
  transition: width .3s ease;
}
.barFill.warn   { background: hsl(var(--warning)); }
.barFill.danger { background: hsl(var(--danger)); }

/* Footer */
footer {
  text-align: center;
  padding: 24px 16px;
  color: hsl(var(--muted));
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1100px) {
  .grid5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr; }
  .topBarInner { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr; }
  .grid5 { grid-template-columns: 1fr; }
}
