:root {
  --accent: #17e8b0;
  --surface-1: #262626;
  --surface-2: #303030;
  --text: #ffffff;
  --muted: #9ca3af;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.is-hidden {
  display: none !important;
}

.loading-screen {
  min-height: calc(100vh - 190px);
  display: grid;
  place-items: center;
}

.auth-shell {
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 190px);
  align-items: center;
  padding: 0.65rem;
}

.verify-shell {
  display: flex;
  min-height: calc(100vh - 190px);
  align-items: center;
  justify-content: center;
}

.verify-panel {
  width: min(520px, 100%);
  background: var(--surface-1);
  border-radius: 16px;
  padding: 1.2rem;
  display: grid;
  gap: 0.7rem;
}

.verify-panel h1 {
  margin: 0;
  font-size: 1.5rem;
}

.auth-minimal {
  width: min(520px, 100%);
  background: var(--surface-1);
  border-radius: 16px;
  margin: 0.4rem;
  padding: 1.45rem;
  display: grid;
  gap: 0.9rem;
}

.auth-minimal h1 {
  margin: 0;
  font-size: 1.6rem;
  white-space: nowrap;
}

.auth-minimal h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 500;
}

.auth-step {
  display: none;
  gap: 0.82rem;
}

.auth-step.is-active {
  display: grid;
}

.auth-tabs {
  display: flex;
  gap: 0.4rem;
}

.auth-tab {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  font: inherit;
  cursor: pointer;
}

.auth-tab.is-active {
  background: var(--accent);
  color: #000;
}

.or-divider {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface-2);
}

.or-divider span {
  padding: 0 0.5rem;
}

.btn-google {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
}

.btn-google svg {
  width: 18px;
  height: 18px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.15rem;
  font: inherit;
}

.text-btn:hover {
  color: var(--accent);
}

.form-feedback {
  margin: 0;
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.field-shell {
  position: relative;
}

.field-shell input {
  border-radius: 999px;
  padding: 0.72rem 3rem 0.72rem 1rem;
}

.field-action-btn,
.field-icon-btn {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem;
  font: inherit;
}

.field-action-btn:hover,
.field-icon-btn:hover {
  color: var(--accent);
}

.field-icon-btn svg {
  width: 21px;
  height: 21px;
}

.reset-email {
  margin: 0;
  text-align: center;
  font-size: 1.06rem;
}

.reset-back-btn {
  justify-self: center;
  margin-top: 0.25rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
  gap: 1.15rem;
  min-height: calc(100vh - 170px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 170px);
  overflow: visible;
}

.sidebar .nav {
  display: grid;
  gap: 0.3rem;
}

.sidebar .nav-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.sidebar .nav-link.is-active,
.sidebar .nav-link:hover {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  display: grid;
  gap: 0.45rem;
}

.sidebar-footer p {
  margin: 0;
  font-size: 0.8rem;
  word-break: break-word;
}

.sidebar-signout-btn {
  justify-self: start;
  padding-left: 0;
}

.sidebar-admin-link {
  justify-self: start;
  padding-left: 0;
  color: #2f6dff;
}

.sidebar-admin-link:hover {
  color: #2f6dff;
  opacity: 0.88;
}

.content {
  display: grid;
  align-content: start;
  gap: 1rem;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding-right: 0.2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.row-center {
  justify-content: center;
}

.chip {
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--muted);
  padding: 0.32rem 0.6rem;
  font-size: 0.82rem;
}

.view {
  display: none;
  gap: 0.95rem;
}

.view.is-active {
  display: grid;
}

.panel {
  display: grid;
  gap: 0.7rem;
  background: var(--surface-1);
  border-radius: 12px;
  padding: 1rem;
}

.panel h4 {
  margin: 0 0 0.72rem;
  font-weight: 500;
}

.devices-buy-cta {
  display: flex;
}

.field-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-value {
  margin: 0;
  padding: 0.63rem 0.75rem;
  border-radius: 10px;
  background: var(--surface-2);
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0.63rem 0.75rem;
  font: inherit;
}

.buy-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.buy-term-group {
  display: grid;
  gap: 0.35rem;
  min-width: 250px;
}

.buy-term-label {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#full-term {
  min-width: 250px;
}

.btn {
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0.52rem 0.86rem;
  font: inherit;
  cursor: pointer;
}

.btn-small {
  padding: 0.36rem 0.72rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

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

.table th,
.table td {
  text-align: center;
  vertical-align: middle;
  font-size: 0.84rem;
  padding: 0.54rem 0.36rem;
  border-bottom: 1px solid var(--surface-2);
}

.sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.sort-btn.is-active {
  color: var(--accent);
}

.inline-edit {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  align-items: center;
}

.inline-edit span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: var(--surface-2);
  font-size: 0.77rem;
  color: var(--muted);
}

.pill.warn {
  color: #ffd37a;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  z-index: 40;
}

.modal-card {
  width: min(520px, calc(100vw - 24px));
  background: var(--surface-1);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
}

.modal-card h4 {
  margin: 0;
}

.mono {
  font-family: var(--mono);
  font-size: 0.79rem;
}

.log {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.8rem;
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .sidebar,
  .content {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .auth-shell {
    min-height: auto;
    padding-top: 0.8rem;
  }

  .auth-minimal h1 {
    white-space: normal;
  }

  .buy-row {
    align-items: stretch;
  }
}
