/* sso-web layout helpers strictly using design/system/tokens.css Palette A variables.
   Zero literal colors or custom tokens: light mode only, built on design/system/components/bundle.css. */

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

.sso-shell {
  min-height: 100dvh;
  display: flex;
  background: var(--bg);
  color: var(--text);
}

.sso-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.sso-topbar {
  min-height: var(--touch);
  padding: 0 var(--space-24);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.sso-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.sso-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-28) var(--space-32) var(--space-48);
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
  box-sizing: border-box;
}

/* Plan B pure-white minimal centered frameless auth layout (/login, /oauth/consent, /error) */
.sso-zen-page {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.sso-zen-top {
  height: calc(var(--space-48) + var(--space-8));
  padding: 0 var(--space-24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: var(--space-12);
}

.sso-zen-brand {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  color: var(--text);
  text-decoration: none;
}

.sso-zen-brand b {
  font: var(--font-mobile-nav-title);
  font-weight: var(--page-title-weight);
  color: var(--text);
}

.sso-brand-mark {
  width: var(--app-mark);
  height: var(--app-mark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sso-brand-mark svg {
  width: var(--app-mark);
  height: var(--app-mark);
  display: block;
}

.sso-zen-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-24);
}

.sso-zen-col {
  width: var(--panel-max);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.sso-zen-col-wide {
  width: calc(var(--panel-max) + var(--space-48) + var(--space-48));
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.sso-zen-title {
  margin: 0;
  font: var(--font-mobile-title);
  font-weight: var(--page-title-weight);
  color: var(--text);
}

.sso-zen-sub {
  margin: 0;
  font: var(--font-section-title);
  font-weight: var(--ui-weight);
  line-height: var(--comment-line-height);
  color: var(--text-muted);
}

.sso-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.sso-field label {
  font: var(--font-label);
  color: var(--text-body);
}

.sso-field .ui-input {
  min-height: var(--mobile-row);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-12);
}

.sso-textarea {
  width: 100%;
  min-height: calc(var(--touch) * 2);
  padding: var(--space-10) var(--space-12);
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font: var(--font-code);
  resize: vertical;
}

.sso-select {
  width: 100%;
  min-height: var(--control-md);
  padding: 0 var(--space-10);
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font: var(--font-ui);
}

.sso-zen-cta {
  width: 100%;
  min-height: var(--mobile-row);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--text);
  color: var(--bg);
  font: var(--font-section-title);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.sso-zen-cta:disabled {
  background: var(--bg-soft);
  color: var(--text-faint);
  border: 1px solid var(--line-strong);
  cursor: default;
}

.sso-zen-foot {
  padding-top: var(--space-14);
  border-top: 1px solid var(--line);
  font: var(--font-small);
  color: var(--text-muted);
  line-height: var(--comment-line-height);
}

.sso-error-text {
  margin: 0;
  font: var(--font-small);
  color: var(--error);
}

.sso-stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.sso-stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.sso-stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.sso-inline {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.sso-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.sso-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: var(--space-20);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-14);
}

.sso-section-title {
  margin: 0;
  font: var(--font-block-title);
  color: var(--text);
}

.sso-section-desc {
  margin: 0;
  font: var(--font-ui);
  line-height: var(--comment-line-height);
  color: var(--text-muted);
}

.sso-card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}

.sso-item-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-14) var(--space-16);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.sso-item-title {
  margin: 0;
  font: var(--font-panel-title);
  color: var(--text);
}

.sso-item-meta {
  margin: 0;
  font: var(--font-small);
  color: var(--text-muted);
}

.sso-status-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: var(--space-24) var(--space-28);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  align-items: flex-start;
}

.sso-status-panel h2 {
  margin: 0;
  font: var(--font-block-title);
  color: var(--text);
}

.sso-status-panel p {
  margin: 0;
  font: var(--font-ui);
  color: var(--text-muted);
}

.sso-secret-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-14);
  border: 1px solid var(--highlight-line);
  border-radius: var(--radius-lg);
  background: var(--highlight);
}

.sso-code-block {
  margin: 0;
  padding: var(--space-14) var(--space-16);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-sidebar);
  color: var(--text);
  font: var(--font-code);
  line-height: var(--comment-line-height);
  overflow-x: auto;
  white-space: pre;
}

.sso-table {
  width: 100%;
  border-collapse: collapse;
  font: var(--font-ui);
}

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

.sso-table th {
  font: var(--font-label);
  color: var(--text-muted);
}

.sso-scope-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.sso-scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  min-height: var(--control-sm);
  padding: 0 var(--space-10);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font: var(--font-small);
}

.sso-scope-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.sso-btn-danger {
  border: 1px solid var(--danger);
  background: var(--bg);
  color: var(--error);
}

.sso-lang-segmented {
  display: inline-flex;
  gap: var(--space-4);
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
}

.sso-lang-segmented button {
  min-height: var(--control-xs);
  padding: 0 var(--space-10);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: var(--font-small);
}

.sso-lang-segmented button[aria-checked="true"] {
  background: var(--bg);
  color: var(--text);
  font-weight: var(--label-weight);
}

.sso-preview-stage {
  padding: var(--space-16);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  align-items: flex-start;
}

.sso-snippet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: var(--control-md);
  padding: 0 var(--space-12);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font: var(--font-ui);
  font-weight: var(--label-weight);
  text-decoration: none;
}

.sso-snippet-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
}

@media (max-width: 767px) {
  .sso-shell {
    flex-direction: column;
  }
  .sso-shell > .ui-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sso-page {
    padding: var(--space-16) var(--space-20) var(--space-28);
  }
  .sso-zen-main {
    align-items: flex-start;
    padding: var(--space-32) var(--space-20) var(--space-24);
  }
  .sso-zen-cta {
    min-height: var(--touch);
  }
}
