/*
 * Smartly Done Account shell. Same palette and fonts as the Keycloak `smartlydone` theme.
 * No inline styles anywhere: the CSP allows this file only.
 */

@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans-latin-var.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Serif Display";
  src: url("/assets/fonts/dm-serif-display-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --sd-prussian: #001f3d;
  --sd-navy: #002e5d;
  --sd-egyptian: #00378f;
  --sd-egyptian-dark: #002a70;
  --sd-champagne: #d9bc82; /* dark surfaces only, never a fill, never on light */
  --sd-baby-blue-ice: #8fbce6; /* 1px strokes only, never a fill */
  --sd-brand-burgundy: #7b0a27; /* secondary buttons and text links on light only */
  /* Neutrals */
  --sd-ice: #f5f8fa;
  --sd-cloud: #ebf0f4;
  --sd-mist: #dfe6ed;
  --sd-fog: #ced8e2;
  --sd-steel: #b4c1ce;
  --sd-paper: var(--sd-ice);
  --sd-muted: #475a70;
  /* Errors and the confirm button only. Never aliased to the burgundy token. */
  --sd-danger: #c0262d;
  --sd-danger-dark: #a31f25;
  --sd-danger-bg: #fdf1f1;
  --sd-danger-line: #f3c9cb;
  --sd-radius: 14px;
  --sd-shadow: 0 1px 2px rgba(0, 31, 61, 0.05), 0 6px 18px rgba(0, 31, 61, 0.06);
  --sd-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --sd-serif: "DM Serif Display", Georgia, serif;
  --sd-ring: 0 0 0 2px #fff, 0 0 0 4px var(--sd-egyptian);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sd-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--sd-prussian);
  background: var(--sd-ice);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--sd-brand-burgundy);
}

button {
  font: inherit;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

.sd-icon {
  display: block;
  flex: none;
}

.sd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: #fff;
  border-bottom: 1px solid var(--sd-mist);
}

.sd-lockup {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  color: var(--sd-navy);
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.sd-lockup-word strong {
  font-weight: 800;
}

.sd-lockup-word span {
  font-weight: 300;
}

.sd-lockup-product {
  font-weight: 500;
  padding-left: 0.4em;
  border-left: 2px solid var(--sd-fog);
}

.sd-lockup {
  flex-shrink: 0;
  white-space: nowrap;
}

.sd-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--sd-muted);
  white-space: nowrap;
}

.sd-nav form {
  flex-shrink: 0;
  margin: 0;
}

.sd-main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 64px) clamp(16px, 4vw, 48px);
}

.sd-title {
  margin: 0 0 8px;
  font-family: var(--sd-serif);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--sd-prussian);
}

.sd-lead {
  margin: 0 0 24px;
  max-width: 52ch;
  color: var(--sd-muted);
}

.sd-card {
  padding: 24px 28px;
  background: #fff;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow);
}

.sd-card h2,
.sd-card h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--sd-navy);
}

.sd-section-title {
  margin: 32px 0 16px;
  font-size: 1.25rem;
  color: var(--sd-navy);
}

.sd-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
}

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

.sd-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.sd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1px solid var(--sd-egyptian);
  border-radius: 999px;
  background: var(--sd-egyptian);
  color: #fff;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.sd-btn:hover {
  background: var(--sd-egyptian-dark);
  box-shadow: var(--sd-shadow);
  transform: translateY(-1px);
}

.sd-btn:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

/* Secondary on light: Burgundy text and a 1px Burgundy outline. Never a Burgundy fill. */
.sd-btn-secondary,
.sd-btn-quiet {
  padding: 9px 20px;
  background: #fff;
  border-color: var(--sd-brand-burgundy);
  color: var(--sd-brand-burgundy);
}

.sd-btn-secondary:hover,
.sd-btn-quiet:hover {
  background: var(--sd-ice);
}

/* Delete, remove, revoke, unlink: neutral. Prussian text, Steel outline, no red. */
.sd-btn-neutral {
  padding: 9px 20px;
  background: #fff;
  border-color: var(--sd-steel);
  color: var(--sd-prussian);
}

.sd-btn-neutral:hover {
  background: var(--sd-cloud);
}

.sd-alert {
  padding: 12px 16px;
  margin: 0 0 24px;
  border: 1px solid var(--sd-danger-line);
  border-radius: 12px;
  background: var(--sd-danger-bg);
  color: var(--sd-danger);
}

.sd-alert > .sd-icon {
  display: inline-block;
  margin-right: 8px;
  vertical-align: -3px;
}

.sd-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  font-size: 0.85rem;
  color: var(--sd-muted);
}

.sd-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.sd-footer a {
  color: var(--sd-muted);
}

.sd-footer a:hover {
  color: var(--sd-brand-burgundy);
}

.sd-footer p {
  margin: 0;
}

/* Hidden until it gets keyboard focus, then shown over the header. */
.sd-skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--sd-egyptian);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.sd-skip:focus {
  outline: none;
  box-shadow: var(--sd-ring);
  transform: none;
}

.sd-main:focus {
  outline: none;
}

.sd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.sd-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 24px;
}

.sd-tabs a {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--sd-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.sd-tabs a:hover {
  background: #fff;
}

.sd-tabs a[aria-current="page"] {
  background: #fff;
  border-color: var(--sd-baby-blue-ice);
  color: var(--sd-prussian);
  font-weight: 700;
}

.sd-stack {
  display: grid;
  gap: 24px;
}

.sd-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 -8px;
}

.sd-section-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--sd-navy);
}

.sd-muted {
  margin: 0;
  color: var(--sd-muted);
}

/* App cards. Same look as the Keycloak theme cards, with the product lockup on top. */
.sd-app-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .sd-app-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sd-app-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow);
}

/*
 * Sized by height, so every product word is the same size. A width cap shrank the longer lockups
 * (Account, Widgets). Both sizes stay auto, so a narrow phone card scales it down without squashing.
 */
.sd-app-card__lockup {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 34px;
}

.sd-app-card__desc {
  margin: 0;
  flex: 1;
  color: #4a5b70;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.sd-app-card__summary {
  width: 100%;
  font-size: 0.875rem;
}

.sd-app-card__count {
  margin: 0 0 6px;
  color: #002e5d;
  font-weight: 600;
}

.sd-app-card__sites {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.sd-app-card__site {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--sd-cloud);
}

.sd-app-card__site-name {
  color: #002e5d;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sd-app-card__site-date {
  color: #4a5b70;
  font-size: 0.8125rem;
}

.sd-app-card__site-links {
  display: flex;
  gap: 14px;
}

.sd-app-card__site-links a,
.sd-app-card__more {
  color: var(--sd-brand-burgundy);
  font-weight: 600;
}

.sd-app-card__elsewhere {
  margin: 12px 0 8px;
  color: var(--sd-muted);
  font-size: 0.875rem;
}

.sd-app-card__site-off.is-disabled {
  color: #7a8898;
  cursor: not-allowed;
}

.sd-app-card__action {
  margin-top: 8px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.sd-app-card__link {
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  border: 1px solid var(--sd-brand-burgundy);
  border-radius: 999px;
  background: #fff;
  color: var(--sd-brand-burgundy);
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    box-shadow 150ms ease;
}

.sd-app-card__link--primary {
  border-color: var(--sd-egyptian);
  background: var(--sd-egyptian);
  color: #fff;
}

.sd-app-card__link:hover {
  box-shadow: var(--sd-shadow);
}

.sd-app-card__link--primary:hover {
  background: var(--sd-egyptian-dark);
}

.sd-app-card__badge {
  display: inline-block;
  padding: 4px 12px;
  background: #ebf0f4;
  border-radius: 999px;
  color: #4a5b70;
  font-size: 0.8125rem;
  font-weight: 600;
}

.sd-notice {
  padding: 12px 16px;
  margin: 0 0 24px;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: 12px;
  background: #fff;
  color: var(--sd-prussian);
  box-shadow: var(--sd-shadow);
}

.sd-field {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  max-width: 28rem;
}

.sd-field label {
  font-weight: 600;
  color: var(--sd-navy);
}

.sd-field input,
.sd-field select,
.sd-field textarea,
.sd-select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--sd-fog);
  border-radius: 8px;
  color: var(--sd-prussian);
  background: #fff;
}

.sd-field input:focus,
.sd-field select:focus,
.sd-field textarea:focus,
.sd-select:focus {
  outline: none;
  border-color: var(--sd-egyptian);
  box-shadow: var(--sd-ring);
}

.sd-field-error {
  margin: 0;
  color: var(--sd-danger);
}

.sd-field-error > .sd-icon {
  display: inline-block;
  margin-right: 6px;
  vertical-align: -3px;
}

.sd-table-wrap {
  position: relative;
  overflow-x: auto;
}

.sd-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow);
}

.sd-table th,
.sd-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--sd-mist);
}

.sd-table td {
  overflow-wrap: anywhere;
}

.sd-table-stack td[data-label="Member"] {
  overflow-wrap: normal;
}

.sd-table th {
  background: var(--sd-cloud);
  color: var(--sd-muted);
  font-weight: 600;
}

/* A short note under a column name, such as "Not live yet". */
.sd-th-note {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
}

.sd-roles {
  margin: 0 0 16px;
}

.sd-nowrap {
  white-space: nowrap;
}

/* Team table on desktop: top aligned, even compact cells, a Member column that does not squeeze. */
@media (min-width: 640px) {
  .sd-table-stack {
    min-width: 100%;
  }

  .sd-table-stack th,
  .sd-table-stack td {
    padding: 14px 9px;
    vertical-align: top;
  }

  .sd-table-stack td[data-label="Actions"] .sd-btn {
    gap: 6px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .sd-table-stack td[data-label="Actions"] .sd-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }

  .sd-table-stack td[data-label="Member"],
  .sd-table-stack th:first-child {
    min-width: 200px;
  }

  .sd-table-stack td[data-label="Actions"],
  .sd-table-stack th:last-child {
    width: 1%;
    white-space: nowrap;
  }

  .sd-table-stack .sd-select {
    width: auto;
    min-width: 100px;
    padding-left: 8px;
    padding-right: 24px;
    background-position:
      calc(100% - 14px) 55%,
      calc(100% - 9px) 55%;
  }
}

/* One muted status line under an app's cell on /team. */
.sd-app-line {
  margin-top: 4px;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--sd-muted);
}

.sd-app-line > span {
  white-space: nowrap;
}

.sd-app-line__link {
  display: block;
  font-size: inherit;
  white-space: nowrap;
  color: #002e5d;
  text-decoration: none;
}

.sd-app-line__link:hover {
  text-decoration: underline;
}

.sd-app-line__sep {
  white-space: pre;
}

.sd-app-line__warn {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #fff4e0;
  color: #7a4a00;
}

/* The site access picker under the Sites status line: a quiet Change disclosure. */
.sd-site-picker > summary {
  display: inline-block;
  color: #002e5d;
  cursor: pointer;
  white-space: nowrap;
}

.sd-site-picker > summary:hover {
  text-decoration: underline;
}

.sd-site-picker fieldset {
  min-width: 0;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
}

.sd-site-picker label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--sd-prussian);
}

.sd-site-picker .sd-site-picker__sites {
  margin: 2px 0 0 18px;
}

.sd-site-picker .sd-muted {
  margin: 2px 0 0;
}

.sd-site-picker .sd-btn {
  margin-top: 6px;
  padding: 4px 12px;
}

/* The one value in an app cell: a level, in words. */
.sd-app-level {
  display: inline-block;
}

/* One look for every select. The chevron is two gradients: the CSP allows no data: images. */
.sd-field select,
.sd-select {
  appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--sd-navy) 50%),
    linear-gradient(135deg, var(--sd-navy) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 55%,
    calc(100% - 13px) 55%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.sd-select {
  padding-top: 6px;
  padding-bottom: 6px;
}

/* "What it can reach" on Connect and key forms: app names in one column, selects in another, all the same width. */
.sd-scopes {
  max-width: 28rem;
}

.sd-scope-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 16rem);
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 12px;
}

.sd-scope-grid > label {
  margin: 0;
}

.sd-scope-grid > .sd-select {
  width: 100%;
}

/* The "Set all to" row: ice blue stroke, then a rule under it before the apps. */
.sd-scope-all + .sd-select {
  border-color: var(--sd-baby-blue-ice);
  margin-bottom: 6px;
}

@media (max-width: 480px) {
  .sd-scope-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .sd-scope-grid > .sd-select {
    margin-bottom: 8px;
  }
}

/* Role pills. Owner is solid Egyptian, Admin is an Egyptian outline, Member is quiet. */
.sd-pill {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--sd-fog);
  border-radius: 999px;
  background: var(--sd-ice);
  color: var(--sd-prussian);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

/* Members table (/team and the staff org page): whole words, no mid-word breaks. Scrolls in its card. */
.sd-members th,
.sd-members td {
  word-break: normal;
  overflow-wrap: normal;
}

.sd-members .sd-pill,
.sd-members .sd-select,
.sd-members .sd-app-level,
.sd-members .sd-app-line,
.sd-members .sd-app-line > span {
  white-space: nowrap;
}

.sd-members td,
.sd-members th {
  vertical-align: top;
}

@media (min-width: 640px) {
  .sd-members th,
  .sd-members td {
    padding-left: 4px;
    padding-right: 4px;
  }

  .sd-members th:nth-child(1),
  .sd-members td[data-label="Member"] {
    min-width: 150px;
  }

  .sd-members th:nth-child(2),
  .sd-members td[data-label="Role"] {
    min-width: 0;
  }

  .sd-members th:nth-child(n + 3) {
    min-width: 0;
  }

  .sd-members .sd-select {
    width: auto;
    min-width: 0;
    padding-left: 5px;
    padding-right: 17px;
    background-position:
      calc(100% - 10px) 55%,
      calc(100% - 5px) 55%;
  }

  .sd-members th.sd-actions-col,
  .sd-members td[data-label="Actions"] {
    width: 1%;
    min-width: 0;
    padding-left: 2px;
    padding-right: 4px;
  }
}

/* The muted lines under a value may wrap at spaces. The main value stays on one line. */
.sd-members .sd-app-line,
.sd-members .sd-app-line > span {
  white-space: normal;
}

.sd-members .sd-app-line__link {
  white-space: nowrap;
}

/* Level words stay whole. A level with a note, such as "Admin (staff)", may wrap at its space. */
.sd-members .sd-app-level {
  white-space: normal;
}

.sd-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.sd-btn[hidden] {
  display: none;
}

/* Account control in the header. The menu floats, so it never changes the width of the nav row. */
.sd-account {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
}

.sd-account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  color: var(--sd-navy);
  font-weight: 500;
  border: 1px solid var(--sd-baby-blue-ice);
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.sd-account-btn::-webkit-details-marker {
  display: none;
}

.sd-account-btn:hover,
.sd-account[open] .sd-account-btn {
  background: var(--sd-mist);
}

.sd-account-btn:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

.sd-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sd-navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.sd-account-name {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 8px;
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  background: #fff;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0, 31, 61, 0.2);
  white-space: normal;
}

.sd-account-menu p {
  margin: 0;
}

.sd-account-email {
  overflow-wrap: anywhere;
  color: var(--sd-muted);
}

.sd-account-label {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sd-muted);
}

.sd-account-orgs {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sd-account-org {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sd-navy);
  font-weight: 500;
  text-align: left;
  overflow-wrap: anywhere;
}

button.sd-account-org {
  cursor: pointer;
}

button.sd-account-org:hover {
  background: var(--sd-mist);
}

button.sd-account-org:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

.sd-account-org[aria-current="true"] {
  background: var(--sd-mist);
}

.sd-account-org .sd-muted {
  flex-shrink: 0;
  font-size: 0.8rem;
}

.sd-account-links {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--sd-mist);
  list-style: none;
}

.sd-account-links a {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--sd-navy);
  font-weight: 500;
  text-decoration: none;
}

.sd-account-links a:hover {
  background: var(--sd-mist);
}

.sd-account-links a:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

.sd-account-menu form:last-child {
  padding-top: 8px;
  border-top: 1px solid var(--sd-mist);
}

.sd-locked {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.6;
}

/* The one filled red. Only on a confirm page, where it is the final step. */
.sd-btn-danger {
  border-color: var(--sd-danger);
  background: var(--sd-danger);
  color: #fff;
}

.sd-btn-danger:hover {
  border-color: var(--sd-danger-dark);
  background: var(--sd-danger-dark);
}

.sd-confirm-form {
  margin-top: 24px;
}

.sd-search {
  display: flex;
  gap: 12px;
  align-items: end;
  margin: 0 0 24px;
}

.sd-search .sd-field {
  flex: 1;
  max-width: 24rem;
  margin: 0;
}

@media (max-width: 560px) {
  .sd-account-name {
    display: none;
  }

  .sd-account-btn {
    padding: 4px;
  }
}

/* Signed-in app sections: Your apps, Get started, Coming soon. */
.sd-app-section {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.sd-app-section__title {
  margin: 0;
  font-size: 1.25rem;
  color: #002e5d;
}

.sd-app-section__hint {
  margin: -8px 0 0;
  color: #4a5b70;
  font-size: 0.9375rem;
}

.sd-app-section--open .sd-app-card {
  border-color: var(--sd-baby-blue-ice);
}

.sd-app-section--open .sd-app-card__link--primary {
  padding: 11px 28px;
  font-size: 1rem;
}

.sd-app-section--soon .sd-app-card {
  background: var(--sd-ice);
}

/*
 * Phones: the team tables become one card per row. Each cell shows its column name above the
 * value, from data-label. Empty cells are hidden. The Remove and Revoke buttons span the card.
 */
@media (max-width: 639px) {
  .sd-table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sd-table-stack,
  .sd-table-stack tbody,
  .sd-table-stack tr,
  .sd-table-stack td {
    display: block;
  }

  .sd-table-stack {
    border: 0;
    background: transparent;
  }

  .sd-table-stack tr {
    margin: 0 0 12px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid var(--sd-mist);
    border-radius: 10px;
  }

  .sd-table-stack td {
    padding: 6px 0;
    border-bottom: 0;
  }

  .sd-table-stack td::before {
    content: attr(data-label);
    display: block;
    color: var(--sd-muted);
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .sd-table-stack td:empty {
    display: none;
  }

  .sd-table-stack .sd-select {
    width: 100%;
  }

  .sd-table-stack td[data-label="Actions"]::before {
    content: none;
  }

  .sd-table-stack td[data-label="Actions"] .sd-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
  }

  .sd-table-stack td[data-label="Actions"] .sd-btn-icon {
    width: 40px;
    min-height: 40px;
    padding: 0;
  }
}

/* Visually hidden, still read by screen readers. */
.sd-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
 * Signed-in shell. A left sidebar, a top bar, the page, then a dark footer, all in one column.
 * Same shape as Smartly Done Social.
 */
.sd-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1;
  min-height: 100vh;
}

.sd-side {
  padding: 18px 14px;
  border-right: 1px solid var(--sd-mist);
  background: linear-gradient(180deg, #fff, var(--sd-cloud));
}

.sd-side .sd-lockup {
  display: flex;
  align-items: baseline;
  padding: 4px 4px 18px;
  font-size: 1.125rem;
  max-width: 100%;
}

.sd-side-nav {
  display: grid;
  gap: 4px;
}

.sd-side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  color: var(--sd-prussian);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    transform 150ms ease;
}

.sd-tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: 10px;
  background: #fff;
  color: var(--sd-egyptian);
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.sd-side-nav a:hover {
  background: #fff;
}

.sd-side-nav a:focus-visible {
  outline: none;
  box-shadow: var(--sd-ring);
}

.sd-side-nav a[aria-current="page"] {
  background: #fff;
  box-shadow: var(--sd-shadow);
  font-weight: 700;
}

.sd-side-nav a[aria-current="page"] .sd-tile {
  border-color: var(--sd-egyptian);
  background: var(--sd-egyptian);
  color: #fff;
}

.sd-nav-sep {
  height: 1px;
  margin: 8px 6px;
  background: var(--sd-mist);
}

/* Staff-only admin block at the end of the sidebar, clearly apart from Team. */
.sd-nav-admin {
  display: grid;
  gap: 4px;
}

.sd-nav-heading {
  margin: 8px 6px 2px;
  color: var(--sd-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sd-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sd-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid var(--sd-mist);
}

.sd-spacer {
  flex: 1;
}

.sd-org-switch {
  display: flex;
  align-items: center;
  margin: 0;
}

.sd-org-switch .sd-select {
  max-width: 260px;
  padding: 8px 36px 8px 14px;
  border-color: var(--sd-baby-blue-ice);
  border-radius: 12px;
}

.sd-top-org {
  margin: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.sd-shell .sd-main {
  flex: 1;
  max-width: 1100px;
  margin: 0;
  padding: 24px;
  animation: sd-rise 350ms ease both;
}

/* The framed page header. */
.sd-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
  padding: 18px 22px;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: 16px;
  background: linear-gradient(120deg, #fff 0%, var(--sd-ice) 55%, var(--sd-cloud) 100%);
  box-shadow: var(--sd-shadow);
}

.sd-page-head .sd-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 1.875rem;
}

.sd-title-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sd-egyptian);
  color: #fff;
}

.sd-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sd-page-head + .sd-lead {
  margin-top: -4px;
}

/* Dark footer: the navy of the page, lower down. Product name strong, links muted. */
.sd-shell .sd-footer {
  padding: 22px 24px;
  background: var(--sd-prussian);
  color: var(--sd-mist);
  font-size: 0.875rem;
}

.sd-shell .sd-footer strong {
  color: #fff;
}

.sd-shell .sd-footer a {
  color: var(--sd-mist);
  text-underline-offset: 3px;
}

.sd-shell .sd-footer a:hover {
  color: #fff;
}

.sd-shell .sd-footer a:focus-visible {
  outline: 2px solid var(--sd-baby-blue-ice);
  outline-offset: 2px;
}

/* Empty states: line art, an Egyptian badge, one sentence, one action. */
.sd-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 20px 26px;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: var(--sd-radius);
  background: linear-gradient(180deg, #fff, var(--sd-ice));
  box-shadow: var(--sd-shadow);
  text-align: center;
}

.sd-empty p {
  margin: 0;
  max-width: 34em;
  color: var(--sd-muted);
}

.sd-empty-art {
  position: relative;
  width: 168px;
  height: 104px;
}

.sd-empty-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sd-empty-art .sd-float {
  transform-box: fill-box;
  transform-origin: center;
  animation: sd-bob 5s ease-in-out infinite;
}

.sd-empty-icon {
  position: absolute;
  right: 18px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--sd-egyptian);
  color: #fff;
  box-shadow: var(--sd-shadow);
}

.sd-card .sd-empty {
  margin-top: 4px;
  box-shadow: none;
}

/* Confirm dialog. No Burgundy inside: a neutral Cancel and the one filled red button. */
.sd-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: 18px;
  background: #fff;
  color: var(--sd-prussian);
  box-shadow: 0 18px 48px rgba(0, 31, 61, 0.25);
}

.sd-dialog::backdrop {
  background: rgba(0, 31, 61, 0.45);
}

.sd-dialog-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--sd-steel);
  border-radius: 12px;
  background: var(--sd-cloud);
  color: var(--sd-prussian);
}

.sd-dialog h2 {
  margin: 12px 0 6px;
  font-size: 1.125rem;
}

.sd-dialog p {
  margin: 0;
  color: var(--sd-muted);
}

.sd-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@keyframes sd-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sd-bob {
  50% {
    transform: translateY(-3px);
  }
}

/* Phones: the sidebar sits on top and its links scroll sideways as a row of tiles. */
@media (max-width: 800px) {
  .sd-shell {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .sd-side {
    min-width: 0;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--sd-mist);
  }

  .sd-side .sd-lockup {
    padding-bottom: 8px;
  }

  .sd-side-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding: 2px 2px 6px;
  }

  .sd-nav-sep {
    display: none;
  }

  /* Keep the Admin label visible on the sideways tile row. */
  .sd-nav-heading {
    display: flex;
    align-items: center;
    margin: 0 4px 0 10px;
  }

  .sd-nav-admin {
    display: contents;
  }

  .sd-top {
    padding: 10px 14px;
  }

  .sd-shell .sd-main {
    padding: 16px 14px;
  }

  .sd-page-head {
    padding: 14px;
  }

  .sd-page-head .sd-title {
    font-size: 1.625rem;
  }

  .sd-shell .sd-footer {
    padding: 20px 14px;
  }
}

.sd-facts .sd-pill {
  margin-left: 8px;
}

.sd-pill-owner {
  border-color: var(--sd-egyptian);
  background: var(--sd-egyptian);
  color: #fff;
}

.sd-pill-admin {
  border-color: var(--sd-egyptian);
  background: #fff;
  color: var(--sd-egyptian);
}

/* Overview: the organization, your role and the way into the team. */
.sd-org-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  background: linear-gradient(120deg, #fff 0%, var(--sd-ice) 100%);
}

.sd-org-main {
  display: flex;
  flex: 1 1 260px;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.sd-org-main > div {
  min-width: 0;
}

.sd-org-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--sd-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--sd-prussian);
}

.sd-org-kicker {
  margin: 0 0 2px;
  color: var(--sd-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.sd-org-note {
  flex: 1 1 220px;
  margin: 0;
}

/* Team list: avatar, name and email in one cell. */
.sd-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sd-person .sd-avatar {
  width: 36px;
  height: 36px;
  background: var(--sd-egyptian);
  font-size: 0.8125rem;
}

.sd-person-text {
  display: grid;
  min-width: 0;
}

.sd-person-text strong,
.sd-person-text .sd-muted {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.sd-person-text .sd-muted {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sd-person-text strong {
  font-weight: 600;
  white-space: normal;
}

.sd-person-text .sd-muted {
  font-size: 0.875rem;
}

/* Find a domain. A search box, then one card row per name. */
.sd-find {
  display: flex;
  gap: 12px;
  align-items: end;
  margin: 0 0 24px;
}

.sd-find .sd-field {
  flex: 1;
  max-width: none;
  margin: 0;
}

.sd-find .sd-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.0625rem;
}

.sd-domain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.sd-domain-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 24px;
  align-items: center;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--sd-baby-blue-ice);
  border-radius: var(--sd-radius);
  box-shadow: var(--sd-shadow);
}

.sd-domain-row--taken {
  border-color: var(--sd-fog);
  background: var(--sd-ice);
  box-shadow: none;
}

.sd-domain-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sd-navy);
  overflow-wrap: anywhere;
}

.sd-domain-row--taken .sd-domain-name {
  color: var(--sd-muted);
}

.sd-domain-price {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.sd-domain-amount {
  font-family: var(--sd-serif);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
  color: var(--sd-prussian);
}

.sd-domain-price .sd-muted,
.sd-domain-info .sd-muted {
  font-size: 0.875rem;
}

.sd-domain-info {
  display: grid;
  gap: 2px;
}

.sd-domain-cost {
  font-size: 0.8125rem;
  color: var(--sd-muted);
}

.sd-domain-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--sd-cloud);
}

.sd-domain-hint {
  font-size: 0.875rem;
  color: var(--sd-muted);
}

.sd-pill-ok {
  border-color: var(--sd-egyptian);
  background: #fff;
  color: var(--sd-egyptian);
}

.sd-domains-note {
  margin: 20px 0 0;
  color: var(--sd-muted);
  font-size: 0.9375rem;
}

@media (max-width: 560px) {
  .sd-find {
    flex-direction: column;
    align-items: stretch;
  }

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

  .sd-domain-price {
    grid-column: 1;
    grid-row: auto;
    justify-items: start;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sd-btn,
  .sd-tabs a,
  .sd-tile,
  .sd-side-nav a,
  .sd-app-card__link {
    transition: none;
  }

  .sd-shell .sd-main,
  .sd-empty-art .sd-float {
    animation: none;
  }
}

/* Connect your AI: setup commands and a new key wrap inside their card instead of widening it. */
.sd-code {
  display: block;
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--sd-paper);
  border: 1px solid var(--sd-mist);
  border-radius: 8px;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sd-code code {
  white-space: inherit;
  overflow-wrap: inherit;
}

.sd-ai-tiles > *,
.sd-ai-keys > * {
  min-width: 0;
}

.sd-ai-key {
  padding: 14px 0;
  border-top: 1px solid var(--sd-mist);
}

.sd-ai-key h3 {
  margin: 0 0 4px;
}

/* Read-only fields (a member's view of owner settings) look read-only, not editable. */
.sd-field input:disabled {
  background: var(--sd-paper);
  color: var(--sd-muted);
  cursor: not-allowed;
}

/* Staff tables: whole words, short values stay on one line, the wrap scrolls. */
.sd-table-fit th,
.sd-table-fit td {
  word-break: normal;
  overflow-wrap: normal;
}

.sd-table-fit .sd-pill,
.sd-table-fit code,
.sd-table-fit .sd-btn,
.sd-table-fit button,
.sd-table-fit td:has(> form),
.sd-table-fit td:has(> .sd-pill) {
  white-space: nowrap;
}

/* Member name links in the members table. Kept late: they are more specific than header and side nav links. */
.sd-members .sd-person-text a {
  color: inherit;
  text-decoration: none;
}

.sd-members .sd-person-text a:hover {
  text-decoration: underline;
}

/* Last row has no rule under it. Kept last: it is the most specific td rule. */
.sd-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Developers page tool tables (P1.12): whole words only. Tool names break after an underscore. */
.sd-tools td:first-child,
.sd-tools td:last-child {
  overflow-wrap: normal;
}

@media (min-width: 640px) {
  .sd-tools td:first-child,
  .sd-tools td:last-child {
    min-width: 11rem;
  }
}

.sd-tools ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* The AI approve page: data leaving the org first, then every place data goes, domain on its own. */
.sd-approve-warning h2 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  color: inherit;
}

.sd-approve-warning ul,
.sd-approve-list {
  margin: 0 0 8px;
  padding-left: 20px;
}

.sd-approve-warning p {
  margin: 0;
}

.sd-targets {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.sd-targets li {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 12px 14px;
  border: 1px solid var(--sd-fog);
  border-radius: 12px;
}

.sd-target-domain {
  font-size: 1.125rem;
  overflow-wrap: anywhere;
}

.sd-targets code,
.sd-secret {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.sd-secret {
  user-select: all;
}

.sd-pill-out {
  border-color: var(--sd-danger);
  background: #fff;
  color: var(--sd-danger);
}
