:root {
  --teal: #0797a5;
  --teal-dark: #067785;
  --teal-soft: #e8f8fa;
  --ink: #10213d;
  --muted: #637492;
  --line: #d7e6ee;
  --card: rgba(255, 255, 255, 0.92);
  --danger: #df3b3b;
  --warning: #f4a529;
  --success: #1fa45b;
  --shadow: 0 18px 48px rgba(16, 33, 61, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(7, 151, 165, 0.18), rgba(255, 255, 255, 0.86)),
    radial-gradient(circle at top left, rgba(7, 151, 165, 0.28), transparent 34%),
    #eef7fb;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(7, 151, 165, 0.24);
}

button:hover {
  filter: brightness(1.03);
}

button.secondary {
  color: var(--teal-dark);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(7, 151, 165, 0.12);
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand,
.side-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 34px;
}

.brand p,
.topbar p,
.card-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 52px;
  color: var(--teal);
  background: #fff;
  transform: skew(-8deg);
}

.login-card .brand-mark {
  color: var(--teal-dark);
}

.login-card .brand-mark span {
  color: #fff;
  background: var(--teal);
}

.brand-mark.small {
  font-size: 25px;
}

.brand-mark.small span {
  min-width: 28px;
  min-height: 34px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.form-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
}

.dashboard {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 28px 22px;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(7, 151, 165, 0.96), rgba(3, 115, 128, 0.98)),
    repeating-linear-gradient(60deg, transparent 0 140px, rgba(255,255,255,0.06) 141px 144px);
}

.side-brand span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  word-break: break-all;
}

nav {
  display: grid;
  gap: 12px;
  margin-top: 36px;
}

.nav-button {
  text-align: left;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.nav-button.active {
  color: var(--teal-dark);
  background: #fff;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.topbar h2,
.card-head h3,
.wide-card h3 {
  margin: 0;
  color: var(--ink);
}

.top-actions {
  display: flex;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px;
  border: 1px solid rgba(215, 230, 238, 0.9);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 12px 28px rgba(16, 33, 61, 0.08);
}

.summary-card strong {
  display: block;
  font-size: 28px;
}

.summary-card span {
  color: var(--muted);
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
}

.device-list-card,
.device-detail-card,
.wide-card {
  border: 1px solid rgba(215, 230, 238, 0.9);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.device-list-card {
  min-height: 640px;
  padding: 18px;
}

.device-detail-card,
.wide-card {
  min-height: 640px;
  padding: 22px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 135px;
  gap: 10px;
  margin-bottom: 14px;
}

.device-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.device-item {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.device-item.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(7, 151, 165, 0.12);
}

.device-item strong {
  word-break: break-word;
}

.device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: #eef3f6;
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8b98aa;
}

.ONLINE .dot { background: var(--success); }
.WARNING .dot { background: var(--warning); }
.OFFLINE .dot { background: var(--danger); }
.NEVER_CONNECTED .dot { background: #8b98aa; }
.DISABLED .dot { background: #39445c; }

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.detail-title h3 {
  margin: 8px 0 4px;
  font-size: 30px;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.danger {
  color: #fff;
  background: var(--danger);
  box-shadow: none;
}

.danger.secondary {
  color: var(--danger);
  background: #fff;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.info-cell {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.info-cell span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.license-box {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.license-form,
.qr-card,
.history-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.license-form {
  display: grid;
  gap: 12px;
}

.qr-code {
  display: grid;
  place-items: center;
  min-height: 250px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--teal-soft);
}

.manual-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #f7fbfd;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.history-list,
.audit-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.history-row,
.audit-row {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 520px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border-radius: 20px;
  color: #fff;
  background: var(--teal);
  font-size: 30px;
}

.panel {
  display: none;
}

.active-panel {
  display: block;
}

.dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(16, 33, 61, 0.34);
}

.dialog-card {
  display: grid;
  gap: 16px;
  min-width: 420px;
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  nav {
    display: flex;
    margin-top: 0;
  }

  .content-grid,
  .license-box {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.test-key-card,
.test-transactions-card {
  margin-bottom: 18px;
}

.test-summary {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  margin: 18px 0;
}

.test-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.4fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.test-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.test-block h3 {
  margin: 0;
}

.test-block > p {
  margin: 7px 0 16px;
  color: var(--muted);
}

.test-key-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.test-new-key {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid rgba(31, 164, 91, 0.35);
  border-radius: 16px;
  background: rgba(31, 164, 91, 0.08);
}

.test-new-key strong,
.test-new-key small {
  display: block;
}

.test-key-value {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 10px 0;
}

.test-key-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.test-key-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.test-key-row strong,
.test-key-row small {
  display: block;
  margin-bottom: 5px;
}

.test-key-row small {
  color: var(--muted);
}

.test-key-row.is-disabled {
  opacity: 0.58;
}

.test-endpoint-block input {
  font-family: Consolas, monospace;
}

.test-code-lines {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.test-code-lines code {
  display: block;
  overflow-wrap: anywhere;
}

.test-note {
  padding: 12px;
  border-radius: 12px;
  background: var(--teal-soft);
}

.test-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 160px minmax(220px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.test-table {
  min-width: 2200px;
}

.danger.secondary {
  color: var(--danger);
  border-color: rgba(223, 59, 59, 0.35);
}

@media (max-width: 1100px) {
  .test-summary,
  .test-grid,
  .test-key-form,
  .test-controls {
    grid-template-columns: 1fr;
  }
}


.metadata-form,
.release-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

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

.metadata-grid label:last-child {
  grid-column: 1 / -1;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.release-form {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  align-items: end;
  margin-bottom: 16px;
}

.release-form .release-notes {
  grid-column: span 2;
}

.release-endpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
}

code {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.release-list {
  display: grid;
  gap: 12px;
}

.release-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.release-item strong,
.release-item span,
.release-item small {
  display: block;
}

.release-item span,
.release-item small {
  color: var(--muted);
  margin-top: 5px;
}

.release-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
  align-content: start;
}

.empty-state.compact {
  min-height: 160px;
}

.warning.secondary {
  color: #f59e0b;
  background: #fff;
  border-color: rgba(245, 158, 11, 0.45);
}
.transaction-card {
  min-height: 640px;
}

.transaction-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) 180px minmax(220px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.transaction-error {
  margin: 0 0 10px;
}

.transaction-summary {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-top: 8px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.transaction-table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.transaction-table {
  width: 100%;
  min-width: 1900px;
  border-collapse: collapse;
}

.transaction-table th,
.transaction-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.transaction-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--teal);
}

.transaction-table tbody tr:hover {
  background: #f4fbfd;
}

.empty-table {
  padding: 28px !important;
  color: var(--muted);
  text-align: center !important;
}

.transaction-json {
  max-width: 520px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .transaction-controls,
  .transaction-summary,
  .release-form {
    grid-template-columns: 1fr;
  }
}
