:root {
  --navy: #202B5B;
  --purple: #9800F7;
  --deep-blue: #042E69;
  --teal: #027E8A;
  --white: #FFFFFF;
  --blue: #027E8A;
  --coral: #9800F7;
  --platform: #9800F7;
  --surface: #FFFFFF;
}

a {
  color: var(--teal);
}

.brand-mark {
  background: linear-gradient(135deg, var(--deep-blue), var(--teal));
}

.site-header nav > a.nav-cta {
  background: var(--purple);
  color: var(--white);
}

.eyebrow {
  background: rgba(2, 126, 138, .11);
  color: var(--teal);
}

.button {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.button.accent {
  border-color: var(--teal);
  background: var(--teal);
}

.thank-you {
  color: var(--purple);
}

.platform-strip span,
.platform-grid strong,
.metric-list strong {
  color: var(--navy);
}

.platform-stats article {
  border-top-color: var(--purple);
}

body.app-page {
  min-width: 0;
  background: #f5f7fb;
}

.app-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 270px;
  height: 100vh;
  padding: 22px 18px;
  overflow-y: auto;
  background: var(--deep-blue);
  color: var(--white);
  box-shadow: 12px 0 34px rgba(4, 46, 105, .13);
}

.sidebar-brand {
  color: var(--white);
}

.sidebar-brand .brand-mark {
  background: var(--purple);
  box-shadow: 0 10px 24px rgba(152, 0, 247, .28);
}

.sidebar-brand small {
  color: rgba(255, 255, 255, .72);
}

.sidebar-context {
  display: grid;
  gap: 4px;
  margin: 28px 0 18px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(255, 255, 255, .07);
}

.sidebar-context span {
  color: rgba(255, 255, 255, .7);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-context strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 11px 14px;
  border-left: 4px solid transparent;
  border-radius: 12px;
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  font-weight: 800;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.sidebar-nav a:hover {
  border-left-color: var(--teal);
  background: rgba(2, 126, 138, .32);
  color: var(--white);
}

.sidebar-nav a.active {
  border-left-color: var(--white);
  background: var(--purple);
  color: var(--white);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

.sidebar-footer {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding-top: 24px;
}

.sidebar-footer > a,
.sidebar-footer button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  background: transparent;
  color: var(--white);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-footer button:hover,
.sidebar-footer > a:hover {
  background: var(--teal);
  border-color: var(--teal);
}

.sidebar-footer form {
  margin: 0;
}

.app-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 13px clamp(20px, 2vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
}

.app-topbar-title,
.app-topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-topbar-title strong {
  color: var(--navy);
  font-size: 1.02rem;
}

.app-topbar-title span,
.app-topbar-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: .82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: capitalize;
}

.app-topbar-title span::before {
  content: "•";
  margin-right: 10px;
  color: var(--purple);
}

.app-topbar-meta a {
  font-weight: 800;
}

.section-tabs {
  position: sticky;
  top: 72px;
  z-index: 40;
  display: flex;
  gap: 5px;
  min-height: 54px;
  padding: 8px clamp(20px, 2vw, 36px);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--white);
  scrollbar-width: thin;
}

.section-tabs a {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  border-bottom: 3px solid transparent;
  color: var(--navy);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 800;
}

.section-tabs a:hover {
  border-bottom-color: var(--teal);
  color: var(--teal);
}

.section-tabs a.active {
  border-bottom-color: var(--purple);
  color: var(--purple);
}

.page-shell.app-page-shell {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(20px, 2vw, 40px) 52px;
}

.app-page .panel.narrow {
  width: 100%;
  margin: 18px 0;
}

.app-page .site-footer {
  background: var(--white);
}

.client-portal-workspace .app-sidebar {
  background: var(--navy);
}

.client-portal-workspace .invoice-sheet {
  width: 100%;
}

.team-top-grid {
  align-items: start;
}

.team-usage {
  display: grid;
  gap: 3px;
  min-width: 190px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--purple);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.team-usage span,
.team-email,
.muted {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.team-usage strong {
  color: var(--navy);
}

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

.role-permissions article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.role-permissions strong {
  color: var(--navy);
}

.role-permissions p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.team-actions,
.team-actions form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.team-actions select {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.current-user {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(2, 126, 138, .11);
  color: var(--teal);
  font-size: .7rem;
  font-weight: 900;
}

.status.active {
  background: #e6f6ed;
  color: var(--success);
}

.status.invited {
  background: #f2e8ff;
  color: #6b00ad;
}

.status.disabled {
  background: #ffeaec;
  color: var(--danger);
}

.status.revoked,
.status.platform-disabled {
  background: #ffeaec;
  color: var(--danger);
}

.status.failed {
  background: #ffeaec;
  color: var(--danger);
}

.status.sent {
  background: #e6f6ed;
  color: var(--success);
}

.failure-reason {
  max-width: 520px;
  color: var(--danger);
  overflow-wrap: anywhere;
}

.delivery-guidance {
  margin-top: -4px;
}

.error-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.failure-location {
  max-width: 420px;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.status.warning {
  background: #fff4d8;
  color: var(--warning);
}

.billing-summary-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-bottom:18px}
.billing-summary-grid>.panel{margin:0}
.billing-plan-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:20px}
.billing-plan-card{display:flex;flex-direction:column;min-height:100%;padding:24px;border:1px solid var(--line);border-radius:20px;background:#fff}
.billing-plan-card.featured{border:2px solid #9800F7;box-shadow:0 14px 38px rgba(32,43,91,.1)}
.billing-plan-card h3{margin:0;color:#202B5B;font-size:1.35rem}
.billing-plan-card ul{flex:1;padding-left:20px;line-height:1.75}
.billing-price{display:block;color:#202B5B;font-size:2rem}
.billing-price small{font-size:.85rem;color:#53617c;margin-left:5px}
.billing-warning{display:grid;gap:5px;padding:14px;border-left:4px solid #9800F7;border-radius:10px;background:#f7efff;color:#202B5B}
.trial-access-notice,.trial-payment-gate{display:grid;gap:5px;margin-bottom:18px;padding:16px 18px;border:1px solid rgba(2,126,138,.28);border-left:5px solid var(--teal);border-radius:16px;background:#eefafa;color:var(--navy)}
.trial-access-notice.expired,.trial-payment-gate{border-color:rgba(152,0,247,.28);border-left-color:var(--purple);background:#f7efff}
.trial-access-notice strong,.trial-payment-gate strong{color:var(--navy);font-size:1rem}
.disabled-button{background:#e9edf3;color:#53617c;pointer-events:none}
@media(max-width:900px){.billing-summary-grid,.billing-plan-grid{grid-template-columns:1fr}}

.billing-document-links{display:flex;gap:10px;align-items:center;white-space:nowrap}
.billing-document-links a{font-weight:800;color:#027E8A}
.billing-filter-bar{grid-template-columns:minmax(230px,1fr) repeat(3,minmax(135px,170px)) auto auto;align-items:end}
.billing-filter-bar label{display:grid;gap:6px;color:#202B5B;font-size:.78rem;font-weight:800;text-transform:uppercase}
.billing-operations-metrics{margin-bottom:18px}
@media(max-width:1180px){.billing-filter-bar{grid-template-columns:repeat(3,minmax(0,1fr))}.billing-filter-bar label:first-child{grid-column:span 3}}
@media(max-width:720px){.billing-filter-bar{grid-template-columns:1fr}.billing-filter-bar label:first-child{grid-column:auto}.billing-document-links{white-space:normal}}

.stripe-safety-notice {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid rgba(2, 126, 138, .3);
  border-left: 5px solid var(--teal);
  border-radius: 16px;
  background: rgba(2, 126, 138, .08);
}

.stripe-safety-notice strong,
.stripe-summary-grid strong {
  color: var(--navy);
}

.stripe-summary-grid {
  display: grid;
  grid-template-columns: minmax(160px, .35fr) minmax(280px, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stripe-summary-grid article {
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.stripe-summary-grid span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stripe-url,
.stripe-configuration-table code {
  overflow-wrap: anywhere;
}

.stripe-redaction-note {
  margin-top: 16px;
}

.stripe-verify-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.stripe-verify-form span {
  color: var(--muted);
  font-size: .85rem;
}

.stripe-check-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
}

.stripe-check-list li.passed::marker {
  color: var(--success);
}

.stripe-check-list li.warning::marker {
  color: var(--warning);
}

.stripe-check-list li.failed {
  color: var(--danger);
}

.stripe-result-summary {
  border-top: 4px solid var(--purple);
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .app-sidebar {
    width: 230px;
  }

  .app-topbar-meta span {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-layout {
    display: block;
  }

  .app-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 13px 14px;
    overflow: visible;
  }

  .sidebar-brand {
    width: max-content;
  }

  .sidebar-context {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-bottom: 3px;
    overflow-x: auto;
  }

  .sidebar-nav a {
    flex: 0 0 auto;
    min-height: 39px;
    padding: 8px 12px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 9px;
  }

  .sidebar-nav a:hover,
  .sidebar-nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--white);
  }

  .sidebar-footer {
    display: flex;
    position: absolute;
    top: 14px;
    right: 14px;
    gap: 6px;
    margin: 0;
    padding: 0;
  }

  .sidebar-footer > a,
  .sidebar-footer button {
    width: auto;
    min-height: 38px;
    padding: 7px 10px;
  }

  .app-topbar,
  .section-tabs {
    position: static;
  }

  .app-topbar {
    min-height: 62px;
    padding: 10px 14px;
  }

  .section-tabs {
    min-height: 50px;
    padding: 6px 12px;
  }

  .page-shell.app-page-shell {
    width: 100%;
    padding: 16px 10px 38px;
  }
}

@media (max-width: 640px) {
  .sidebar-brand .brand-mark {
    width: 38px;
    height: 38px;
  }

  .sidebar-footer > a {
    display: none;
  }

  .app-topbar-meta {
    display: none;
  }

  .app-topbar-title span {
    display: none;
  }

  .section-tabs a {
    padding-inline: 10px;
    font-size: .8rem;
  }

  .role-permissions {
    grid-template-columns: 1fr;
  }

  .error-stats {
    grid-template-columns: 1fr;
  }

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

@media print {
  .app-sidebar,
  .app-topbar,
  .section-tabs,
  .app-page .site-footer {
    display: none !important;
  }

  .app-layout,
  .app-workspace {
    display: block;
  }

  .page-shell.app-page-shell {
    width: 100%;
    padding: 0;
  }
}
