:root {
  --teal: #008080;
  --teal-dark: #006666;
  --ink: #1f2a2e;
  --muted: #6b7a80;
  --line: #d5dcdf;
  --bg: #ffffff;
  --panel: #f5f7f8;
  --ok: #1e8e3e;
  --bad: #c62828;
  --warn: #b26a00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Lato, Arial, sans-serif;
  font-size: 16px;
}

a { color: var(--teal-dark); }

/* Header ------------------------------------------------------------------ */
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: whitesmoke;
}
.brand-title { flex: 1; text-align: center; }
.brand-title h1 { margin: 0; font-size: 24px; }
.brand-title h2 { margin: 4px 0 0; font-size: 18px; color: darkslategray; }
.brand-customer { max-height: 64px; max-width: 240px; min-width: 44px; }

.topnav, .subnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--teal);
}
.topnav a, .topnav .muted { color: #fff; text-decoration: none; }
.topnav .muted { opacity: .8; font-size: 14px; }
.nav-links a, .nav-user a, .subnav a { padding: 4px 10px; border-radius: 4px; }
.topnav a.active, .topnav a:hover { background: var(--teal-dark); }
.subnav { justify-content: flex-start; background: #e6f2f2; }
.subnav a { text-decoration: none; color: var(--teal-dark); font-weight: bold; }
.subnav a.active { background: var(--teal); color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }

.footer {
  background: silver;
  text-align: center;
  padding: 10px;
  font-weight: bold;
  margin-top: 24px;
}
.footer a { color: #000; text-decoration: none; }

/* Common ------------------------------------------------------------------ */
.muted { color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.flash-ok { background: #e7f5ea; color: var(--ok); }
.flash-error { background: #fdecea; color: var(--bad); }
.flash-key { background: #fff8e1; color: #5d4300; word-break: break-all; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
table.grid th, table.grid td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: center;
}
table.grid th { background: #fff; color: var(--teal); }
table.grid tr:nth-child(even) td { background: whitesmoke; }
table.grid td.left, table.grid th.left { text-align: left; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  background: var(--muted);
}
.badge.on, .badge.online { background: var(--ok); }
.badge.off, .badge.offline { background: var(--bad); }
.badge.warn { background: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
}
.card:hover { border-color: var(--teal); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.card h3 { margin: 0 0 6px; color: var(--teal-dark); }
.card .stats { display: flex; gap: 12px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }

.pressure-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.pressure {
  flex: 1 1 220px;
  border-radius: 8px;
  background: lightblue;
  padding: 12px;
  text-align: center;
}
.pressure .label { font-size: 18px; font-weight: bold; }
.pressure .value { font-size: 44px; font-weight: bold; }
.pressure .unit { font-size: 16px; }

.live-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-weight: bold; color: var(--teal); }

/* Forms ------------------------------------------------------------------- */
form.stack { display: grid; gap: 10px; max-width: 520px; }
form.stack label { display: grid; gap: 4px; font-weight: bold; font-size: 14px; }
form.inline { display: inline; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  width: 100%;
}
table.grid input, table.grid select { min-width: 70px; }
button, .button {
  display: inline-block;
  padding: 7px 14px;
  border: 0;
  border-radius: 4px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .button.secondary { background: #e0e6e8; color: var(--ink); }
button.danger { background: var(--bad); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; font-weight: normal; }
.checks label { display: inline-flex; gap: 6px; font-weight: normal; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.toolbar label { display: grid; gap: 4px; font-size: 14px; font-weight: bold; }
.panel { background: var(--panel); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.login-box { max-width: 380px; margin: 50px auto; border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
details summary { cursor: pointer; font-weight: bold; color: var(--teal-dark); margin-bottom: 8px; }
