:root {
  --ink: #23282d;
  --ink-soft: #3d4654;
  --muted: #616161;
  --paper: #f5f5f5;
  --card: #ffffff;
  --line: #e0e0e0;
  --teal: #298987;
  --teal-soft: #5e9d9c;
  --pine: #298987;
  --danger: #f44336;
  --shadow: 0 1px 5px rgb(171 171 171 / 52%);
  --sans: "Cabin", "Segoe UI", sans-serif;
  --serif: "Cabin", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(to right bottom, #f5f5f5, #ffffff, #d0d0d0);
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--teal); }

a:hover { color: var(--teal-soft); }

h1, h2, h3, .brand {
  font-family: var(--sans);
  font-weight: 400;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  border-radius: 2px;
  padding: 0.7rem 1.15rem;
  background: var(--teal);
  color: #ffffff;
  cursor: pointer;
}

button:hover { background: var(--teal-soft); }

button.ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--line);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  font-size: 0.86rem;
  color: var(--muted);
}

input, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.32rem 0.6rem;
  line-height: 1.25;
  background: white;
}

input:focus, select:focus {
  outline: 2px solid rgba(41, 137, 135, 0.35);
  border-color: var(--teal);
}

.alert {
  background: #f8e6e1;
  color: var(--danger);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.empty { color: var(--muted); }

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.side {
  padding: 1.4rem 1.2rem;
  background: #f5f5f5;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  box-shadow: 1px 0 5px rgb(171 171 171 / 35%);
}

.brand { display: block; line-height: 0; }

.brand img { width: 148px; height: auto; }

.brand-note { margin: 0; color: var(--muted); font-size: 0.9rem; }

.hello {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
}

.hello p { margin: 0; font-weight: 700; }

.account-menu { position: relative; }

.account-menu summary {
  list-style: none;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  border-radius: 2px;
}

.account-menu summary::-webkit-details-marker { display: none; }

.account-menu summary span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

.account-menu summary:hover { background: rgba(41, 137, 135, 0.12); }

.account-menu form {
  position: absolute;
  z-index: 8;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 11rem;
  padding: 0.45rem;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.account-menu button { width: 100%; }

.side nav { display: flex; flex-direction: column; gap: 0.35rem; }

.nav-link {
  color: var(--teal);
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  border-radius: 2px;
}

.nav-link:hover { color: var(--teal-soft); background: transparent; }

main { padding: 2rem 2.2rem 3rem; }

.page-head h1 { margin: 0.2rem 0; font-size: 2.3rem; color: #000000; }

.help { max-width: 46rem; counter-reset: help; }

.help-lead {
  margin: 0.35rem 0 0;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.help section {
  margin: 1.35rem 0 0;
  padding: 1.15rem 1.3rem 0.35rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.help h2 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 2px solid var(--teal);
  font-size: 1.5rem;
  font-weight: 700;
  color: #000000;
  line-height: 1.15;
}

.help h2::before {
  counter-increment: help;
  content: counter(help, decimal-leading-zero);
  color: var(--teal);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.help p { margin: 0 0 0.85rem; line-height: 1.55; }

.help ul { margin: 0.2rem 0 0.8rem; padding-left: 1.2rem; }

.help li { margin: 0.2rem 0; }

.help code { font-size: 0.92em; }

.page-head p, .crumb, .hint { color: var(--muted); }

.device-list, .plain { list-style: none; padding: 0; margin: 0; }

.device-list li, .plain li, .versions li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.7rem;
}

.device-list li.silence {
  background: transparent;
}

.device-list li.calme {
  background: #e7f4ee;
  border-color: #b7d7c8;
}

.device-list li.recent {
  background: #f7f3ec;
  border-color: #e6dccb;
}

.device-list li.actuel {
  background: #f6e6e4;
  border-color: #e3c6c3;
}

.alarm-note.recent { color: #8a7560; font-weight: 600; }

.alarm-note.actuel { color: #8c4540; font-weight: 700; }

.device-list li {
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.45rem;
}

.device-body { display: flex; flex-direction: column; gap: 0.28rem; min-width: 0; }

.device-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.85rem;
}

.device-list .last-seen { margin: 0; color: var(--ink); font-size: 0.8rem; }

.device-list .pending-order { margin: 0; color: #8c4540; font-size: 0.86rem; font-weight: 700; }

.row-menu { position: relative; }

.row-menu > summary {
  list-style: none;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 3px;
  border-radius: 2px;
}

.row-menu summary::-webkit-details-marker,
.command-menu summary::-webkit-details-marker { display: none; }

.row-menu > summary span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

.row-menu > summary:hover { background: rgba(41, 137, 135, 0.12); }

.row-menu-panel {
  position: absolute;
  z-index: 8;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 16rem;
  padding: 0.35rem;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.row-menu-panel > a,
.command-menu > summary {
  display: block;
  padding: 0.4rem 0.55rem;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}

.row-menu-panel > a:hover,
.command-menu > summary:hover { background: rgba(41, 137, 135, 0.1); }

.command-menu form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.25rem 0.45rem 0.4rem;
}

.command-menu select,
.command-menu input { width: auto; }

.command-menu button { padding: 0.3rem 0.55rem; }

.device-list h2 { margin: 0; font-size: 1.15rem; }

.client-name { color: var(--ink); font-weight: 700; }

.button-link {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border-radius: 2px;
  background: var(--teal);
  color: #ffffff;
  text-decoration: none;
  font-weight: 400;
}

.button-link:hover { background: var(--teal-soft); color: #ffffff; }

.narrow { max-width: 360px; }

.label-line { display: inline-flex; align-items: center; gap: 0.35rem; }

.info { position: relative; display: inline-flex; }

.info-mark {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 1px solid var(--teal);
  border-radius: 50%;
  background: #ffffff;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.info-mark:hover,
.info-mark:focus { background: var(--teal); color: #ffffff; }

.info-tip {
  display: none;
  position: absolute;
  z-index: 5;
  left: 0;
  top: calc(100% + 0.35rem);
  width: max-content;
  max-width: 260px;
  padding: 0.55rem 0.7rem;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.35;
}

.info:hover .info-tip,
.info:focus-within .info-tip { display: block; }

.device-list p { margin: 0; color: var(--muted); }

.device-list .config-state { margin-top: 0; }

.config-state {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.config-state.ok { color: var(--pine); background: rgba(31, 111, 91, 0.12); }

.config-state.stale { color: #8d3f22; background: rgba(184, 90, 50, 0.14); }

.config-state.none { color: var(--muted); background: rgba(110, 103, 93, 0.12); }

.version-actions { display: flex; gap: 0.5rem; align-items: center; }

.version-actions form { margin: 0; }

.row-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.row-actions a { text-decoration: none; font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 1.4rem; }

.channel-grid, .split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

legend { font-family: var(--serif); padding: 0 0.3rem; }

.debut { max-width: 280px; }

.view-switch { display: flex; gap: 0.4rem; margin: 0 0 1rem; }

.view-switch a {
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #ffffff;
}

.view-switch a.on,
.view-switch a.on:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

@media (min-width: 1100px) {
  .chart-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }

  .chart-card {
    padding: 0.55rem 0.7rem 0.35rem;
  }

  .chart-card h2 { font-size: 1rem; }
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.8rem 0.9rem 0.5rem;
}

.chart-card h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }

.chart-frame { position: relative; }

.chart-card svg { width: 100%; height: auto; display: block; }

.chart-card svg text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }

.chart-card svg .grid { stroke: var(--line); stroke-width: 1; }

.chart-card svg .measure { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.chart-card svg .dig { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.chart-card svg .dig-1 { stroke: #298987; }

.chart-card svg .dig-2 { stroke: #b85a32; }

.chart-card svg .dig-3 { stroke: #23282d; }

.chart-card svg .dig-4 { stroke: #5e9d9c; }

.chart-card svg .measure-dot { fill: var(--teal); }

.chart-card svg .threshold { fill: none; stroke-width: 1.5; }

.chart-card svg .threshold.low { stroke: #b85a32; stroke-dasharray: 5 4; }

.chart-card svg .threshold.high { stroke: #23282d; stroke-dasharray: 2 3; }

.chart-card svg .hover-line { stroke: #23282d; stroke-width: 1; stroke-dasharray: 3 3; }

.chart-card svg .hover-dot { fill: var(--teal); }

.chart-tip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  min-width: 10rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: #23282d;
  color: #ffffff;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: var(--shadow);
}

.chart-tip time {
  display: block;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.chart-tip p { margin: 0; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.swatch {
  display: inline-block;
  width: 1rem;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.swatch.measure { border-top-color: var(--teal); }

.swatch.low { border-top-color: #b85a32; border-top-style: dashed; }

.swatch.high { border-top-color: #23282d; border-top-style: dashed; }

.swatch.dig-1 { border-top-color: #298987; }

.swatch.dig-2 { border-top-color: #b85a32; }

.swatch.dig-3 { border-top-color: #23282d; }

.swatch.dig-4 { border-top-color: #5e9d9c; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 1.2rem;
}

.filters select { min-width: 12rem; }

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.chart-picker { position: relative; }

.chart-picker > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.32rem 1.6rem 0.32rem 0.6rem;
  line-height: 1.25;
  background: #ffffff;
  color: var(--ink);
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-picker > summary::-webkit-details-marker { display: none; }

.chart-picker > summary::after {
  content: "";
  position: absolute;
  right: 0.6rem;
  top: 50%;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}

.chart-picker-panel {
  position: absolute;
  z-index: 8;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 16rem;
  max-height: 18rem;
  overflow: auto;
  padding: 0.35rem;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.chart-picker-panel label {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.45rem;
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
}

.chart-picker-panel label:hover { background: rgba(41, 137, 135, 0.1); }

.chart-picker-panel input { width: auto; padding: 0; }

.account-create {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 1rem 1.1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th, td { padding: 0.55rem 0.7rem; text-align: right; white-space: nowrap; }

th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }

th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f5f5f5;
}

tr:nth-child(even) td { background: #fafafa; }

.tor span {
  display: inline-block;
  width: 1.15rem;
  text-align: center;
  border-radius: 4px;
  color: var(--muted);
}

.tor .on { background: var(--pine); color: white; }

.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(to right bottom, #f5f5f5, #ffffff, #d0d0d0);
  color: var(--ink);
  overflow: hidden;
}

.login-scene { position: fixed; inset: 0; pointer-events: none; }

.chart { position: absolute; width: 70vw; height: 34vh; }

.chart path { fill: rgba(41, 137, 135, 0.16); }

.chart .line { stroke: rgba(35, 40, 45, 0.28); stroke-width: 2.5; }

.chart .thin { stroke: rgba(94, 157, 156, 0.95); stroke-width: 1.6; }

.chart-a { left: -8vw; bottom: -4vh; }
.chart-b { right: -10vw; top: -6vh; transform: scaleX(-1); }
.chart-b path { fill: rgba(41, 137, 135, 0.1); }
.chart-c { left: 18vw; top: 12vh; width: 48vw; opacity: 0.85; }

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(41, 137, 135, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 137, 135, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 45%, black, transparent 75%);
}

.login-card {
  position: relative;
  width: min(420px, calc(100% - 2rem));
  background: #ffffff;
  color: var(--ink);
  border-radius: 4px;
  padding: 2rem 2rem 1.6rem;
  box-shadow: var(--shadow);
}

.login-logo { width: min(220px, 100%); height: auto; }

.login-card h1 { margin: 1.1rem 0 0; font-size: 1.7rem; font-weight: 400; }

.lede { color: var(--ink-soft); margin-top: 0.3rem; }

.login-card form { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1.2rem; }

.login-card button { margin-top: 0.4rem; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { gap: 0.8rem; }
  main { padding: 1.2rem; }
  .device-list li { flex-direction: column; align-items: flex-start; }
}
