/* Lyrcloud dashboard. Builds on the tokens defined in styles.css. */

.dash-body {
  background: var(--bg);
}

.dash-body::before {
  display: none;
}

.dash-loading {
  padding: 40px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono,
.dash-app code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}

.dash-app code {
  color: var(--link);
}

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

.wrap {
  word-break: break-all;
}

/* ---------------------------------------------------------------- sidebar */

.dash-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 20px 14px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface-sidebar);
}

.dash-sidebar .brand {
  padding: 0 8px;
}

.dash-sidebar nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  font-size: 0.92rem;
}

.dash-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--ink-soft);
}

.dash-sidebar nav a:hover {
  color: var(--text);
  background: var(--hover);
}

.dash-sidebar nav a[aria-current="page"] {
  color: var(--text);
  background: rgba(50, 211, 255, 0.12);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  color: var(--brand);
  font-size: 0.85rem;
}

.nav-label {
  margin: 18px 10px 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.sidebar-docs {
  margin-top: auto;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------------------------------------------------------------- topbar */

.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

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

.preview-pill,
.plan-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: capitalize;
}

.preview-pill {
  border: 1px dashed var(--warn-line);
  color: var(--warn-ink);
}

.plan-pill {
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.role-pill,
.role-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}

.role-pill,
.role-badge.role-superadmin {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

a.role-pill:hover {
  text-decoration: underline;
}

.staff-quick {
  display: block;
}

.role-badge.role-admin {
  background: var(--badge-bg);
  color: var(--badge-ink);
}

.role-badge.role-user {
  border: 1px solid var(--line);
  color: var(--muted);
}

.avatar {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 999px;
  color: #03131d;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-weight: 800;
  line-height: 1;
}

.icon-button {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

/* ---------------------------------------------------------------- form controls */

.dash-app select,
.dash-app input:not([type="checkbox"]):not([type="radio"]),
.dash-app textarea {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-input);
  font: inherit;
  font-size: 0.92rem;
}

.dash-app select:focus,
.dash-app input:focus,
.dash-app textarea:focus {
  outline: 2px solid rgba(50, 211, 255, 0.45);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--hover);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(148, 163, 184, 0.45);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.primary {
  border-color: transparent;
  color: #04101a;
  background: linear-gradient(135deg, #58e1ff, #32d3ff);
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--danger-ink);
  background: rgba(255, 107, 107, 0.08);
}

.btn.is-confirming {
  border-color: var(--danger-ink);
  color: var(--danger-ink);
}

.btn.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.grow {
  flex: 1 1 260px;
}

.field {
  display: grid;
  gap: 8px;
  max-width: 420px;
  margin-bottom: 16px;
  font-weight: 650;
}

.form-error {
  margin: 10px 0 0;
  color: var(--danger-ink);
}

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

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--track);
  transition: background 150ms ease;
  pointer-events: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  transition: transform 150ms ease;
}

.switch input:checked + .switch-track {
  background: var(--brand-strong);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- content */

.dash-content {
  display: grid;
  gap: 20px;
  width: min(1120px, 100%);
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-head h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  word-break: break-word;
}

.page-head p {
  margin: 6px 0 0;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.panel h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel.empty {
  padding: 48px 22px;
  text-align: center;
}

.panel.empty h2 {
  font-size: 1.4rem;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border-radius: 16px;
  color: #03131d;
  background: linear-gradient(135deg, var(--brand), var(--success));
  font-size: 1.4rem;
  font-weight: 800;
}

.panel.callout {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.grid-2,
.grid-3,
.stat-grid {
  display: grid;
  gap: 20px;
}

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

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

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

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.sample-note {
  margin: -8px 0 0;
  color: var(--warn-ink);
  font-size: 0.8rem;
}

.sample-note.inline {
  margin: 0;
}

.quick span {
  color: var(--brand);
  font-weight: 800;
}

.quick h3 {
  margin-top: 10px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.quick p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.quick:hover {
  border-color: rgba(50, 211, 255, 0.4);
}

.zone-list {
  display: grid;
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 10px;
  border-top: 1px solid var(--line);
}

.zone-row:hover {
  background: var(--hover);
}

.zone-favicon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  color: var(--brand);
  background: rgba(50, 211, 255, 0.1);
  font-weight: 800;
}

.zone-name {
  flex: 1;
  min-width: 0;
}

.zone-name b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zone-name small {
  color: var(--muted);
  text-transform: capitalize;
}

.status {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status.ok {
  color: var(--success);
}

.status.pending {
  color: var(--warn-ink);
}

.status.error {
  color: var(--danger-ink);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.panel > .setting-row:first-child,
.panel-head + .setting-row {
  border-top: 0;
  padding-top: 0;
}

.setting-row h3 {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.setting-row p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.setting-control {
  flex: none;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 0 0 18px;
  font-size: 0.92rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.ns-list,
.route-list,
.rule-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.ns-list li,
.route-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 460px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
}

.rule-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.rule-list li div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rule-list code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-form,
.dns-form {
  display: grid;
  gap: 10px;
}

.rule-form {
  grid-template-columns: 1fr 2fr auto auto;
}

.dns-form {
  grid-template-columns: 100px 1fr 2fr auto auto;
  align-items: center;
  margin-bottom: 6px;
}

.plan-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.plan-option {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}

.plan-option:has(input:checked) {
  border-color: var(--brand);
  background: rgba(50, 211, 255, 0.06);
}

.plan-option input {
  margin-top: 3px;
  accent-color: var(--brand);
}

.plan-option span {
  display: grid;
  gap: 4px;
}

.plan-option small {
  color: var(--muted);
  line-height: 1.4;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented a {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.segmented a[aria-current="true"] {
  color: var(--text);
  background: rgba(50, 211, 255, 0.14);
}

/* ---------------------------------------------------------------- tables */

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.table th {
  border-top: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table td:last-child {
  text-align: right;
}

.link {
  color: var(--link);
  font-weight: 750;
}

.type-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--link);
  background: rgba(50, 211, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.proxy-toggle {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.proxy-toggle.on {
  border-color: rgba(255, 159, 67, 0.5);
  color: var(--orange-ink);
  background: rgba(255, 159, 67, 0.1);
}

/* ---------------------------------------------------------------- charts */

.chart {
  margin: 0;
}

.chart figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart figcaption span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.chart figcaption strong {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.chart-plot {
  position: relative;
  cursor: crosshair;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-area {
  fill: rgba(50, 211, 255, 0.12);
}

.chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-cursor {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0;
  vector-effect: non-scaling-stroke;
}

.chart-ticks text {
  fill: var(--muted);
  font-size: 14px;
}

.chart-tooltip {
  position: absolute;
  top: -6px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip span {
  color: var(--muted);
}

/* ---------------------------------------------------------------- editor */

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
}

.editor-panel,
.preview-panel {
  display: flex;
  flex-direction: column;
}

.dash-app .code-editor {
  flex: 1;
  min-height: 380px;
  padding: 14px;
  color: #c4f1ff;
  background: #050810;
  color-scheme: dark;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  tab-size: 2;
  resize: vertical;
}

.preview-panel .row input {
  flex: 1;
  min-width: 0;
}

.preview-output {
  flex: 1;
  min-height: 200px;
  margin: 14px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 10px;
  color: #d7deea;
  background: #050810;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------- plans */

a.plan-pill:hover {
  color: var(--text);
}

.plan-grid {
  align-items: stretch;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-card.is-current {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset;
}

.plan-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.plan-card h2,
.plan-card p {
  margin: 0;
}

.plan-price {
  font-size: 1.6rem;
}

.plan-features {
  flex: 1;
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- announcement */

.announcement {
  padding: 12px 16px;
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  color: var(--warn-ink);
  background: var(--warn-bg);
  overflow-wrap: anywhere;
}

.announcement b {
  margin-right: 6px;
}

.disabled-account {
  margin: 40px 16px;
}

/* ---------------------------------------------------------------- admin console */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-tab {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 650;
}

.admin-tab[aria-current="page"] {
  border-color: transparent;
  color: var(--brand-strong);
  background: var(--brand-tint);
}

a.stat {
  color: inherit;
}

a.stat:hover {
  border-color: var(--brand);
}

.bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bars li {
  display: grid;
  grid-template-columns: minmax(70px, 110px) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.recent-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.admin-toolbar input {
  flex: 1 1 220px;
  min-width: 0;
}

.admin-hint {
  margin: 10px 0 4px;
  font-size: 0.85rem;
}

.user-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.user-card {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.user-card:last-child {
  border-bottom: 0;
}

.user-main {
  display: grid;
  gap: 6px;
}

.user-who {
  display: grid;
  min-width: 0;
  overflow-wrap: anywhere;
}

.badges,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 650;
}

.badge.role-badge {
  border-color: transparent;
}

.badge-danger {
  border-color: transparent;
  color: var(--danger-ink);
  background: rgba(255, 107, 107, 0.12);
}

.user-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--hover);
}

.user-editor label {
  display: grid;
  flex: 1 1 160px;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack textarea {
  width: 100%;
  resize: vertical;
}

/* Mobile number and update emails */

.setting-control.phone-control {
  flex: 0 1 auto;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.phone-control p {
  margin: 0;
  font-size: 0.82rem;
}

.phone-form input {
  width: 13rem;
  max-width: 100%;
}

.stack .field {
  max-width: none;
  margin-bottom: 0;
}

.update-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.update-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .setting-row:has(.phone-control) {
    flex-direction: column;
    align-items: stretch;
  }

  .setting-control.phone-control {
    justify-items: start;
  }

  .phone-form input {
    flex: 1 1 10rem;
  }
}

/* Projects */

.status.bad {
  color: var(--danger-ink);
}

.small-text {
  margin: 4px 0 0;
  font-size: 0.8rem;
}

.github-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

.github-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.github-panel p {
  margin: 4px 0 0;
}

.import-form {
  display: grid;
  gap: 18px;
}

.import-form .field {
  max-width: none;
  margin-bottom: 0;
}

.import-form .field small {
  font-weight: 400;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-row legend {
  margin-bottom: 8px;
  font-weight: 650;
}

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

.choice:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.choice:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.choice input {
  margin-top: 4px;
}

.choice span {
  display: grid;
  gap: 2px;
}

.choice small {
  color: var(--ink-soft);
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Sections that only apply to one source or mode; the form's data attributes pick them. */
.import-form[data-kind="repo"] .only-url,
.import-form[data-kind="url"] .only-repo,
.import-form:not([data-kind="url"][data-mode="copy"]):not([data-kind="url"][data-mode="fork"]) .only-copy {
  display: none;
}

.import-form[data-mode="fork"] .only-copy .check-row {
  display: none;
}

/* Workspace: push to a new GitHub repository or to any git URL. */
.ws-push[data-dest="github"] .only-url,
.ws-push[data-dest="url"] .only-github {
  display: none;
}

.ws-push .choice-inline {
  justify-content: end;
}

.ws-push .choice-inline span {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ws-push .choice-row {
  margin-bottom: 14px;
}

.name-field {
  display: flex;
  align-items: stretch;
}

.name-field input {
  flex: 1 1 8rem;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.name-field .suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.advanced summary {
  cursor: pointer;
  font-weight: 650;
}

.advanced[open] summary {
  margin-bottom: 8px;
}

.text-link {
  padding: 0;
  border: 0;
  color: var(--brand);
  background: none;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.deploy-table code {
  font-size: 0.82rem;
}

.log-row td {
  padding-top: 0;
}

.build-log {
  max-height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 10px;
  color: #e2e8f0;
  background: #0b1220;
  font: 0.78rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1020px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .grid-3,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .dns-form,
  .rule-form {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .dash-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }

  .dash-app.sidebar-open .dash-sidebar {
    transform: none;
    box-shadow: var(--shadow);
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .dash-topbar,
  .dash-content {
    padding-inline: 16px;
  }

  .zone-picker select {
    max-width: 150px;
  }

  .preview-pill {
    display: none;
  }
}

@media (max-width: 560px) {
  .stat-grid,
  .dns-form,
  .rule-form {
    grid-template-columns: 1fr;
  }

  .setting-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .rule-list li {
    grid-template-columns: 1fr auto;
  }

  .plan-pill {
    display: none;
  }
}

/* ---------------------------------------------------------------- account menu and profile */

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.large {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
}

.avatar.xl {
  width: 88px;
  height: 88px;
  font-size: 2rem;
}

.account-menu {
  position: relative;
}

.account-button {
  display: grid;
  place-items: center;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  border-color: var(--brand);
}

.account-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.account-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  width: min(280px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.account-who {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 8px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.account-who div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-who b,
.account-who small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.account-panel a,
.account-signout {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-panel a:hover,
.account-signout:hover {
  background: var(--hover);
}

.account-signout {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--danger-ink);
  font-weight: 650;
}

.profile-panel {
  display: grid;
  gap: 20px;
}

.profile-photo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-photo h2 {
  margin: 0;
  font-size: 1.05rem;
}

.profile-photo p {
  margin: 4px 0 12px;
  font-size: 0.88rem;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.file-button.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.profile-name {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-name .field {
  flex: 1 1 220px;
  margin: 0;
}

@media (max-width: 560px) {
  .profile-photo {
    flex-direction: column;
    text-align: center;
  }

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

  .profile-name .btn {
    width: 100%;
  }
}

/* ---------------------------------------------------------------- domains */

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 9%, transparent);
}

.domain-search {
  display: flex;
  gap: 10px;
}

.domain-search input {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
}

.domain-results {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.domain-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.domain-result.is-available {
  border-color: color-mix(in srgb, var(--success) 45%, var(--line));
}

.domain-result .domain-name {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.domain-price {
  display: grid;
  justify-items: end;
  text-align: right;
}

.domain-price small,
.small {
  color: var(--muted);
  font-size: 0.82rem;
}

.domain-subhead {
  margin: 20px 0 0;
  font-size: 0.95rem;
}

.contact-fields {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.contact-fields legend {
  padding: 0 6px;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px 14px;
}

.field-grid .field {
  min-width: 0;
  max-width: none;
}

/* Inputs never push their column wider than the screen (long IDs and ARNs scroll inside the box). */
.field-grid .field input,
.field-grid .field select,
.field-grid .field textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.phone-field {
  font-weight: 650;
}

.row.tight {
  gap: 6px;
  flex-wrap: nowrap;
}

.phone-field input[name="phoneCountry"] {
  width: 4.5em;
}

.domain-checkout .field {
  margin-bottom: 0;
}

.dns-form textarea {
  min-height: 38px;
  resize: vertical;
}

@media (max-width: 560px) {
  .domain-search {
    flex-direction: column;
  }

  .domain-result {
    grid-template-columns: 1fr auto;
  }

  .domain-result .domain-price {
    justify-items: start;
    text-align: left;
    grid-row: 2;
  }
}

/* A name field with its fixed ending (".lyr.cloud", ".lyr") shown inside the box. */
.suffix-input {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
}

.suffix-input:focus-within {
  outline: 2px solid rgba(50, 211, 255, 0.45);
  outline-offset: 1px;
}

.dash-app .suffix-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
}

.suffix-input span {
  padding: 0 12px 0 2px;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

/* Sites: CDN progress */
.steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.steps li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
}
.steps li::before {
  content: '○';
  position: absolute;
  left: 4px;
}
.steps li.current {
  color: var(--warn-ink);
  font-weight: 600;
}
.steps li.current::before {
  content: '◌';
}
.steps li.done {
  color: var(--success);
}
.steps li.done::before {
  content: '●';
}
.zone-row .status + .status {
  margin-left: 8px;
}

/* ---------------------------------------------------------------- cloud */

.dash-map {
  margin: 4px 0 10px;
}

.provider-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.88rem;
}

.provider-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.provider-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

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

.steps-list {
  display: grid;
  gap: 14px;
  margin: 0 0 12px;
  padding-left: 1.3em;
}

.steps-list form {
  margin-top: 8px;
}

.estimate-lines {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.estimate-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.estimate-lines .estimate-total {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.estimate {
  max-width: 460px;
}

.service-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.service-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.service-main .link {
  overflow-wrap: anywhere;
}

.service-form {
  margin-top: 12px;
}

.service-form .field,
#cluster-form .field {
  max-width: none;
  margin-bottom: 0;
}

/* Cloud: connect AWS, Google Cloud and Azure */
.cloud-connect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.cloud-connect-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cloud-connect-card.wide {
  grid-column: 1 / -1;
}
.cloud-connect-card h3 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.cloud-connect-card .panel-head {
  margin: 0;
}
.setup-script {
  max-height: 260px;
  margin-top: 8px;
  overflow: auto;
  font-size: 0.78rem;
  white-space: pre;
}
.registry-box {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.registry-box summary {
  cursor: pointer;
  font-weight: 600;
}
.apply-results {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}
.apply-results .ok {
  color: var(--success);
}
.apply-results .bad {
  color: var(--danger, #d0263e);
}

.ssh-line {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2, rgba(0, 0, 0, 0.05));
  font-size: 0.85rem;
}

/* Cloud connect steps: the setup script scrolls inside its own box instead of widening the page,
   so the ID fields below it keep fitting the screen. */
.cloud-connect-card,
.steps-list,
.steps-list > li,
.steps-list form {
  min-width: 0;
  max-width: 100%;
}
.cloud-connect-card .setup-script {
  max-width: 100%;
  box-sizing: border-box;
}
.cloud-connect-card .row {
  flex-wrap: wrap;
}
@media (max-width: 560px) {
  .steps-list {
    padding-left: 1.1em;
  }
  .cloud-connect-card {
    padding: 12px;
  }
  .cloud-connect-card h3 {
    flex-wrap: wrap;
  }
  .cloud-connect-card .row .btn {
    flex: 1 1 auto;
  }
}

/* Affiliates & partners */
.stat small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
}

.affiliate-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.affiliate-links code {
  flex: 1;
  min-width: 0;
}

.affiliate-app {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.affiliate-app:first-of-type {
  border-top: 0;
}

.affiliate-app h3 {
  margin: 0 0 4px;
}

.affiliate-grid {
  margin-bottom: 20px;
}
