:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #18202f;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b5d56;
  --warn: #b45309;
  --bad: #b42318;
  --good: #087443;
  --nav: #111827;
  --nav-soft: #273244;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: white;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.brand span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.sidebar .brand span {
  color: #b7c0ce;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: #d7dce5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
}

nav a.active,
nav a:hover {
  background: var(--nav-soft);
  color: white;
}

main {
  padding: 28px;
  display: grid;
  gap: 24px;
  align-content: start;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.status-pill,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: white;
  color: var(--muted);
  white-space: nowrap;
}

.section-band,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric-grid,
.work-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.work-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.metric {
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  background: #f8fafb;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 5px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
}

.checks {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.checks label {
  display: flex;
  align-items: center;
  color: var(--ink);
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
}

.primary,
.secondary,
.icon-button {
  border: 0;
  border-radius: 7px;
  min-height: 40px;
  padding: 9px 14px;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary,
.icon-button {
  background: #eef2f6;
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
  font-weight: 800;
}

.list,
.timeline {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.setup-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.setup-row > div,
.signup-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}

.setup-row small {
  display: block;
  color: var(--muted);
  margin-bottom: 5px;
}

.signup-box {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.list-item small,
.timeline small {
  color: var(--muted);
}

.qr-box {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  align-items: start;
}

#qrImage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  width: 220px;
  height: 220px;
  object-fit: contain;
}

pre {
  min-height: 220px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #101828;
  color: #e7edf7;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
}

.wide {
  overflow: hidden;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.device-title {
  font-weight: 700;
}

.device-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.ok {
  color: var(--good);
  font-weight: 700;
}

.bad {
  color: var(--bad);
  font-weight: 700;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  max-width: 360px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .metric-grid,
  .work-grid,
  .form-grid,
  .checks,
  .setup-row,
  .qr-box {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .inline-form,
  .complete-form {
    align-items: stretch;
    flex-direction: column;
  }

  nav {
    grid-template-columns: 1fr 1fr;
  }
}
