:root {
  --bg: #111113;
  --panel: #1c1c1f;
  --panel-2: #26262a;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f2f4;
  --text-2: #a1a1a8;
  --brand: #c9a24b;
  --ok: #34c759;
  --warn: #ff9f0a;
  --bad: #ff453a;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --panel: #ffffff;
    --panel-2: #f0f0f3;
    --line: rgba(0, 0, 0, 0.09);
    --text: #1d1d1f;
    --text-2: #6e6e73;
    color-scheme: light;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.muted {
  color: var(--text-2);
}
.small {
  font-size: 12px;
}
button,
a.button,
label.button {
  display: inline-block;
  text-decoration: none;
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover,
a.button:hover,
label.button:hover {
  border-color: var(--text-2);
}
button.primary {
  background: var(--brand);
  color: #17140f;
  border-color: transparent;
  font-weight: 600;
}
button.danger {
  color: var(--bad);
}
button.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand);
}
input,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
}
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  font-weight: 500;
}
.top {
  position: sticky;
  top: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 2;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand img {
  height: 16px;
  width: auto;
  display: block;
}
.counts {
  display: flex;
  gap: 14px;
  flex: 1;
}
.actions {
  display: flex;
  gap: 8px;
}
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 60px;
}
h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin: 22px 0 10px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.offline {
  border-color: rgba(255, 69, 58, 0.55);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h3 {
  margin: 0;
  font-size: 16px;
  flex: 1;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: var(--text-2);
}
.dot.online {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.dot.offline {
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
}
.dot.warn {
  background: var(--warn);
}
.rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  font-size: 13px;
}
.rows span:nth-child(odd) {
  color: var(--text-2);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.events {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.events li {
  display: grid;
  grid-template-columns: 120px 160px 1fr;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.events li:last-child {
  border-bottom: none;
}
.events .k-offline,
.events .k-knx {
  color: var(--bad);
}
.events .k-online {
  color: var(--ok);
}
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(620px, 94vw);
  padding: 20px 22px;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
dialog h3 {
  margin-top: 0;
}
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
pre.cmd {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  margin: 6px 0;
}
.note {
  background: rgba(255, 159, 10, 0.12);
  border: 1px solid rgba(255, 159, 10, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 12px;
}
.error {
  color: var(--bad);
}
@media (max-width: 600px) {
  .events li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
table.customers {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.customers th,
table.customers td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
/* Nothing ever scrolls sideways: a long e-mail address or a long button row wraps inside its cell. */
table.customers td {
  overflow-wrap: anywhere;
}
table.customers th {
  white-space: nowrap;
}
table.customers th {
  color: var(--text-2);
  font-weight: 500;
}
table.customers tr:last-child td {
  border-bottom: none;
}
/* The buttons of a row: one wrapping row, left-aligned so the same button sits under the same button
   in every row; an empty slot keeps the place of "+ Pi" when the customer already has a Pi. */
table.customers td.acts {
  text-align: left;
}
table.customers td.acts > div,
table.customers td.acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
}
table.customers td.acts .slot {
  width: 52px;
  text-align: center;
}
table.customers td.acts button,
table.customers td.acts .btn,
table.customers td.acts .button {
  margin: 0;
  padding: 5px 10px;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
}
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-2);
}
.pill.ok {
  background: rgba(52, 199, 89, 0.15);
  color: var(--ok);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.form-grid .full {
  grid-column: 1 / -1;
}
.form-grid label {
  margin: 6px 0;
}
.seg {
  display: flex;
  gap: 6px;
}
.seg button.on {
  background: var(--brand);
  color: #17140f;
  border-color: transparent;
}
select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
}

label.button {
  margin: 0;
  font-weight: 400;
}

/* A link that looks like the buttons beside it (open the planner for a customer). */
a.btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line, #d0d5dd);
  text-decoration: none;
  color: inherit;
  font-size: 13px;
}
a.btn.primary {
  background: var(--accent, #b81818);
  border-color: var(--accent, #b81818);
  color: #fff;
}

/* Voortgang van de installatie per klant */
.pbar {
  display: flex;
  width: 110px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(156, 163, 175, 0.35);
  margin-bottom: 3px;
}
.pbar i {
  display: block;
  height: 100%;
}

/* Status as a dot: green = in orde, red = probleem, grey = nog niet, hollow = niet van toepassing. */
.dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-2);
  vertical-align: middle;
}
.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.5);
}
.dot.bad {
  background: #e5484d;
  box-shadow: 0 0 6px rgba(229, 72, 77, 0.5);
}
.dot.off {
  background: transparent;
  border: 1.5px solid var(--text-2);
}
.dot.none {
  background: transparent;
  border: 1.5px dashed var(--line);
}
/* The name of a customer opens its form (bekijken en bewerken). */
table.customers button.link.name {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
table.customers button.link.name:hover b {
  text-decoration: underline;
}

/* Phone: the customer table becomes a card per customer (name on top, dots and progress on one line,
   the buttons wrapping underneath), and the header buttons shrink to one row. */
@media (max-width: 700px) {
  .top {
    padding: 10px 12px;
    gap: 8px;
  }
  .counts {
    flex-basis: 100%;
    order: 3;
    gap: 10px;
    font-size: 13px;
  }
  .actions {
    flex-basis: 100%;
    order: 4;
    flex-wrap: wrap;
  }
  .actions button {
    padding: 6px 10px;
    font-size: 13px;
  }
  main {
    padding: 10px 12px 50px;
  }
  table.customers,
  table.customers tbody,
  table.customers tr,
  table.customers td {
    display: block;
  }
  table.customers tr:has(th) {
    display: none;
  }
  table.customers tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }
  table.customers tr:last-child {
    border-bottom: none;
  }
  table.customers td {
    padding: 2px 0;
    border-bottom: none;
  }
  /* Odoo dot, Pi dot and progress side by side under the name. */
  table.customers td:nth-child(2),
  table.customers td:nth-child(3),
  table.customers td:nth-child(4) {
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
  }
  table.customers td:nth-child(4) {
    width: auto;
  }
  table.customers td.acts {
    display: flex;
    margin-top: 8px;
  }
  table.customers td.acts .slot {
    width: auto;
  }
}
