:root {
  --ink: #172033;
  --muted: #6b7280;
  --line: #dfe3ea;
  --soft: #f5f7fa;
  --brand: #ef6c2f;
  --brand-dark: #c94f18;
  --ok: #16805b;
  --warn: #a86100;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.1);
}

/* =========================================================
       FORM
    ========================================================== */

.configuration-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  padding: 28px 32px;
  margin: 20px 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.configuration-content {
  flex: 1;
  min-width: 0;
}

.configuration-title {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 600;
  color: #1f2937;
}

.configuration-steps {
  margin: 0;
  padding-left: 24px;
  color: #6b7280;
  line-height: 1.7;
}

.configuration-steps li {
  padding-left: 4px;
  margin-bottom: 5px;
}

.configuration-steps li:last-child {
  margin-bottom: 0;
}

.configuration-download {
  flex-shrink: 0;
}

.done-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 11px 18px;

  background: #f3f4f6;
  color: #374151;

  text-decoration: none;
  font-size: 14px;
  font-weight: 600;

  border: 1px solid #d1d5db;
  border-radius: 8px;

  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.done-button:hover {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;

  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.12);
}

.done-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.done-icon {
  width: 18px;
  height: 18px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  background: #2563eb;
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.download-button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.download-button:active {
  transform: translateY(0);
  box-shadow: none;
}

.download-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 700px) {
  .configuration-card {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
  }

  .configuration-download {
    width: 100%;
  }

  .download-button {
    width: 100%;
  }
}
.gateway-form {
  width: 100%;
  /*max-width: 900px;
        */
  font-family: Arial, sans-serif;

  font-size: 13px;
  color: #333;
}

/* =========================================================
       SECTIONS
    ========================================================== */

.config-section {
  width: 100%;
  margin-bottom: 25px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  padding: 10px 0;
  margin-bottom: 5px;
  border-bottom: 1px solid #ddd;
}

.subsection-title {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e5e5e5;
}

/* =========================================================
   CONFIG ROW
========================================================== */

.config-row {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 4px;
}

.config-label {
  width: 220px;
  flex-shrink: 0;
  font-weight: 400;
  padding-right: 20px;
}

.form-control {
  width: 260px;
  max-width: 100%;
  height: 32px;
  padding: 5px 9px;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #fff;
  box-sizing: border-box;
  font-size: 13px;
}

.form-control:focus,
.cell-input:focus {
  outline: none;
  border-color: #409eff;
}

/* =========================================================
   ADVANCED
========================================================== */

.advanced-options {
  display: none;
  padding-left: 0;
}

.advanced-options.active {
  display: block;
}

/* =========================================================
   SWITCH
========================================================== */

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: 0.2s;
}

.slider:before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: #409eff;
}

.switch input:checked + .slider:before {
  transform: translateX(16px);
}

/* =========================================================
   TABLE
========================================================== */

.config-table-wrapper {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 15px;
  overflow-x: auto;
}

.config-table {
  text-align: center;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid #ddd;
}

.config-table th {
  height: 38px;
  padding: 8px 10px;
  background: #f7f7f7;
  border-bottom: 1px solid #ddd;
  text-align: center;
  font-weight: 600;
}

.config-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #eee;
}

.config-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-input {
  width: 100%;
  height: 30px;
  padding: 5px 8px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 13px;
}

.operation-cell {
  text-align: center;
}

/* =========================================================
   BUTTONS
========================================================== */

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 2px;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.icon-btn:hover {
  background: #f5f5f5;
}

.add-row td {
  text-align: center;
  background: #fafafa;
}

.add-btn {
  font-size: 20px;
  font-weight: 400;
}

.btn {
  min-width: 90px;
  height: 34px;
  padding: 0 18px;
  border: 1px solid #ccc;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
}

.btn-primary {
  color: white;
  background: #409eff;
  border-color: #409eff;
}

.btn-primary:hover {
  background: #338ecc;
}

.btn-secondary {
  background: white;
  color: #555;
}

/* =========================================================
   ACTIONS
========================================================== */

.form-actions {
  padding-top: 20px;
  border-top: 1px solid #ddd;
  text-align: center;
}

.form-actions .btn {
  margin: 0 5px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f8fb;
  color: var(--ink);
  font:
    14px/1.5 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 17px;
  font-weight: 750;
}

.brand-mark,
.logo-box {
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 42px;
  height: 30px;
  border-radius: 7px;
  font-size: 12px;
}

.topbar-right {
  display: flex;
  gap: 14px;
  align-items: center;
}

.scope-pill {
  background: #fff3ec;
  color: #9c3c12;
  border: 1px solid #ffd7c2;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.user-label {
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: end;
  padding: 0 32px;
  gap: 24px;
}

.tabs a {
  padding: 13px 2px 11px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tabs a.active {
  color: var(--ink);
  font-weight: 700;
  border-color: var(--brand);
}

.page-shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: 30px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.page-heading h1 {
  margin: 0;
  font-size: 28px;
}

.page-heading p,
.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(23, 32, 51, 0.035);
  padding: 22px;
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2,
.wizard-card h2 {
  margin: 0;
  font-size: 18px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.btn-primary:hover {
  background: #27334c;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #27334c;
}

.btn-secondary {
  background: #fff3ec;
  color: #9c3c12;
  border-color: #ffc7a8;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-small {
  padding: 6px 10px;
  min-height: 32px;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gateway-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.gateway-form label,
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 650;
  font-size: 13px;
}

.gateway-form input,
.stack-form input:not([type="checkbox"]):not([type="radio"]),
.stack-form select {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.gateway-form input:focus,
.stack-form input:focus,
.stack-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(239, 108, 47, 0.12);
}

.gateway-form .form-actions {
  grid-column: 1/-1;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stack-form small {
  color: var(--muted);
  font-weight: 400;
}

.sensor-config-page .stack-form .device-status-activation {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.sensor-config-page .stack-form .device-status-activation input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

.device-status-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.device-status-check .btn {
  flex: 0 0 auto;
}

.bms-register-actions,
.form-action-buttons {
  flex-wrap: wrap;
}

.form-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.reading-preview summary {
  cursor: pointer;
  font-weight: 600;
}

.reading-preview .table-wrap {
  max-height: 280px;
  margin-top: 12px;
  overflow: auto;
}

.reading-preview th,
.reading-preview td {
  text-align: left;
}

.reading-preview th {
  position: sticky;
  top: 0;
  background: #f6f7fb;
}

.field-error,
.errorlist {
  color: var(--danger) !important;
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

th {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 14px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: middle;
}

td small {
  display: block;
  color: var(--muted);
}

code {
  background: #f3f4f6;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 750;
  margin-left: 6px;
}

.badge-online {
  background: #e9f7f1;
  color: var(--ok);
}

.badge-offline,
.badge-error {
  background: #fff0ee;
  color: var(--danger);
}

.badge-unknown,
.badge-draft,
.badge-gateway_offline,
.badge-pending_verification {
  background: #f0f2f5;
  color: #626b7a;
}

.badge-low {
  background: #fff4df;
  color: var(--warn);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 42px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background: radial-gradient(circle at top right, #fff1e9, transparent 32%), #f7f8fb;
}

.auth-card,
.switch-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.switch-card {
  width: min(600px, 100%);
}

.logo-box {
  width: 62px;
  height: 42px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-card h1,
.switch-card h1 {
  margin: 0;
  font-size: 25px;
}

.auth-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 20px 0 0;
}

.form-error,
.message {
  border-radius: 8px;
  padding: 10px 12px;
}

.form-error {
  background: #fff0ee;
  color: var(--danger);
}

.messages {
  margin-bottom: 18px;
}

.message {
  border-radius: 8px;
  padding: 10px 12px;
}

.message.success {
  background: #edf7f3;
  color: var(--ok);
  border: 1px solid #caebdf;
}

.message.error {
  background: #fff0ee;
  color: var(--danger);
  border: 1px solid #ffd0ca;
}

.message.warning {
  background: #fff4df;
  color: var(--warn);
  border: 1px solid #f5d59b;
}

.message.info {
  background: #eef4ff;
  color: #315a9e;
  border: 1px solid #cdddf8;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0;
}

.choice-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
}

.choice-card:has(input:checked) {
  border-color: var(--brand);
  background: #fff8f4;
}

.choice-card small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.wizard-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 220px;
  gap: 20px;
  align-items: start;
}

.wizard-steps,
.activity-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.wizard-step {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  color: var(--muted);
}

.wizard-step > span {
  width: 26px;
  height: 26px;
  border: 1px solid #cbd1da;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 750;
}

.wizard-step.active {
  color: var(--ink);
}

.wizard-step.active > span,
.wizard-step.done > span {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.wizard-step small {
  display: block;
  font-size: 11px;
}

.wizard-card {
  min-height: 410px;
  margin: 0;
}

.activity-panel h3 {
  font-size: 14px;
  margin: 0 0 16px;
}

.activity-panel > p {
  color: var(--muted);
  font-size: 12px;
}

.activity-item {
  display: flex;
  gap: 9px;
  margin: 16px 0;
}

.activity-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  margin-top: 5px;
  flex: none;
}

.muted-dot {
  background: #cbd1da;
}

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

.chip {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.sensor-summary,
.telemetry-grid {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.sensor-summary {
  grid-template-columns: repeat(3, 1fr);
}

.telemetry-grid {
  grid-template-columns: repeat(4, 1fr);
}

.sensor-summary > div,
.telemetry-grid > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

@media (max-width: 950px) {
  .wizard-layout {
    grid-template-columns: 1fr;
  }

  .wizard-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .activity-panel {
    display: none;
  }

  .gateway-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 650px) {
  .topbar {
    padding: 0 16px;
  }

  .scope-pill,
  .user-label {
    display: none;
  }

  .tabs,
  .page-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .gateway-form,
  .field-row,
  .choice-grid,
  .sensor-summary,
  .telemetry-grid {
    grid-template-columns: 1fr;
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .wizard-step small {
    display: none;
  }

  .card {
    padding: 16px;
  }

  .page-heading h1 {
    font-size: 24px;
  }
}

.sensor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sensor-actions form {
  margin: 0;
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: none;
}

.gateway-actions {
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.gateway-actions form {
  display: inline-flex;
  margin: 0;
}

.verification-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
}

.verification-timer strong {
  color: var(--ink);
  font-size: 16px;
}

.verification-timer.expired {
  background: #fff0ee;
  border-color: #ffd0ca;
  color: var(--danger);
}

.verification-timer.expired strong {
  color: var(--danger);
}

/* =========================================================
   SETTINGS OVERLAY
   ========================================================= */

.settings-overlay {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.55);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;

  z-index: 900;
}

.settings-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* =========================================================
   SETTINGS SIDEBAR
   ========================================================= */

.settings-sidebar {
  position: fixed;

  top: 0;
  right: 0;

  width: 50vw;
  max-width: 720px;
  min-width: 480px;

  height: 100vh;

  background: #ffffff;

  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.25);

  transform: translateX(100%);

  transition: transform 0.3s ease;

  z-index: 1000;

  display: flex;
  flex-direction: column;
}

.settings-sidebar.open {
  transform: translateX(0);
}

/* =========================================================
   HEADER
   ========================================================= */

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  padding: 28px 32px;

  border-bottom: 1px solid #e5e7eb;
}

.settings-header h2 {
  margin: 0;
}

.settings-header p {
  margin: 5px 0 0;
}

/* Close button */

.settings-close {
  border: none;
  background: transparent;

  font-size: 32px;
  line-height: 1;

  cursor: pointer;

  color: #555;

  padding: 0;
}

.settings-close:hover {
  color: #000;
}

/* =========================================================
   CONTENT
   ========================================================= */

.settings-content {
  flex: 1;

  overflow-y: auto;

  padding: 32px;

  display: flex;
  flex-direction: column;
}

/* =========================================================
   FORM
   ========================================================= */

.settings-form {
  display: flex;
  flex-direction: column;

  gap: 36px;
}

.credential-section {
  display: flex;
  flex-direction: column;

  gap: 16px;

  padding-bottom: 32px;

  border-bottom: 1px solid #e5e7eb;
}

.credential-section h3 {
  margin: 0;
}

.credential-url {
  margin: -8px 0 4px;

  word-break: break-all;
}

/* Labels */

.credential-section label {
  display: flex;
  flex-direction: column;

  gap: 8px;

  font-weight: 600;
}

/* Inputs */

.credential-section input {
  width: 100%;

  box-sizing: border-box;

  padding: 12px 14px;

  border: 1px solid #d1d5db;

  border-radius: 7px;

  font-size: 15px;

  background: #ffffff;
}

.credential-section input:focus {
  outline: none;

  border-color: #4b78ff;

  box-shadow: 0 0 0 3px rgba(75, 120, 255, 0.12);
}

/* Save button */

.settings-save {
  align-self: flex-end;
}

/* =========================================================
   FOOTER / LOGOUT
   ========================================================= */

.settings-footer {
  margin-top: auto;

  padding-top: 28px;

  border-top: 1px solid #e5e7eb;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;
}

.settings-user {
  display: flex;
  flex-direction: column;

  gap: 3px;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 800px) {
  .settings-sidebar {
    width: 90vw;
    min-width: 0;
    max-width: none;
  }
}

body.settings-open {
  overflow: hidden;
}

.application-option-section {
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 18px;
}

.option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.option-header p {
  margin: 4px 0 0;
}

.switch-row {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  width: auto !important;
  cursor: pointer;
}

.switch-row input {
  width: auto;
  margin: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.checkbox-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  cursor: pointer;
}

.checkbox-option input {
  width: auto;
  margin: 0;
}

.http_fields {
  margin-top: 18px;
}

.forwarding-group {
  margin-top: 20px;
}

.forwarding-group:first-child {
  margin-top: 0;
}

.forwarding-group h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.header-table input {
  width: 100%;
  box-sizing: border-box;
}

.header-delete-btn {
  padding: 6px 10px;
}

.add-row td {
  text-align: left;
}

.gateway-actions {
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gateway-actions form {
  margin: 0;
}

/* =========================================================
   SENSOR CONFIGURATION PAGE
   ========================================================= */

.sensor-config-page .wizard-card {
  padding: 28px 32px;
  min-width: 0;
}

/* -------------------------
   Section headings
------------------------- */

.sensor-config-page .section-heading {
  margin-bottom: 14px;
}

.sensor-config-page .section-heading h2,
.sensor-config-page .wizard-card h2 {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: -0.01em;
  margin: 0;
  unicode-bidi: isolate;
}

.sensor-config-page .section-heading p {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  margin-top: 3px;
}

/* -------------------------
   Sensor information
------------------------- */

.sensor-config-page .sensor-summary,
.sensor-config-page .device-status-section {
  display: block;

  margin: 0 0 26px;
  padding: 0 0 26px;

  border-bottom: 1px solid var(--line);
}

.sensor-config-page .sensor-info-grid {
  display: grid;

  grid-template-columns: repeat(4, minmax(120px, 1fr));

  gap: 10px;

  margin-top: 14px;
}

.sensor-config-page .sensor-info-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  min-width: 0;
  min-height: 70px;

  padding: 11px 13px;

  background: #f8f9fb;
  border: 1px solid #e8ebf0;
  border-radius: 9px;
}

.sensor-config-page .sensor-info-item small {
  display: block;

  margin-bottom: 4px;

  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 10px;
  font-weight: 650;

  letter-spacing: 0.045em;
  text-transform: uppercase;

  color: #8a919d;
}

.sensor-config-page .sensor-info-item strong {
  font:
    14px/1.5 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* -------------------------
   Configuration form
------------------------- */

.sensor-config-page .configuration-section {
  margin-top: 0;
}

.sensor-config-page .stack-form {
  gap: 15px;
}

.sensor-config-page .field-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 14px;
}

.sensor-config-page .stack-form label {
  gap: 5px;

  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;

  color: #454b55;
}

.sensor-config-page .stack-form input:not([type="checkbox"]):not([type="radio"]),
.sensor-config-page .stack-form select {
  height: 38px;

  padding: 0 10px;

  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;

  border-radius: 7px;
}

.sensor-config-page .stack-form small {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 10px;
  line-height: 1.4;
}

/* -------------------------
   Actions
------------------------- */

.sensor-config-page .form-actions {
  margin-top: 20px;
  padding-top: 18px;

  border-top: 1px solid #edf0f4;
}

.sensor-config-page .form-actions .btn {
  min-height: 36px;

  padding: 8px 14px;

  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
}

/* -------------------------
   Side activity panel
------------------------- */

/* -------------------------
   Responsive
------------------------- */

@media (max-width: 1100px) {
  .sensor-config-page .sensor-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sensor-config-page .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .sensor-config-page .wizard-card {
    padding: 20px 16px;
  }

  .sensor-config-page .sensor-info-grid,
  .sensor-config-page .field-row {
    grid-template-columns: 1fr;
  }
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--ink);
  background: #eceff3;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.table-toolbar input {
  width: 260px;
  height: 38px;
  padding: 0 12px;

  border: 1px solid var(--line);
  border-radius: 8px;

  font: inherit;
  font-size: 13px;

  outline: none;
}

.table-toolbar input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(239, 108, 47, 0.12);
}

.gateway-resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.gateway-resource-section {
  padding: 16px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: #f8f9fb;
}

.gateway-resource-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 12px;
}

.gateway-resource-header h3 {
  margin: 0;

  font-size: 14px;
}

.gateway-resource-item {
  padding: 9px 0;

  border-bottom: 1px solid #e8ebf0;

  font-size: 12px;
}

.gateway-resource-item:last-child {
  border-bottom: 0;
}

@media (max-width: 700px) {
  .gateway-resource-grid {
    grid-template-columns: 1fr;
  }
}

.global-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(2px);
}

.global-loading[hidden] {
  display: none;
}

.global-loading-box {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 16px 22px;
  border-radius: 10px;

  background: white;

  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.global-spinner {
  width: 22px;
  height: 22px;

  border: 3px solid #ddd;
  border-top-color: #333;
  border-radius: 50%;

  animation: global-spin 0.7s linear infinite;
}

@keyframes global-spin {
  to {
    transform: rotate(360deg);
  }
}

.page-heading-actions {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.section-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-name-col,
.header-value-col {
  width: 45%;
}

.header-action-col {
  width: 10%;
}

.download-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gateway-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.advanced-options {
  display: none;
}

.header-name-col,
.header-value-col {
  width: 45%;
}

.header-operation-col {
  width: 10%;
}

.mqtt-data-type-col {
  width: 22%;
}

.mqtt-topic-col {
  width: 38%;
}

.mqtt-retain-col {
  width: 15%;
}

.mqtt-qos-col {
  width: 25%;
}

.section-heading-actions {
  display: flex;
  gap: 5px;
}

.spinner-hidden {
  display: none;
}
