:root {
  color-scheme: dark;
  --bg: #111317;
  --panel: #1b1f24;
  --panel-2: #232931;
  --text: #f2f5f7;
  --muted: #9aa7b2;
  --line: #303842;
  --accent: #00a884;
  --danger: #e65c5c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0f1418 0%, #14171d 42%, #101317 100%);
  color: var(--text);
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.login {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  grid-template-areas:
    "hero access"
    "quick quick";
  gap: 24px;
  align-items: stretch;
}

.login-hero {
  grid-area: hero;
  min-height: 300px;
  display: grid;
  align-content: center;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0,168,132,.18), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
}

.brand-logo {
  width: min(180px, 42vw) !important;
  max-width: 180px !important;
  max-height: 180px !important;
  object-fit: contain;
  height: auto !important;
  display: block;
  margin-bottom: 20px;
}

.login-hero h1 {
  max-width: 620px;
  font-size: clamp(34px, 5vw, 52px);
  margin-bottom: 16px;
}

.login-hero p:not(.eyebrow) {
  max-width: 560px;
  font-size: 18px;
  line-height: 1.45;
}

.access-column {
  grid-area: access;
  display: grid;
  gap: 16px;
  align-content: start;
}

.quick-card {
  grid-area: quick;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 14px;
}

.quick-card h2,
.quick-card .validation-message,
.quick-card button {
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
}

.wide {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.support-box {
  min-width: min(340px, 100%);
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 0 0 8px;
}

h1, h2 {
  margin: 0 0 14px;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #12161b;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  outline: none;
}

.password-wrap {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 0;
}

.password-toggle {
  display: grid;
  place-items: center;
  min-width: 46px;
  padding: 0;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  font-size: 18px;
}

.password-wrap input {
  border-radius: 6px 0 0 6px;
}

.password-toggle.is-visible {
  background: var(--accent);
  color: #04110d;
}

.palette {
  display: flex;
  gap: 8px;
  margin: -4px 0 14px;
}

.palette button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid rgba(255,255,255,.28);
  background: var(--swatch);
  border-radius: 999px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #04110d;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

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

.button-link, .inline-link {
  color: var(--text);
  font-weight: 700;
}

.button-link, .support-link {
  display: inline-block;
  background: var(--accent);
  color: #04110d;
  text-decoration: none;
  border-radius: 6px;
  padding: 10px 14px;
}

.support-link {
  width: max-content;
  margin-top: 8px;
}

.row textarea {
  margin-top: 10px;
  min-height: 78px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats article {
  background: #050607;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stats strong {
  font-size: 28px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tabs button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
}

.tabs button.active {
  color: #04110d;
  background: var(--accent);
  border-color: var(--accent);
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

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

.grid.active {
  display: grid;
}

.list {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: #13181d;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.device-row {
  grid-template-columns: 1fr;
}

.device-head {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}

.device-head small {
  color: var(--accent);
}

.device-detail {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.device-detail dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.device-detail dt {
  color: var(--muted);
  font-size: 12px;
}

.device-detail dd {
  margin: 2px 0 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

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

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

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

.message {
  min-height: 20px;
}

.message.error, .validation-message.error {
  color: var(--danger);
}

.validation-message.success {
  color: var(--accent);
}

.validation-message {
  min-height: 18px;
  margin: -4px 0 10px;
  font-size: 13px;
}

pre {
  white-space: pre-wrap;
  background: #12161b;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .login, .grid, .stats {
    grid-template-columns: 1fr;
  }

  .login {
    grid-template-areas:
      "hero"
      "access"
      "quick";
  }

  .login-hero {
    min-height: auto;
    padding: 24px;
  }

  .login-hero h1 {
    font-size: 32px;
  }

  .access-column {
    position: static;
  }

  .quick-card {
    grid-template-columns: 1fr;
  }

  .device-detail dl {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions > * {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
  }

  .tabs button {
    white-space: nowrap;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }
}
