body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 16rem),
    linear-gradient(135deg, var(--color-page), var(--color-page-2));
  color: var(--color-ink);
  margin: 0;
  min-height: 100vh;
  overscroll-behavior-x: none;
}

[hidden] {
  display: none !important;
}

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

button,
.button-link {
  align-items: center;
  background: var(--color-ink);
  border: 1px solid rgba(23, 33, 27, 0.08);
  border-radius: var(--radius-control);
  box-shadow: 0 1px 1px rgba(23, 33, 27, 0.04), 0 6px 14px rgba(23, 33, 27, 0.1);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 700;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.62rem 0.9rem;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover,
.button-link:hover {
  background: #21352b;
  box-shadow: 0 2px 3px rgba(23, 33, 27, 0.06), 0 10px 20px rgba(23, 33, 27, 0.14);
  transform: translateY(-1px);
}

.text-link {
  align-self: start;
  background: transparent;
  color: var(--color-accent);
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}

.form-switch-link {
  justify-self: start;
}

.button-link.disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
  transform: none;
}

button:disabled {
  box-shadow: none;
  transform: none;
}

.btn.ghost {
  background: #edf3eb;
  border-color: rgba(35, 95, 75, 0.12);
  box-shadow: none;
  color: var(--color-accent);
}

.btn.ghost:hover {
  background: #e1ebe0;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: var(--color-ink);
  display: block;
  font-size: 0.9rem;
  margin-top: 0.35rem;
  padding: 0.68rem 0.78rem;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(35, 95, 75, 0.55);
  box-shadow: 0 0 0 3px rgba(35, 95, 75, 0.12);
  outline: none;
}

.topbar {
  align-items: center;
  background: rgba(20, 31, 25, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 35px rgba(23, 33, 27, 0.16);
  color: white;
  display: flex;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
}

.topbar h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.topbar h1,
.section-heading h2,
.site-card h3,
.admin-grid h3 {
  margin: 0;
}

.account-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.account-bar button,
.account-bar .button-link {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
  box-shadow: none;
  color: #f7fbf6;
  height: 2rem;
  line-height: 1;
  min-height: 2rem;
  padding: 0.34rem 0.65rem;
}

.account-bar button:hover,
.account-bar .button-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

.account-user-button {
  max-width: min(42vw, 28rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-popover {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(19, 32, 26, 0.14);
  border-radius: 1.5rem;
  box-shadow: 0 24px 80px rgba(19, 32, 26, 0.18);
  padding: 1rem;
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  top: calc(var(--topbar-height) - 0.15rem);
  width: min(24rem, calc(100vw - 2rem));
  z-index: 50;
}

.quota-popover-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.quota-popover-header h2 {
  margin: 0;
}

.auth-mode {
  --auth-accent: #2563eb;
  --auth-border: #e4e7ec;
  --auth-ink: #182230;
  --auth-muted: #667085;
  background: #f6f8fb;
  color: var(--auth-ink);
}

.auth-mode .topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--auth-border);
  box-shadow: none;
  color: var(--auth-ink);
  min-height: 3.25rem;
  padding: 0 1.25rem;
}

.auth-mode .topbar h1 {
  font-size: 0.94rem;
  font-weight: 700;
}

.auth-mode #current-user {
  display: none;
}

.auth-mode .account-bar button,
.auth-mode .account-bar .button-link {
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  box-shadow: none;
  color: #344054;
  height: 2rem;
  min-height: 2rem;
  padding: 0.34rem 0.65rem;
}

.auth-mode .account-bar button:hover,
.auth-mode .account-bar .button-link:hover {
  background: #eff4ff;
  border-color: #b2ccff;
  color: #1849a9;
}

.auth-layout {
  align-items: start;
  box-sizing: border-box;
  display: grid;
  min-height: calc(100vh - 3.25rem);
  padding: clamp(2.25rem, 7vh, 4.5rem) clamp(1rem, 4vw, 3rem) 2rem;
  justify-items: center;
}

.auth-stage {
  background: #ffffff;
  border: 1px solid var(--auth-border, var(--color-border));
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  display: grid;
  grid-template-columns: minmax(15rem, 0.82fr) minmax(24rem, 1.18fr);
  max-width: 57rem;
  min-height: 31rem;
  overflow: hidden;
  width: 100%;
}

.auth-intro {
  background: #f8fafc;
  border-right: 1px solid var(--auth-border);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.auth-brand {
  align-items: center;
  color: var(--auth-ink);
  display: inline-flex;
  font-size: 0.94rem;
  font-weight: 750;
  gap: 0.7rem;
  text-decoration: none;
}

.auth-brand-mark {
  align-items: center;
  background: var(--auth-accent);
  border-radius: 5px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 800;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.auth-intro-copy {
  margin: auto 0;
}

.auth-intro-copy > p:first-child {
  color: var(--auth-accent);
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0 0 0.8rem;
}

.auth-intro-copy h1 {
  color: var(--auth-ink);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  line-height: 1.18;
  margin: 0;
  max-width: 13ch;
}

.auth-intro-copy > p:last-child {
  color: var(--auth-muted);
  font-size: 0.88rem;
  line-height: 1.7;
  margin: 1.1rem 0 0;
  max-width: 28rem;
}

.auth-intro-foot {
  color: #98a2b3;
  font-size: 0.72rem;
  line-height: 1.5;
  margin: 0;
}

.auth-form-region {
  align-items: center;
  display: grid;
  padding: clamp(2rem, 5vw, 4rem);
}

.auth-card {
  box-sizing: border-box;
  margin: 0 auto;
  width: min(25rem, 100%);
}

.auth-card .form-grid {
  gap: 1rem;
}

.auth-card .section-heading {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.65rem;
}

.auth-card .section-heading p {
  color: var(--auth-muted);
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 0;
}

.auth-card h2 {
  color: var(--auth-ink);
  font-size: 1.65rem;
  letter-spacing: 0;
}

.auth-card label {
  color: #344054;
  font-size: 0.78rem;
  font-weight: 650;
}

.auth-card input {
  background: #ffffff;
  border-color: #d0d5dd;
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  color: var(--auth-ink);
  min-height: 2.65rem;
}

.auth-card input:focus {
  border-color: #84adff;
  box-shadow: 0 0 0 3px #eff4ff;
}

.auth-card button[type="submit"] {
  background: var(--auth-accent);
  border: 1px solid var(--auth-accent);
  border-radius: 5px;
  box-shadow: none;
  min-height: 2.65rem;
  width: 100%;
}

.auth-card button[type="submit"]:hover {
  background: #1849a9;
  border-color: #1849a9;
  box-shadow: none;
}

.auth-card > .muted {
  color: var(--auth-muted);
  font-size: 0.78rem;
  margin-top: 1.3rem;
  text-align: center;
}

.auth-mode .auth-card p.muted a[data-route-link] {
  color: #175cd3;
}

.auth-card .event-log {
  border-radius: 5px;
  margin-top: 1rem;
  padding: 0.75rem;
}

.external-binding-layout {
  background: #ffffff;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.external-binding-panel {
  margin: 0 auto;
  max-width: 68rem;
}

.external-binding-header {
  align-items: center;
  border-bottom: 1px solid #dfe7e2;
  display: flex;
  justify-content: space-between;
  min-height: 4.5rem;
}

.external-binding-brand {
  align-items: center;
  color: #173b2c;
  display: inline-flex;
  font-size: 1rem;
  font-weight: 700;
  gap: 0.65rem;
  text-decoration: none;
}

.external-binding-mark {
  align-items: center;
  background: #216148;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.85rem;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.external-binding-channel {
  color: #607168;
  font-size: 0.82rem;
  font-weight: 600;
}

.external-binding-body {
  display: grid;
  gap: clamp(2.5rem, 8vw, 7rem);
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.82fr);
  padding: clamp(4rem, 11vh, 7.5rem) 0;
}

.external-binding-context h1 {
  color: #17231d;
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0 0 1.25rem;
}

.external-binding-context > p:not(.external-binding-kicker) {
  color: #53635a;
  font-size: 1rem;
  line-height: 1.75;
  margin: 0;
  max-width: 34rem;
}

.external-binding-kicker,
.external-binding-step {
  color: #277356;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.external-binding-notes {
  color: #53635a;
  display: grid;
  font-size: 0.86rem;
  gap: 0.7rem;
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.external-binding-notes li {
  align-items: center;
  display: flex;
  gap: 0.65rem;
}

.external-binding-notes li::before {
  background: #3c8a68;
  content: "";
  height: 0.38rem;
  width: 0.38rem;
}

.external-binding-action {
  border-left: 1px solid #dfe7e2;
  padding: 0.4rem 0 0 clamp(2rem, 5vw, 4.5rem);
}

.external-binding-action h2 {
  color: #17231d;
  font-size: 1.5rem;
  letter-spacing: 0;
  margin: 0;
}

.external-binding-action .muted {
  line-height: 1.65;
  margin: 0 0 1.5rem;
}

.external-binding-action button[type="button"]:not(.text-link),
.external-binding-action button[type="submit"] {
  min-height: 2.75rem;
  width: 100%;
}

.external-binding-status {
  color: #526259;
  font-size: 0.84rem;
  line-height: 1.55;
  margin-top: 1rem;
  min-height: 1.3rem;
}

.external-binding-success {
  padding-top: 0.25rem;
}

.external-binding-success-icon {
  align-items: center;
  background: #e2f1e7;
  color: #216148;
  display: flex;
  font-size: 1.3rem;
  height: 2.75rem;
  justify-content: center;
  margin-bottom: 1.25rem;
  width: 2.75rem;
}

.muted a,
p a[data-route-link]:not(.button-link) {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.muted a:hover,
p a[data-route-link]:not(.button-link):hover {
  text-decoration: underline;
}

.workspace {
  box-sizing: border-box;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 17rem minmax(0, 1fr);
  height: calc(100vh - var(--topbar-height));
  padding: 0.9rem;
}

.danger-button {
  background: var(--color-danger);
}

.danger-button:hover {
  background: #873224;
}

.sidebar,
.work-area {
  min-height: 0;
}

.sidebar {
  display: grid;
  gap: 1rem;
  grid-template-rows: minmax(0, 1fr);
}

.side-nav,
.quota-card,
.panel,
.agent-chat,
.quota-popover {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}

.quota-card {
  padding: 1rem;
}

.quota-card strong {
  display: block;
  margin: 0.25rem 0;
}

.quota-divider {
  border-top: 1px solid rgba(19, 32, 26, 0.12);
  margin: 0.8rem 0;
}

.side-nav {
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 246, 0.92)),
    var(--color-panel-solid);
  display: grid;
  gap: 0.5rem;
  overflow: auto;
  padding: 0.8rem;
}

.side-nav a,
.site-nav-name {
  border: 1px solid transparent;
  border-radius: 0.82rem;
  color: var(--color-ink);
  padding: 0.85rem 1rem;
  text-decoration: none;
}

.side-nav a:hover,
.site-nav-name:hover,
.site-nav-item.expanded .site-nav-name {
  background: #edf4ec;
  border-color: rgba(35, 95, 75, 0.12);
}

.site-nav-list {
  display: grid;
  gap: 0.45rem;
}

.site-nav-item {
  display: grid;
  gap: 0.25rem;
}

.site-nav-name {
  background: transparent;
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 2.35rem;
  padding: 0.62rem 0.7rem;
  text-align: left;
  width: 100%;
}

.site-nav-meta {
  color: var(--color-muted);
  font-size: 0.7rem;
  padding: 0 0.8rem;
}

.site-subnav {
  border-left: 1px solid rgba(35, 95, 75, 0.16);
  display: grid;
  gap: 0.2rem;
  margin-left: 0.7rem;
  padding: 0.2rem 0 0.35rem 0.35rem;
}

.site-subnav a {
  color: #4d5c51;
  font-size: 0.82rem;
  padding: 0.46rem 0.65rem;
}

.side-nav > .eyebrow {
  color: var(--color-subtle);
  padding: 0.2rem 0.55rem 0;
}

.site-nav-item.current .site-nav-name {
  background: #dbeadf;
  border-color: rgba(35, 95, 75, 0.2);
  box-shadow: inset 3px 0 0 var(--color-accent);
  color: #173b2c;
}

.site-subnav a.active {
  background: #edf6ef;
  border-color: rgba(35, 95, 75, 0.16);
  box-shadow: inset 3px 0 0 rgba(35, 95, 75, 0.38);
  color: #1d4f3c;
}

@media (max-width: 820px) {
  .auth-layout {
    min-height: auto;
    padding: 1.5rem 1rem 2rem;
  }

  .auth-stage {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    max-width: 32rem;
  }

  .auth-intro {
    border-bottom: 1px solid var(--auth-border);
    border-right: 0;
    padding: 1rem 1.25rem;
  }

  .auth-intro-copy,
  .auth-intro-foot {
    display: none;
  }

  .auth-form-region {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 720px) {
  .auth-mode .topbar {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    padding: 0 0.85rem;
  }

  .auth-mode .topbar h1,
  .auth-mode .account-bar {
    width: auto;
  }

  .auth-mode .account-bar {
    justify-content: flex-end;
    margin-left: auto;
  }

  .auth-card {
    width: 100%;
  }

  .auth-card h2 {
    font-size: 1.5rem;
  }

  .auth-form-region {
    padding: 1.75rem 1.15rem;
  }

  .external-binding-layout {
    padding: 0 1.15rem 2rem;
  }

  .external-binding-body {
    gap: 2.5rem;
    grid-template-columns: minmax(0, 1fr);
    padding: 2.75rem 0;
  }

  .external-binding-context h1 {
    font-size: 2.15rem;
  }

  .external-binding-notes {
    margin-top: 1.75rem;
  }

  .external-binding-action {
    border-left: 0;
    border-top: 1px solid #dfe7e2;
    padding: 2.25rem 0 0;
  }
}
