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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-fg);
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--rail);
}

header.top .brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

header.top > .brand + a {
  margin-left: auto;
}

header.top > a:not(.brand) {
  color: var(--muted);
  text-decoration: none;
}

header.top > a:not(.brand):hover {
  color: var(--text);
}

header.top form {
  margin: 0;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

h1 {
  font-size: 22px;
  margin: 0 0 16px;
}

h2 {
  font-size: 16px;
  margin: 28px 0 10px;
  color: var(--muted);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

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

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}

.list .meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line-2);
  color: var(--muted);
  background: var(--neutral-soft);
}

.badge.ok {
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-soft);
}

.badge.warn {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-soft);
}

.badge.err {
  color: var(--err-fg);
  border-color: var(--err-line);
  background: var(--err-soft);
}

.button,
button {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button.quiet {
  background: transparent;
  color: var(--text);
  border-color: var(--line-2);
}

form.command {
  display: grid;
  gap: 10px;
  align-content: start;
}

form.command button {
  justify-self: start;
}

label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

code,
pre {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  background: var(--code-bg);
  border-radius: 6px;
}

code {
  padding: 1px 6px;
}

pre {
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.notice.ok {
  border-color: var(--ok-line);
}

.notice.err {
  border-color: var(--err-line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.pre-wrap {
  white-space: pre-wrap;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 15px;
}

.search input[type="search"]:focus-visible,
.button:focus-visible,
button:focus-visible,
.hub-name:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.chip {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.chip:hover,
.chip-active {
  background: var(--accent);
  color: var(--on-accent);
}

.active-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}

.hub-grid,
.space-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.hub-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.15s, transform 0.15s;
}

.hub-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.hub-strip,
.hub-hero-banner {
  height: 72px;
  background: var(--gradient);
}

.hub-strip img,
.hub-hero-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px 12px;
}

.hub-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hub-card-head .hub-icon {
  position: relative;
  margin-top: -22px;
}

.hub-name {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.hub-card-head .hub-name {
  padding-top: 8px;
}

.hub-name:hover {
  color: var(--accent-fg);
}

.hub-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.hub-card-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.hub-icon {
  flex: none;
  border-radius: 12px;
  border: 3px solid var(--surface);
  vertical-align: middle;
  object-fit: cover;
  background: var(--surface-3);
}

.hub-icon-empty {
  display: inline-block;
  width: 48px;
  height: 48px;
  background: var(--gradient);
}

.hub-hero {
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.hub-hero-banner {
  height: 160px;
}

.hub-hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  padding: 0 20px;
}

.hub-hero-head .hub-icon {
  position: relative;
  margin-top: -36px;
}

.hub-hero-head .button {
  margin-top: 14px;
}

.hub-hero-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-top: 12px;
}

.hub-hero-title h1 {
  margin: 0;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.hub-icon-large {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  border-width: 5px;
}

.hub-hero-desc {
  margin: 0;
  padding: 16px 20px 20px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.space-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.space-card .hub-icon {
  width: 44px;
  height: 44px;
}

.space-card-text {
  min-width: 0;
  overflow-wrap: anywhere;
}


/* connected apps: consent, connect, new team identity, the Connected apps console */

.app-flow {
  max-width: 640px;
  margin: 0 auto;
}

.app-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.app-head-text {
  min-width: 0;
}

.app-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

.app-by,
.grant-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  margin: var(--sp-1) 0 0;
  color: var(--muted);
  font-size: var(--fs-md);
}

.app-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--r-lg);
  background: var(--gradient);
  color: var(--on-accent);
  font-size: var(--fs-title);
  font-weight: 700;
}

.app-mark.small {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: var(--fs-lg);
}

.app-flow .card {
  padding: var(--sp-5);
}

.card > h2:first-child,
.card > .lead + h2 {
  margin-top: 0;
}

.card h2,
.spend-fields legend,
.spending h3 {
  margin: 0 0 var(--sp-2);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
}

.lead {
  margin: 0 0 var(--sp-4);
}

.scopes {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.scopes li {
  position: relative;
  padding-left: 28px;
  overflow-wrap: anywhere;
}

.scopes li::before {
  content: "";
  position: absolute;
  top: 0.45em;
  left: 4px;
  width: 10px;
  height: 6px;
  border-bottom: 2px solid var(--accent-fg);
  border-left: 2px solid var(--accent-fg);
  transform: rotate(-45deg);
}

.grant .scopes {
  gap: var(--sp-1);
  font-size: var(--fs-md);
  color: var(--muted);
}

form.command {
  gap: var(--sp-3);
}

form.command h2 {
  margin: 0;
}

form.command p {
  margin: 0;
}

.choices {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

label.choice {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 60px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-body);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

label.choice:hover {
  border-color: var(--accent-line);
}

label.choice:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--st-sel);
}

label.choice:has(input:disabled) {
  cursor: default;
}

label.choice:has(input:disabled:not(:checked)) {
  background: transparent;
}

label.choice:has(input:disabled:not(:checked)) .who {
  opacity: 0.6;
}

label.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label.choice input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: inherit;
}

.who {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.who-name {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.who-meta {
  color: var(--muted);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}

.choice-end {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-1);
}

.choice-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.spend-fields {
  display: grid;
  gap: var(--sp-3);
  margin: 0;
  padding: var(--sp-2) var(--sp-4) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
}

.spend-fields legend {
  padding: 0 var(--sp-1);
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-3);
}

.field-row input,
.field-row select,
form.command input:not([type="checkbox"]):not([type="hidden"]),
form.command select {
  width: 100%;
  min-height: var(--tap);
}

input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.handle-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface-2);
}

.handle-input:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.handle-input > span {
  padding-left: 12px;
  color: var(--muted);
  font-size: var(--fs-body);
}

form.command .handle-input input {
  border: 0;
  background: transparent;
  padding-left: 4px;
  outline: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

.actions button,
.grant button,
.spend-forms button {
  min-height: var(--tap);
  padding: 10px 20px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.identity-block {
  margin-bottom: var(--sp-6);
}

h2.identity-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-3);
  color: var(--text);
  font-size: var(--fs-body);
}

.identity-head .who {
  flex: 0 1 auto;
}

.identity-head .who-meta {
  font-weight: 400;
}

.grants {
  display: grid;
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.grant {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.grant-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.grant-title {
  flex: 1 1 220px;
  min-width: 0;
}

.grant-name {
  margin: 0;
}

.grant-title .meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.grant-name strong {
  color: var(--text);
  font-size: var(--fs-body);
}

.grant-head form {
  margin: 0 0 0 auto;
}

.spending {
  display: grid;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

.spending h3 {
  margin: 0;
}

.spend-summary {
  margin: 0;
}

.spend-forms {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-2) var(--sp-3);
}

.spend-forms form {
  margin: 0;
}

form.spend-limit {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-2) var(--sp-3);
}

form.spend-limit .field-row {
  width: 320px;
  max-width: 100%;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.table-wrap table {
  font-size: var(--fs-md);
}

.table-wrap th,
.table-wrap td {
  padding: var(--sp-2) var(--sp-3);
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.table-wrap th {
  background: var(--head-bg);
}

th.num,
td.num {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .hub-grid,
  .space-grid {
    grid-template-columns: 1fr;
  }

  .hub-hero-head .button {
    width: 100%;
    text-align: center;
  }

  .hub-hero-head .hub-icon {
    margin-top: -30px;
  }

  .app-flow .card,
  .grant {
    padding: var(--sp-4);
  }

  .app-mark {
    width: 44px;
    height: 44px;
  }

  .actions button {
    flex: 1;
  }

  form.spend-limit,
  form.spend-limit .field-row {
    width: 100%;
  }

  .spend-forms,
  .spend-forms form,
  .spend-forms button {
    width: 100%;
  }

  header.top > .muted {
    display: none;
  }

  .table-wrap table.charges,
  .charges tbody {
    display: block;
  }

  .charges thead {
    display: none;
  }

  .charges tr {
    display: grid;
    grid-template-areas: "what amount" "when state";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--sp-1) var(--sp-3);
    padding: var(--sp-3);
    border-bottom: 1px solid var(--line);
  }

  .charges tr:last-child {
    border-bottom: 0;
  }

  .table-wrap .charges td {
    padding: 0;
    border: 0;
  }

  .charges td:nth-child(1) {
    grid-area: when;
    color: var(--muted);
    font-size: var(--fs-sm);
  }

  .charges td:nth-child(2) {
    grid-area: what;
  }

  .charges td:nth-child(3) {
    grid-area: amount;
  }

  .charges td:nth-child(4) {
    grid-area: state;
    text-align: right;
  }
}
