:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #0b0b0c;
  --bg-soft: #0e0e10;
  --surface: #111113;
  --surface-raised: #161619;
  --surface-hover: #1b1b1f;
  --border: #25252a;
  --border-strong: #34343a;
  --text: #f4f4f5;
  --text-soft: #b5b5bd;
  --text-muted: #85858e;
  --accent: #6f76e8;
  --accent-hover: #7b82ee;
  --accent-soft: rgba(111, 118, 232, 0.12);
  --accent-border: rgba(111, 118, 232, 0.35);
  --success: #6fcf97;
  --warning: #e6b65c;
  --danger: #ef7777;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  --radius: 10px;
  --radius-small: 7px;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --bg-soft: #f1f1f3;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #f0f0f2;
  --border: #e1e1e5;
  --border-strong: #cfcfd5;
  --text: #202024;
  --text-soft: #5b5b63;
  --text-muted: #74747d;
  --accent: #6870da;
  --accent-hover: #5f67d4;
  --accent-soft: rgba(104, 112, 218, 0.09);
  --accent-border: rgba(104, 112, 218, 0.28);
  --success: #2f9362;
  --warning: #a56a12;
  --danger: #c64343;
  --shadow: 0 24px 80px rgba(25, 25, 32, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  transition: background 180ms ease, color 180ms ease;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

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

.is-hidden {
  display: none !important;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.13em;
  margin: 0 0 9px;
  text-transform: uppercase;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 16px;
  font-weight: 650;
  gap: 10px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--text);
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 auto;
  height: 21px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transform: rotate(-42deg);
  width: 21px;
}

.brand-mark i {
  background: var(--bg);
  display: block;
  height: 30px;
  margin: 0 1px;
  width: 2px;
}

.brand-mark-large {
  height: 46px;
  width: 46px;
}

.brand-mark-large i {
  margin: 0 2px;
  width: 4px;
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  width: 34px;
}

.icon-button:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.button {
  align-items: center;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.button-wide {
  width: 100%;
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
}

/* Authentication */
.auth-screen {
  background: var(--bg);
  min-height: 100vh;
}

.auth-nav {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  height: 72px;
  justify-content: space-between;
  padding: 0 clamp(24px, 7vw, 120px);
}

.auth-stage {
  align-items: center;
  display: grid;
  gap: clamp(40px, 9vw, 150px);
  grid-template-columns: minmax(0, 1fr) 420px;
  margin: 0 auto;
  max-width: 1380px;
  min-height: calc(100vh - 72px);
  padding: 70px clamp(24px, 7vw, 120px);
}

.auth-copy {
  max-width: 780px;
}

.auth-copy h1 {
  font-size: clamp(46px, 5.4vw, 82px);
  font-weight: 480;
  letter-spacing: -0.055em;
  line-height: 0.99;
  margin: 0;
}

.auth-copy h1 span {
  color: var(--text-soft);
}

.auth-copy > p:not(.eyebrow) {
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.7;
  margin: 28px 0 0;
  max-width: 650px;
}

.auth-proof {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 32px;
  margin-top: 52px;
  padding-top: 20px;
}

.auth-proof span {
  color: var(--text-soft);
  font-size: 12px;
}

.auth-proof b {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-right: 8px;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-panel-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-bottom: 26px;
}

.auth-panel-heading h2 {
  font-size: 23px;
  letter-spacing: -0.035em;
  margin: 0;
}

.auth-panel-heading p {
  color: var(--text-soft);
  margin: 3px 0 0;
}

.auth-tabs {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
  padding: 4px;
}

.auth-tab {
  background: transparent;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  min-height: 36px;
}

.auth-tab.active {
  background: var(--surface-raised);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  color: var(--text);
}

.auth-form,
.modal-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 550;
}

.field input,
.field select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  min-height: 43px;
  outline: none;
  padding: 0 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  width: 100%;
}

.field input::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.password-note {
  color: var(--text-muted);
  font-size: 12px;
  margin: -6px 0 0;
}

.form-error {
  color: var(--danger);
  display: none;
  font-size: 12px;
  margin: 0;
}

.form-error.visible {
  display: block;
}

.security-note {
  align-items: flex-start;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  font-size: 12px;
  gap: 9px;
  margin: 22px 0 0;
  padding-top: 18px;
}

/* Application frame */
.app-shell {
  background: var(--bg);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 15px 11px 11px;
  position: relative;
  z-index: 20;
}

.sidebar-head {
  align-items: center;
  display: flex;
  height: 38px;
  justify-content: space-between;
  padding: 0 8px;
}

.sidebar-close {
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  font-size: 22px;
}

.workspace-button {
  align-items: center;
  background: transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  margin: 15px 0 18px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.workspace-button:hover {
  background: var(--surface-hover);
}

.workspace-avatar,
.user-avatar {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  color: var(--accent-hover);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  height: 27px;
  justify-content: center;
  width: 27px;
}

.user-avatar {
  border-radius: 50%;
}

.user-avatar.large {
  font-size: 15px;
  height: 42px;
  width: 42px;
}

.workspace-button > span:nth-child(2),
.profile-button > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.workspace-button strong,
.profile-button strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-button small,
.profile-button small {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-button > span:last-child {
  color: var(--text-muted);
  font-size: 11px;
}

.side-nav {
  min-height: 0;
}

.nav-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0 10px 8px;
}

.nav-label-spaced {
  margin-top: 22px;
}

.nav-item {
  align-items: center;
  background: transparent;
  border-radius: 6px;
  color: var(--text-soft);
  cursor: pointer;
  display: grid;
  font-size: 14px;
  gap: 8px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  margin: 1px 0;
  min-height: 40px;
  padding: 0 9px;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
  width: 100%;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface-raised);
  color: var(--text);
}

.nav-icon {
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
}

.nav-item.active .nav-icon {
  color: var(--text-soft);
}

.nav-count {
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-bottom {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding-top: 9px;
}

.profile-button {
  align-items: center;
  background: transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  margin-top: 6px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.profile-button:hover {
  background: var(--surface-hover);
}

.profile-button > span:last-child {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.main-column {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.topbar {
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-left,
.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.breadcrumb {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
}

.quiet-button {
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  padding: 8px;
}

.quiet-button:hover {
  color: var(--text);
}

.mobile-menu {
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: none;
  font-size: 18px;
}

.page {
  overflow: auto;
  padding: 48px clamp(28px, 4vw, 72px) 76px;
}

.page > * {
  margin-left: auto;
  margin-right: auto;
  max-width: 1380px;
}

.page-heading {
  align-items: flex-end;
  display: flex;
  gap: 28px;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-heading h1 {
  font-size: clamp(38px, 3vw, 48px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0;
}

.page-heading > div:first-child > p:last-child {
  color: var(--text-soft);
  font-size: 16px;
  margin: 9px 0 0;
}

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

.sync-status {
  align-items: center;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 12px;
  gap: 7px;
  white-space: nowrap;
}

.sync-status i,
.status-dot {
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  height: 6px;
  width: 6px;
}

#page-content {
  animation: page-enter 220ms ease both;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Overview and cards */
.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 55px;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  overflow: hidden;
  padding: clamp(30px, 5vw, 58px);
  position: relative;
}

.onboarding-card::after {
  background: var(--accent);
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  top: 0;
  width: 34%;
}

.onboarding-copy h2 {
  font-size: clamp(30px, 3.2vw, 45px);
  font-weight: 480;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0;
}

.onboarding-copy > p:not(.eyebrow) {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.65;
  margin: 18px 0 0;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 28px;
}

.setup-steps {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.setup-steps li {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 14px;
  grid-template-columns: 28px 1fr;
  padding: 18px 0;
}

.setup-steps li:first-child {
  padding-top: 3px;
}

.setup-steps li:last-child {
  border-bottom: 0;
}

.setup-steps li > span,
.guide-section-heading > span {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  color: var(--accent-hover);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.setup-steps strong {
  font-size: 13px;
}

.setup-steps p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 3px 0 0;
}

.trust-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.trust-row > div {
  align-items: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  display: flex;
  gap: 11px;
  padding: 16px;
}

.trust-row > div > span {
  color: var(--text-muted);
}

.trust-row p {
  display: grid;
  margin: 0;
}

.trust-row strong {
  font-size: 12px;
}

.trust-row small {
  color: var(--text-muted);
  font-size: 12px;
}

.metric-grid {
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.metric-card {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  display: grid;
  min-height: 146px;
  padding: 22px;
  text-align: left;
}

button.metric-card {
  cursor: pointer;
  transition: background 140ms ease;
}

button.metric-card:hover {
  background: var(--surface-raised);
}

.metric-card > span {
  color: var(--text-muted);
  font-size: 13px;
}

.metric-card > strong {
  align-self: end;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.metric-card > small {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-card,
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}

.card-heading {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 20px 22px;
}

.card-heading h2,
.settings-card h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.card-heading p,
.settings-card header p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 3px 0 0;
}

.card-heading button,
.compact-empty button,
.connection-summary button,
.notice button,
.guide-index a {
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.card-heading button:hover,
.compact-empty button:hover,
.connection-summary button:hover,
.notice button:hover,
.guide-index a:hover {
  color: var(--text);
}

.data-list {
  min-width: 0;
}

.data-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 14px;
  grid-template-columns: 32px minmax(180px, 1.5fr) minmax(75px, 0.5fr) minmax(75px, 0.5fr) minmax(95px, 0.6fr) 28px;
  min-height: 82px;
  padding: 14px 22px;
}

.group-row {
  grid-template-columns: 32px minmax(180px, 1.5fr) minmax(75px, 0.5fr) minmax(100px, 0.6fr) 28px;
}

.data-row:last-child {
  border-bottom: 0;
}

.entity-mark,
.provider-mark {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 13px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.provider-mark {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-hover);
  font-weight: 700;
}

.entity-main {
  display: grid;
  min-width: 0;
}

.entity-main strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-main small,
.data-value span {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-value {
  display: grid;
}

.data-value strong {
  font-size: 13px;
  font-weight: 550;
}

.row-action {
  align-items: center;
  border-radius: 5px;
  color: var(--text-muted);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  text-decoration: none;
  width: 28px;
}

.row-action:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.row-action.muted {
  opacity: 0.4;
}

.connection-summary {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(200px, 1.2fr) minmax(100px, 0.7fr) minmax(90px, 0.6fr) auto;
  margin-top: 12px;
  padding: 19px 20px;
}

.connection-summary > div:first-child {
  align-items: center;
  display: flex;
  gap: 11px;
}

.connection-summary p,
.compact-empty p {
  display: grid;
  margin: 0;
}

.connection-summary > div:not(:first-child) {
  display: grid;
}

.connection-summary span,
.connection-summary small {
  color: var(--text-muted);
  font-size: 12px;
}

.connection-summary strong {
  font-size: 13px;
  font-weight: 600;
}

.compact-empty {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  padding: 20px;
}

.compact-empty > span {
  color: var(--text-muted);
  font-size: 20px;
}

.compact-empty strong {
  font-size: 14px;
}

.compact-empty small {
  color: var(--text-muted);
  font-size: 12px;
}

.notice {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--warning);
  border-radius: var(--radius-small);
  display: grid;
  gap: 12px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  margin-bottom: 12px;
  padding: 17px 18px;
}

.notice > span {
  color: var(--warning);
  font-weight: 700;
}

.notice strong {
  font-size: 14px;
}

.notice p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 2px 0 0;
}

.empty-state {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  padding: 55px 24px;
  text-align: center;
}

.empty-icon {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 20px;
  height: 54px;
  justify-content: center;
  margin-bottom: 22px;
  width: 54px;
}

.empty-state-error .empty-icon {
  color: var(--danger);
}

.empty-state h2 {
  font-size: 22px;
  font-weight: 530;
  letter-spacing: -0.03em;
  margin: 0;
}

.empty-state > p {
  color: var(--text-soft);
  margin: 9px 0 0;
  max-width: 540px;
}

.empty-state > div {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-top: 24px;
}

.loading-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 17px;
  min-height: 360px;
  padding: 30px;
}

.loading-line {
  animation: pulse 1.2s ease-in-out infinite alternate;
  background: var(--surface-hover);
  border-radius: 5px;
  height: 52px;
  width: 72%;
}

.loading-line.wide {
  width: 100%;
}

@keyframes pulse {
  from { opacity: 0.45; }
  to { opacity: 0.9; }
}

/* Connections */
.connection-list {
  display: grid;
  gap: 10px;
}

.connection-card {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1fr) auto;
  padding: 20px;
}

.connection-card-main {
  align-items: center;
  display: flex;
  gap: 13px;
  min-width: 0;
}

.connection-card-main h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 1px 0;
}

.connection-card-main p,
.connection-type {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
}

.connection-card dl {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
}

.connection-card dl > div {
  display: grid;
}

.connection-card dt {
  color: var(--text-muted);
  font-size: 12px;
}

.connection-card dd {
  align-items: center;
  display: flex;
  font-size: 13px;
  gap: 6px;
  margin: 2px 0 0;
}

.connection-card-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.danger-button {
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
}

.vault-note {
  align-items: flex-start;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding: 20px 4px 0;
}

.vault-note strong {
  color: var(--text-soft);
  font-size: 13px;
}

.vault-note p {
  font-size: 12px;
  margin: 2px 0 0;
}

/* Guides */
.guide-layout {
  align-items: start;
  display: grid;
  gap: 50px;
  grid-template-columns: 180px minmax(0, 760px);
  justify-content: center;
}

.guide-index {
  display: grid;
  gap: 4px;
  position: sticky;
  top: 0;
}

.guide-index .nav-label {
  margin: 0 0 9px;
}

.guide-index a {
  border-radius: 5px;
  padding: 6px 8px;
}

.guide-index a:hover {
  background: var(--surface-hover);
}

.guide-content {
  min-width: 0;
}

.guide-hero {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 22px;
  grid-template-columns: 54px minmax(0, 1fr);
  padding-bottom: 36px;
}

.guide-number {
  color: var(--accent-hover);
  font-size: 31px;
  font-weight: 450;
  letter-spacing: -0.04em;
}

.guide-hero h2 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 480;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0;
}

.guide-hero div > p:last-child {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
  margin: 16px 0 0;
}

.guide-section {
  border-bottom: 1px solid var(--border);
  padding: 38px 0;
  scroll-margin-top: 30px;
}

.guide-section:last-child {
  border-bottom: 0;
}

.guide-section-heading {
  align-items: flex-start;
  display: grid;
  gap: 14px;
  grid-template-columns: 30px minmax(0, 1fr);
}

.guide-section-heading h3 {
  font-size: 19px;
  font-weight: 560;
  letter-spacing: -0.025em;
  margin: 1px 0 0;
}

.guide-section-heading p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.guide-section > ol,
.guide-section > ul {
  color: var(--text-soft);
  display: grid;
  gap: 11px;
  line-height: 1.65;
  margin: 24px 0 0 44px;
  padding-left: 18px;
}

.guide-section a {
  color: var(--text);
  text-underline-offset: 3px;
}

.guide-section code {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  padding: 2px 5px;
}

.guide-section > .button {
  margin: 24px 0 0 44px;
}

.permission-card,
.check-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  margin: 24px 0 0 44px;
  overflow: hidden;
}

.permission-card > div,
.check-list > div {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: 14px minmax(0, 1fr);
  padding: 16px;
}

.permission-card > div:last-child,
.check-list > div:last-child {
  border-bottom: 0;
}

.permission-card p,
.check-list p {
  display: grid;
  margin: 0;
}

.permission-card strong,
.check-list strong {
  font-size: 12px;
}

.permission-card small,
.check-list small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin-top: 2px;
}

.permission-no > span {
  color: var(--danger);
  font-weight: 700;
}

.guide-note {
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0 0 44px;
  padding-left: 12px;
}

.check-list > div > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

/* Settings */
.settings-stack {
  display: grid;
  gap: 12px;
  margin-left: 0;
  max-width: 780px !important;
}

.settings-card {
  margin-top: 0;
  padding: 22px;
}

.settings-card header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.settings-card dl {
  border-top: 1px solid var(--border);
  display: grid;
  margin: 20px 0 0;
}

.settings-card dl > div {
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 160px 1fr;
  padding: 13px 0;
}

.settings-card dl > div:last-child {
  border-bottom: 0;
}

.settings-card dt {
  color: var(--text-muted);
  font-size: 12px;
}

.settings-card dd {
  font-size: 13px;
  margin: 0;
}

.theme-choice {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 20px;
}

.theme-choice button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
  display: grid;
  gap: 9px;
  padding: 10px;
  text-align: left;
}

.theme-choice button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.theme-preview {
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  height: 64px;
  position: relative;
}

.theme-preview::before {
  border-right: 1px solid rgba(128, 128, 128, 0.24);
  content: "";
  height: 100%;
  left: 25%;
  position: absolute;
  top: 0;
}

.theme-preview.light {
  background: #f7f7f8;
}

.theme-preview.dark {
  background: #0b0b0c;
}

.theme-choice strong {
  font-size: 13px;
}

/* Modal and menus */
.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  align-items: center;
  animation: backdrop-in 140ms ease both;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 80;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  animation: modal-in 180ms ease both;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 40px);
  max-width: 660px;
  overflow: auto;
  padding: 26px;
  width: 100%;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-heading {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.modal-heading h2 {
  font-size: 25px;
  font-weight: 520;
  letter-spacing: -0.035em;
  margin: 0;
}

.modal-heading > div > p:last-child {
  color: var(--text-soft);
  margin: 7px 0 0;
}

.close-button {
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  padding: 0;
}

.close-button:hover {
  color: var(--text);
}

.modal-guide {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  display: grid;
  gap: 0;
  margin: 22px 0;
  padding: 4px 16px 13px;
}

.modal-guide > div {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 11px;
  grid-template-columns: 22px 1fr;
  padding: 12px 0;
}

.modal-guide > div > span {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 50%;
  color: var(--accent-hover);
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  height: 21px;
  justify-content: center;
  width: 21px;
}

.modal-guide p,
.safe-callout p {
  display: grid;
  margin: 0;
}

.modal-guide strong,
.safe-callout strong {
  font-size: 13px;
}

.modal-guide small,
.safe-callout small {
  color: var(--text-muted);
  font-size: 12px;
}

.modal-guide > a {
  color: var(--text-soft);
  font-size: 12px;
  margin-top: 12px;
  text-decoration: none;
}

.modal-guide > a:hover {
  color: var(--text);
}

.safe-callout {
  align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-small);
  display: grid;
  gap: 11px;
  grid-template-columns: 20px 1fr;
  padding: 13px;
}

.safe-callout > span {
  color: var(--accent-hover);
}

.modal-actions {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 18px;
}

.profile-menu {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  bottom: 66px;
  box-shadow: var(--shadow);
  display: grid;
  left: 12px;
  padding: 5px;
  position: fixed;
  width: 214px;
  z-index: 40;
}

.profile-menu button {
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  padding: 9px 10px;
  text-align: left;
}

.profile-menu button:hover {
  background: var(--surface-hover);
}

.toast-region {
  bottom: 20px;
  display: grid;
  gap: 8px;
  pointer-events: none;
  position: fixed;
  right: 20px;
  z-index: 100;
}

.toast {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr);
  max-width: 360px;
  opacity: 0;
  padding: 12px 14px;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast > span {
  color: var(--success);
  font-weight: 700;
}

.toast.error > span {
  color: var(--danger);
}

.toast p {
  font-size: 12px;
  margin: 0;
}

.sidebar-scrim {
  display: none;
}

/* Responsive */
@media (max-width: 1050px) {
  .auth-stage {
    gap: 55px;
    grid-template-columns: minmax(0, 1fr) 390px;
  }

  .auth-copy h1 {
    font-size: clamp(42px, 6vw, 64px);
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .connection-card {
    grid-template-columns: 1fr auto;
  }

  .connection-card dl {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 820px) {
  .auth-stage {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .auth-copy {
    text-align: center;
  }

  .auth-copy > p:not(.eyebrow) {
    margin-left: auto;
    margin-right: auto;
  }

  .auth-proof {
    justify-content: center;
  }

  .auth-panel {
    max-width: 440px;
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    bottom: 0;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .mobile-menu {
    display: block;
  }

  .sidebar-scrim {
    background: rgba(0, 0, 0, 0.54);
    cursor: pointer;
    display: block;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 180ms ease;
    z-index: 15;
  }

  .sidebar-scrim.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .onboarding-card {
    grid-template-columns: 1fr;
  }

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

  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-index {
    display: none;
  }
}

@media (max-width: 620px) {
  .auth-nav {
    height: 62px;
    padding: 0 18px;
  }

  .auth-stage {
    min-height: calc(100vh - 62px);
    padding: 44px 18px;
  }

  .auth-copy h1 {
    font-size: 40px;
  }

  .auth-copy > p:not(.eyebrow) {
    font-size: 14px;
  }

  .auth-proof {
    align-items: center;
    flex-direction: column;
    gap: 9px;
  }

  .auth-panel {
    padding: 22px;
  }

  .topbar {
    padding: 0 14px;
  }

  .quiet-button {
    display: none;
  }

  .page {
    padding: 30px 14px 55px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card {
    min-height: 112px;
    padding: 14px;
  }

  .data-row,
  .group-row {
    gap: 10px;
    grid-template-columns: 30px minmax(0, 1fr) 65px 26px;
    padding: 11px 13px;
  }

  .data-row .data-value:nth-of-type(3),
  .data-row .hide-small,
  .group-row .hide-small {
    display: none;
  }

  .connection-summary {
    grid-template-columns: 1fr auto;
  }

  .connection-summary > div:not(:first-child) {
    display: none;
  }

  .connection-card {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .connection-card dl {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .connection-card-actions {
    justify-content: space-between;
  }

  .guide-hero {
    grid-template-columns: 1fr;
  }

  .guide-section > ol,
  .guide-section > ul,
  .permission-card,
  .check-list,
  .guide-note,
  .guide-section > .button {
    margin-left: 0;
  }

  .settings-card dl > div {
    gap: 3px;
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    border-bottom: 0;
    border-left: 0;
    border-radius: 15px 15px 0 0;
    border-right: 0;
    max-height: 92vh;
    padding: 22px 18px;
  }

  .toast-region {
    bottom: 12px;
    left: 12px;
    right: 12px;
  }
}

/* LiveOps detail views and alerts */
.entity-link {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-link:hover {
  color: var(--accent-hover);
}

.experience-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.back-link {
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.detail-metric-grid .metric-card {
  min-height: 128px;
}

.chart-card {
  padding-bottom: 18px;
}

.chart-sample-count {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.chart-wrap {
  padding: 14px 22px 0;
}

.history-chart {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-grid-label {
  fill: var(--text-muted);
  font-size: 11px;
}

.chart-area {
  fill: var(--accent-soft);
  opacity: 0.8;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.chart-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
}

.chart-axis {
  color: var(--text-muted);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  padding: 0 32px;
}

.chart-summary {
  border-top: 1px solid var(--border);
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
  margin: 17px 22px 0;
  padding-top: 15px;
}

.chart-summary div {
  display: grid;
  gap: 3px;
}

.chart-summary span {
  color: var(--text-muted);
  font-size: 12px;
}

.chart-summary strong {
  font-size: 14px;
  font-weight: 600;
}

.chart-empty,
.inline-empty {
  color: var(--text-muted);
  display: grid;
  gap: 4px;
  padding: 30px 22px;
}

.chart-empty strong,
.inline-empty strong {
  color: var(--text-soft);
  font-size: 13px;
}

.chart-empty span,
.inline-empty span {
  font-size: 12px;
}

.monetization-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.monetization-grid .content-card {
  min-width: 0;
}

.product-list {
  min-width: 0;
}

.product-row {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  padding: 14px 18px;
}

.product-row:last-child {
  border-bottom: 0;
}

.product-icon {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent-hover);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.product-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-main strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-main small,
.product-id {
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.product-price strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge {
  color: var(--success);
  font-size: 11px;
  white-space: nowrap;
}

.status-badge.muted {
  color: var(--text-muted);
}

.product-copy {
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 0 7px;
  width: auto;
}

.notification-setup .card-heading,
.notification-list-card .card-heading {
  padding-right: 22px;
}

.notification-form {
  display: grid;
  gap: 16px;
  max-width: 780px;
  padding: 22px;
}

.field-help {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin: -7px 0 0;
}

.alert-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-option,
.threshold-field {
  align-items: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  display: flex;
  gap: 10px;
  padding: 13px;
}

.check-option {
  cursor: pointer;
}

.check-option input {
  accent-color: var(--accent);
  flex: 0 0 auto;
  height: 16px;
  margin: 2px 0 0;
  width: 16px;
}

.check-option span {
  display: grid;
  gap: 3px;
}

.check-option strong,
.threshold-field > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.check-option small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.threshold-field {
  display: grid;
  gap: 8px;
}

.number-field {
  align-items: center;
  display: flex;
  gap: 7px;
}

.number-field input {
  max-width: 92px;
}

.number-field span {
  color: var(--text-muted);
  font-size: 12px;
}

.notification-form-actions {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-top: 16px;
}

.notification-form-actions .security-note {
  border: 0;
  margin: 0;
  padding: 0;
}

.notification-list-card {
  margin-top: 12px;
}

.notification-list {
  display: grid;
}

.notification-card {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) auto;
  padding: 18px 22px;
}

.notification-card:last-child {
  border-bottom: 0;
}

.notification-card-main {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.notification-card-main h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.notification-card-main p,
.notification-card-info span,
.notification-card-info small {
  color: var(--text-muted);
  font-size: 12px;
  margin: 3px 0 0;
}

.notification-card-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.notification-card-info strong {
  font-size: 12px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-card-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

@media (max-width: 820px) {
  .monetization-grid,
  .alert-options {
    grid-template-columns: 1fr;
  }

  .notification-card {
    grid-template-columns: 1fr auto;
  }

  .notification-card-info {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 620px) {
  .experience-toolbar,
  .notification-form-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-wrap {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chart-axis {
    padding: 0 16px;
  }

  .chart-summary {
    margin-left: 14px;
    margin-right: 14px;
  }

  .product-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .product-price {
    grid-column: 2 / -1;
    grid-row: 2;
    justify-items: start;
    text-align: left;
  }

  .product-copy {
    grid-column: 3;
    grid-row: 1;
  }

  .notification-card {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .notification-card-info {
    grid-column: auto;
    grid-row: auto;
  }

  .notification-card-actions {
    justify-content: space-between;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.terms-consent {
  align-items: flex-start;
  color: var(--text-soft);
  display: flex;
  font-size: 12px;
  gap: 9px;
  line-height: 1.45;
}

.terms-consent input {
  accent-color: var(--accent);
  flex: 0 0 auto;
  height: 16px;
  margin: 1px 0 0;
  width: 16px;
}

.terms-consent a {
  color: var(--text);
}

.site-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  font-size: 12px;
  gap: 20px;
  justify-content: space-between;
  line-height: 1.45;
}

.site-footer nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer a {
  color: var(--text-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

.auth-footer {
  margin: 0 auto;
  max-width: 1380px;
  padding: 20px clamp(24px, 7vw, 120px) 28px;
}

.app-footer {
  margin: 20px auto 0;
  max-width: 1380px;
  padding: 18px 0 2px;
  width: calc(100% - clamp(56px, 8vw, 144px));
}

.legal-screen {
  min-height: 100vh;
  padding: 22px 24px 70px;
}

.legal-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 920px;
}

.legal-nav .button {
  min-height: 36px;
}

.legal-shell {
  margin: 88px auto 0;
  max-width: 820px;
}

.legal-shell h1 {
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
  margin: 0;
}

.legal-intro {
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.7;
  margin: 22px 0 0;
  max-width: 680px;
}

.legal-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 18px;
}

.legal-content {
  margin-top: 64px;
}

.legal-content section {
  border-top: 1px solid var(--border);
  padding: 28px 0 30px;
}

.legal-content h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 10px;
}

.legal-content p,
.legal-content li {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

.legal-content p {
  margin: 10px 0 0;
}

.legal-content ul {
  margin: 12px 0 0;
  padding-left: 23px;
}

.legal-content li + li {
  margin-top: 7px;
}

.legal-content strong {
  color: var(--text);
  font-weight: 600;
}

.legal-callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-small);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 28px;
  padding: 16px 18px;
}

.legal-callout strong {
  color: var(--text);
}

.legal-footer {
  margin: 36px auto 0;
  max-width: 820px;
  padding-top: 18px;
}

@media (max-width: 620px) {
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .site-footer nav {
    gap: 10px 16px;
  }

  .auth-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-footer {
    margin-left: 14px;
    margin-right: 14px;
    width: auto;
  }

  .legal-screen {
    padding-left: 18px;
    padding-right: 18px;
  }

  .legal-shell {
    margin-top: 58px;
  }

  .legal-content {
    margin-top: 44px;
  }
}

/* Search, discovery, and workspace triage */
.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.global-search-trigger {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 9px 0 11px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  width: min(260px, 28vw);
}

.global-search-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.global-search-trigger .search-icon {
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1;
}

.global-search-trigger > span:nth-child(2) {
  flex: 1;
  text-align: left;
}

kbd {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 4px 5px;
}

.attention-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}

.attention-heading {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 20px 22px 17px;
}

.attention-heading .eyebrow {
  margin-bottom: 6px;
}

.attention-heading h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.attention-heading p:last-child {
  color: var(--text-muted);
  font-size: 13px;
  margin: 3px 0 0;
}

.attention-count {
  align-items: center;
  background: rgba(230, 182, 92, 0.12);
  border: 1px solid rgba(230, 182, 92, 0.3);
  border-radius: 50%;
  color: var(--warning);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.attention-card.is-clear .attention-count {
  background: rgba(111, 207, 151, 0.12);
  border-color: rgba(111, 207, 151, 0.3);
  color: var(--success);
}

.attention-list {
  border-top: 1px solid var(--border);
}

.attention-item {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  padding: 14px 22px;
}

.attention-item:last-child {
  border-bottom: 0;
}

.attention-icon {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--warning);
  display: inline-flex;
  font-size: 13px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.attention-item strong {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-item p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 2px 0 0;
}

.attention-item button,
.text-button {
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.attention-item button:hover,
.text-button:hover {
  color: var(--text);
}

.attention-clear {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 11px;
  padding: 14px 22px 18px;
}

.attention-clear > span {
  align-items: center;
  background: rgba(111, 207, 151, 0.12);
  border: 1px solid rgba(111, 207, 151, 0.3);
  border-radius: 50%;
  color: var(--success);
  display: inline-flex;
  font-size: 12px;
  height: 27px;
  justify-content: center;
  width: 27px;
}

.attention-clear p {
  display: grid;
  margin: 0;
}

.attention-clear strong {
  font-size: 13px;
}

.attention-clear small {
  color: var(--text-muted);
  font-size: 12px;
}

.game-row {
  grid-template-columns: 32px minmax(180px, 1.5fr) minmax(75px, 0.5fr) minmax(75px, 0.5fr) minmax(95px, 0.6fr) 28px 28px;
}

.favorite-button {
  align-items: center;
  background: transparent;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 19px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.favorite-button:hover,
.favorite-button.is-favorite {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.collection-result-count {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.collection-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 13px 18px;
}

.collection-toolbar .search-field {
  flex: 1 1 250px;
}

.search-field {
  min-width: 180px;
  position: relative;
}

.search-field .search-icon {
  color: var(--text-muted);
  font-size: 17px;
  left: 12px;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  top: 11px;
}

.search-field input,
.select-field select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  min-height: 40px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  width: 100%;
}

.search-field input {
  padding: 0 12px 0 35px;
}

.search-field input:focus,
.select-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-field {
  min-width: 145px;
}

.select-field select {
  color: var(--text-soft);
  cursor: pointer;
  padding: 0 30px 0 10px;
}

.collection-toolbar > .collection-result-count {
  margin-left: auto;
}

.filter-empty {
  align-items: flex-start;
}

.filter-empty .text-button {
  margin-top: 5px;
}

.detail-toolbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 14px 18px;
}

.detail-toolbar > div {
  display: grid;
  gap: 2px;
}

.detail-toolbar strong {
  font-size: 13px;
}

.detail-toolbar span {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-toolbar .select-field {
  flex: 0 0 170px;
}

.catalog-toolbar-card {
  margin-top: 12px;
}

/* Workspace search dialog */
.search-backdrop {
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 86px 20px 24px;
  position: fixed;
  z-index: 90;
}

.search-scrim {
  background: transparent;
  cursor: default;
  inset: 0;
  position: absolute;
}

.search-dialog {
  animation: modal-in 180ms ease both;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  box-shadow: var(--shadow);
  max-height: min(650px, calc(100vh - 110px));
  max-width: 680px;
  overflow: auto;
  position: relative;
  width: 100%;
  z-index: 1;
}

.search-heading {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 11px;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  padding: 14px 16px;
}

.search-heading > .search-icon {
  color: var(--text-soft);
  font-size: 19px;
  line-height: 1;
}

.search-heading input {
  background: transparent;
  border: 0;
  font-size: 16px;
  min-width: 0;
  outline: none;
  padding: 3px 0;
}

.search-heading .close-button {
  font-size: 22px;
}

.search-section {
  padding: 12px 8px 8px;
}

.search-section + .search-section {
  border-top: 1px solid var(--border);
}

.search-section-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  margin: 0 9px 6px;
  text-transform: uppercase;
}

.search-result {
  align-items: center;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  gap: 11px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  padding: 10px 9px;
  text-align: left;
  width: 100%;
}

.search-result:hover {
  background: var(--surface-hover);
}

.search-result-icon {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--accent-hover);
  display: inline-flex;
  font-size: 13px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.search-result > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.search-result strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result small {
  color: var(--text-muted);
  font-size: 11px;
}

.search-result-arrow {
  color: var(--text-muted);
  font-size: 13px;
}

.search-empty {
  align-items: center;
  display: flex;
  flex-direction: column;
  padding: 42px 22px 32px;
  text-align: center;
}

.search-empty > span {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 22px;
  height: 48px;
  justify-content: center;
  margin-bottom: 14px;
  width: 48px;
}

.search-empty strong {
  font-size: 14px;
}

.search-empty p {
  color: var(--text-muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.search-shortcuts {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  font-size: 11px;
  gap: 18px;
  justify-content: flex-end;
  padding: 10px 16px;
}

.search-shortcuts kbd {
  margin-right: 4px;
}

@media (max-width: 820px) {
  .global-search-trigger {
    width: 180px;
  }

  .attention-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .attention-item button {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .global-search-trigger {
    width: 34px;
  }

  .global-search-trigger > span:nth-child(2),
  .global-search-trigger kbd {
    display: none;
  }

  .global-search-trigger .search-icon {
    margin: auto;
  }

  .collection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .collection-toolbar .search-field,
  .collection-toolbar .select-field,
  .detail-toolbar .select-field {
    width: 100%;
  }

  .collection-toolbar > .collection-result-count {
    margin-left: 0;
  }

  .detail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .game-row {
    grid-template-columns: 30px minmax(0, 1fr) 55px 55px 28px 28px;
  }

  .game-row .hide-small {
    display: none;
  }

  .game-row .favorite-button,
  .game-row .row-action {
    grid-row: 1 / span 2;
    align-self: center;
  }

  .game-row .favorite-button {
    grid-column: 5;
  }

  .game-row .row-action {
    grid-column: 6;
  }

  .search-backdrop {
    padding: 66px 12px 12px;
  }

  .search-shortcuts {
    justify-content: flex-start;
  }
}
