/* Page-level layout: auth/onboarding cards and the dashboard shell. */

.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7);
}
.auth-card {
  width: 560px;
  max-width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2);
  padding: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.auth-card h1 {
  font-size: var(--fs-xl);
  margin: 0;
  font-weight: 600;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
}
.wordmark::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: var(--radius-1);
  background: var(--accent);
}
.step-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.step-indicator .bar {
  width: 24px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border-subtle);
}
.step-indicator .bar--done {
  background: var(--accent);
}

.shell {
  display: flex;
  min-height: 100vh;
}
.shell__side {
  width: 212px;
  flex: none;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
}
.shell__main {
  flex: 1;
  min-width: 0;
  padding: var(--space-6);
}
.side__org {
  position: relative;
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.side__org summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2);
  cursor: pointer;
  user-select: none;
}
.side__org summary::-webkit-details-marker {
  display: none;
}
.side__org summary:hover {
  background: var(--bg-inset);
  border-color: var(--border);
}
.side__org-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: var(--radius-1);
  background: var(--accent);
  color: var(--bg);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.side__org-name {
  font-weight: 500;
}
.side__org-chevron {
  margin-left: auto;
  color: var(--fg-subtle);
}
.side__org ul {
  position: absolute;
  top: calc(100% - var(--space-2));
  left: var(--space-3);
  right: var(--space-3);
  z-index: 10;
  list-style: none;
  margin: 0;
  padding: var(--space-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
}
.side__org ul a {
  display: block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-1);
  color: var(--fg);
}
.side__org ul a:hover {
  background: var(--bg-inset);
  text-decoration: none;
}
.side__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-2);
}
.side__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-1);
  color: var(--fg-subtle);
}
.side__nav a svg {
  flex: none;
}
.side__nav a:hover {
  color: var(--fg);
  background: var(--bg-inset);
  text-decoration: none;
}
.side__nav a[aria-current="page"] {
  color: var(--fg);
  background: var(--bg-inset);
  box-shadow: inset 2px 0 0 var(--accent);
}
.side__nav .badge {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.side__user {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-xs);
}
.side__user .role {
  color: var(--fg-subtle);
  flex: 1;
}
.side__user form {
  margin: 0;
}
.side__user .btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
}

.page-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.page-head h1 {
  font-size: var(--fs-xl);
  margin: 0;
  font-weight: 600;
}
.page-head .sub {
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-base);
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-3);
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Dashboard views: the per-screen layout layer from the design mocks. */

.home,
.installations,
.members,
.settings,
.billing {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-4);
  max-width: 1040px;
}
.shell__main h1 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0;
}
.shell__main h2 {
  font-size: var(--fs-base);
  font-weight: 600;
  margin: 0;
}
.shell__main p {
  margin: 0;
}
.shell__main h1 + .field__hint {
  margin-top: calc(-1 * var(--space-3));
}

/* Row lists inside cards: edge-to-edge rows with hairline separators. */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.card > .list {
  margin: calc(-1 * var(--space-5));
}
.list__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-4) var(--space-5);
}
.list__row + .list__row {
  border-top: 1px solid var(--border-subtle);
}
.list__row > span:first-child {
  font-weight: 600;
}
.list__row form {
  margin: 0;
  margin-left: auto;
  display: inline-flex;
}
.list__row form ~ form {
  margin-left: 0;
}
.list__row .btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--fs-xs);
}
.list__row > a[href$="/destroy"] {
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
}
.list__row > a[href$="/destroy"]:hover {
  color: var(--tone-bad);
}
.list__row details {
  order: 10;
  flex: 1 0 100%;
}
.list__row details summary {
  cursor: pointer;
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
}
.list__row details summary:hover {
  color: var(--fg);
}
.list__row details[open] summary {
  margin-bottom: var(--space-3);
}

/* Key/value panels (settings, billing stubs). */
.facts {
  display: grid;
  grid-template-columns: 160px 1fr;
  column-gap: var(--space-5);
  row-gap: var(--space-4);
  align-items: baseline;
  margin: 0;
}
.facts dt {
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.facts dd {
  margin: 0;
}
.facts form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 480px;
}
.facts form .field {
  align-self: stretch;
}

/* The invite role picker: radios presented as a segmented toggle. */
.role-toggle {
  border: 0;
  margin: 0;
  padding: 0;
}
.role-toggle legend {
  padding: 0;
  margin-bottom: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-toggle label {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  margin-right: var(--space-2);
  color: var(--fg-subtle);
  cursor: pointer;
  user-select: none;
}
.role-toggle label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--fg);
}
.role-toggle label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.role-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lock {
  font-size: var(--fs-lg);
}

/* A fact row that hosts a form already names the fact in its dt; keep the
   field's own label for assistive tech only. */
.facts .field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.home > .chip,
.installations > .chip,
.members > .chip,
.settings > .chip,
.billing > .chip {
  align-self: flex-start;
}
