/* Shared components (docs/DESIGN.md component inventory — grows per task). */

/* Buttons: primary for the one main action, secondary for everything else. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

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

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn--secondary:hover {
  background: var(--hover);
}

/* Square transparent button for icon-only controls; labels come from aria-label. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-m);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

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

/* Text variant of the icon button (language toggle). */
.icon-btn--text {
  font-size: var(--text-s);
  font-weight: 600;
}

/* States: loading, empty and error share one centred layout. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-7) auto 0;
  max-width: 40ch;
  text-align: center;
}

.state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-l);
  background: var(--accent-soft);
  color: var(--accent-ink-soft);
}

.state__icon svg {
  width: 24px;
  height: 24px;
}

.state__title {
  font-size: var(--text-l);
  font-weight: 650;
}

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

.state__action {
  margin-top: var(--space-3);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Offline indicator: slim, calm, honest about what is shown. */
.offline-bar {
  background: var(--accent-soft);
  color: var(--accent-ink-soft);
  font-size: var(--text-s);
  text-align: center;
  padding: var(--space-2) var(--space-4);
}

.offline-bar:empty {
  display: none;
}

/* Assistant placeholder card. */
.card {
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.card p + p {
  margin-top: var(--space-3);
}

.card ul {
  margin: var(--space-3) 0 0;
  padding-left: var(--space-5);
  color: var(--ink-muted);
}

.card li + li {
  margin-top: var(--space-1);
}

/* Auth and admin forms. */
.view--auth {
  display: grid;
  justify-items: center;
}

.auth-card {
  width: min(28rem, 100%);
  display: grid;
  gap: var(--space-4);
}

.field {
  display: grid;
  gap: var(--space-1);
}

.field label {
  font-size: var(--text-s);
  font-weight: 600;
}

.input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.form-error {
  color: var(--danger);
  font-size: var(--text-s);
}

.hint {
  color: var(--ink-muted);
  font-size: var(--text-s);
}

.btn--link {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

.secret,
.recovery-codes code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.user-list,
.invite-form {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.user-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  align-items: center;
  gap: var(--space-3);
}

.user-row .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.badge {
  justify-self: start;
  padding: 0 var(--space-3);
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  color: var(--accent-ink-soft);
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge--suspended {
  color: var(--danger);
}

/* Theme chooser: a native select, so keyboard and screen-reader behaviour come for free. */
.theme-select {
  height: 36px;
  padding: 0 var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-s);
  cursor: pointer;
}

.theme-select:hover {
  background: var(--hover);
}
