:root {
  --bg: #f5f7f0;
  --surface: #ffffff;
  --ink: #20231f;
  --muted: #687063;
  --line: rgba(32, 35, 31, .13);
  --accent: #c93d5a;
  --accent-dark: #9f2841;
  --green: #2f8b6c;
  --gold: #b67b23;
  --danger: #b74545;
  --blue: #2d6f98;
  --shadow: 0 20px 58px rgba(31, 35, 28, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.account-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(32, 35, 31, .08);
  background: rgba(245, 247, 240, .9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #20231f;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.account-nav {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-actions [hidden] {
  display: none;
}

.account-shell {
  display: grid;
  gap: 20px;
  padding: clamp(22px, 4vw, 46px);
}

.account-hero,
.auth-grid,
.dashboard-grid,
.workspace-grid,
.plans-grid {
  display: grid;
  gap: 16px;
}

.account-hero {
  grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
  align-items: stretch;
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 16px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.08;
  letter-spacing: 0;
}

.account-hero p,
.workspace-card p,
.panel p,
.status-text {
  color: var(--muted);
  line-height: 1.6;
}

.access-panel,
.panel,
.workspace-card,
.workspace-lock,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.access-panel {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 220px;
  padding: 24px;
  background: #20231f;
  color: #fff;
}

.access-panel small {
  color: rgba(255, 255, 255, .72);
  line-height: 1.5;
}

.status-pill {
  width: max-content;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: #ffcf71;
  font-size: 12px;
  font-weight: 950;
}

.status-pill.neutral {
  background: rgba(45, 111, 152, .1);
  color: var(--blue);
}

.auth-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, .52fr);
}

.auth-panel {
  display: grid;
  gap: 14px;
}

.auth-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf4;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.auth-steps span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(32, 35, 31, .08);
  color: var(--ink);
  font-size: 12px;
}

.auth-steps li.active,
.auth-steps li.done {
  border-color: rgba(201, 61, 90, .3);
  background: #fff6f8;
  color: var(--ink);
}

.auth-steps li.done span {
  background: var(--green);
  color: #fff;
}

.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.auth-form[hidden],
.code-tools[hidden] {
  display: none;
}

.auth-form label,
.tenant-list span {
  display: grid;
  gap: 7px;
}

.auth-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.auth-form input[aria-invalid="true"] {
  border-color: rgba(183, 69, 69, .7);
  background: #fff6f5;
}

.code-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.text-button {
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 900;
  cursor: pointer;
}

.text-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.tenant-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.tenant-list {
  display: grid;
  gap: 10px;
}

.tenant-list span {
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf4;
}

.tenant-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, .56fr);
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-head > strong {
  color: var(--green);
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-grid span {
  display: grid;
  gap: 5px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf4;
}

.metric-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.metric-grid b {
  font-size: 18px;
}

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.workspace-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

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

.secondary-button,
.ghost-button,
.workspace-card button {
  background: #fff;
  color: var(--ink);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.status-text {
  min-height: 24px;
  margin: 12px 0 0;
  font-weight: 800;
}

.status-text[data-tone="error"] {
  color: var(--danger);
}

.status-text[data-tone="success"] {
  color: var(--green);
}

.channel-list {
  display: grid;
  gap: 9px;
}

.channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf4;
}

.channel-row b {
  color: var(--muted);
  font-size: 12px;
}

.channel-row.enabled b {
  color: var(--green);
}

.workspace-section,
.plans-section,
.billing-history-section {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-head {
  max-width: 760px;
}

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

.billing-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

.billing-table th,
.billing-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.billing-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.payment-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(47, 139, 108, .1);
  color: var(--green);
  font-size: 12px;
  font-weight: 950;
}

.payment-status.pending {
  background: rgba(182, 123, 35, .12);
  color: var(--gold);
}

.payment-status.failed {
  background: rgba(183, 69, 69, .1);
  color: var(--danger);
}

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

.workspace-card,
.plan-card {
  display: grid;
  gap: 12px;
  min-height: 220px;
  padding: 20px;
}

.workspace-card span,
.plan-card span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
}

.workspace-card strong,
.plan-card strong {
  font-size: 22px;
}

.workspace-card.locked {
  opacity: .55;
}

.workspace-card.locked button {
  cursor: not-allowed;
}

button:disabled {
  opacity: .62;
  cursor: not-allowed;
}

.workspace-lock {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-color: rgba(183, 69, 69, .24);
  background: #fff6f5;
  color: var(--danger);
}

.workspace-lock[hidden] {
  display: none;
}

.workspace-lock span {
  color: #784242;
}

.plan-card.featured {
  border-color: rgba(201, 61, 90, .32);
  box-shadow: 0 16px 44px rgba(201, 61, 90, .12);
}

.plan-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(201, 61, 90, .24);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .account-nav {
    display: none;
  }

  .account-hero,
  .auth-grid,
  .dashboard-grid,
  .workspace-grid,
  .plans-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .account-header {
    min-height: 64px;
    padding: 12px 14px;
  }

  .brand span:last-child {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ghost-button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .header-actions {
    justify-content: flex-end;
  }

  .account-shell {
    padding: 14px;
  }

  .account-hero,
  .workspace-section,
  .plans-section,
  .billing-history-section {
    padding: 18px;
  }

  .panel-head,
  .auth-form,
  .auth-steps,
  .billing-actions {
    display: grid;
  }

  .primary-button,
  .secondary-button,
  .workspace-card button {
    width: 100%;
  }
}
