/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f5f7;
  color: #182230;
  font-family: "Segoe UI", Arial, sans-serif;
}

/* Page header */
header {
  background: #153b32;
  color: white;
  padding: 24px max(44px, calc((100% - 1800px) / 2 + 44px));
  padding-left: 32px;
}

header h1 {
  margin: 0 0 8px;
}

/* Page layout */
main {
  max-width: 1800px;
  margin: 32px auto;
  padding: 0 20px;
  display: grid;
  gap: 24px;
}

section {
  min-width: 0;
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px #0000000d;
}

h2 {
  margin: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Navigation */
.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 18px;
}

.page-nav a {
  color: #d0e3db;
  text-decoration: none;
  padding: 6px 0;
}

.page-nav a[aria-current="page"] {
  color: white;
  border-bottom: 2px solid white;
  font-weight: 600;
}

.page-nav a:hover {
  color: white;
  text-decoration: underline;
}

/* Buttons */
button {
  background: #196b50;
  color: white;
  border: 0;
  border-radius: 6px;
  padding: 10px 18px;
  cursor: pointer;
  font: inherit;
}

button:not(:disabled):hover {
  background: #153b32;
}

button.secondary {
  background: #e8edf2;
  color: #182230;
}

button.secondary:not(:disabled):hover {
  background: #dbe3eb;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.refresh {
  display: inline-block;
  background: #196b50;
  color: white;
  border-radius: 8px;
  padding: 10px 18px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}

.refresh:hover {
  background: #153b32;
}

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

select {
  padding: 9px 12px;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: white;
  color: #182230;
  font: inherit;
}

/* Shared table layout */
.table-container {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid #e2e8ee;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
}

td {
  padding: 14px 10px;
  border-bottom: 1px solid #e5e9ed;
  font-size: 14px;
}

/* Shared table headers — all pages */
th {
  min-width: 110px;
  padding: 14px;

  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;

  color: #153b32;
  background: #e4ece9;
  border-bottom: 2px solid #b8cbc3;
  vertical-align: bottom;

  position: sticky;
  top: 0;
  z-index: 1;
}

/* Table row highlighting */
tr:hover td {
  background: #f3f8f5;
}

.assets-table tbody tr:nth-child(even) td,
.telemetry-table tbody tr:nth-child(even) td {
  background: #f8fafb;
}

.assets-table tbody tr:hover td,
.telemetry-table tbody tr:hover td {
  background: #edf6f1;
}

/* Registered assets table */
.assets-table {
  font-size: 14px;
  line-height: 1.45;
}

.assets-table td {
  font-size: 16px;
  padding: 14px;
  border-bottom: 1px solid #e2e8ee;
}

.assets-table td:first-child {
  font-weight: 600;
  min-width: 150px;
}

.assets-table td:nth-child(3) {
  min-width: 220px;
  color: #596579;
  white-space: normal;
  overflow-wrap: break-word;
}

.assets-table th:nth-child(n + 4),
.assets-table td:nth-child(n + 4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.assets-table td:nth-child(n + 4) {
  white-space: nowrap;
}

/* Online measurements table */
.telemetry-table td {
  padding: 13px 14px;
}

.telemetry-table td:first-child {
  font-weight: 600;
}

.telemetry-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Measurement details table */
.measurement-table td {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.measurement-table td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 160px;
}

/* Status */
.status-unknown {
  display: inline-block;
  background: #edf0f2;
  color: #536572;
  padding: 4px 9px;
  border-radius: 16px;
  font-size: 13px;
}

/* Links */
.detail-link {
  display: inline-block;
  color: #196b50;
  border: 1px solid #bed2ca;
  border-radius: 6px;
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.detail-link:hover {
  background: #edf6f1;
}

.back-link {
  margin: 0 0 20px;
}

.back-link a {
  color: #196b50;
}

/* Supporting text */
.muted {
  color: #596579;
  line-height: 1.5;
}

.null {
  color: #596579;
  font-style: italic;
}

/* Charts */
.chart-container {
  position: relative;
  height: 340px;
}

/* Keyboard focus */
a:focus-visible,
button:focus-visible,
select:focus-visible,
.table-container:focus-visible {
  outline: 3px solid #70bca2;
  outline-offset: 3px;
}

/* Mobile layout */
@media (max-width: 640px) {
  header {
    padding: 24px 30px 24px 20px;
  }

  main {
    margin: 20px auto;
    padding: 0 12px;
  }

  section {
    padding: 18px;
  }
}

/* Touch targets */
@media (pointer: coarse) {
  .detail-link,
  .page-nav a {
    min-height: 44px;
    padding-top: 12px;
  }
}
/* Account controls and login */
.account-bar { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.account-bar form { margin: 0; }
.account-bar button { border: 1px solid #8cb4a7; padding: 7px 14px; }
.login-main { max-width: 490px; margin: 64px auto; }
.login-card { padding: 32px; }
.login-intro, .login-note { color: #526174; line-height: 1.5; }
.login-note { margin-bottom: 0; font-size: 14px; }
.login-form { display: grid; gap: 10px; margin-top: 24px; }
.login-form label { font-weight: 600; }
.login-form input:not([type="hidden"]) { width: 100%; padding: 12px; border: 1px solid #b8c5cf; border-radius: 6px; font: inherit; margin-bottom: 10px; }
.login-form input:focus { outline: 2px solid #196b50; outline-offset: 2px; }
.login-form button { margin-top: 4px; }
.login-error { color: #8c2020; background: #fff0f0; padding: 12px; border-radius: 6px; }
@media (max-width: 640px) { .login-main { margin: 28px auto; } .login-card { padding: 24px; } }
