* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg1);
}

body,
button,
input {
  font-family: var(--font-sans);
}

body {
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

.db-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  background:
    linear-gradient(rgba(19, 19, 22, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(19, 19, 22, 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, rgba(216, 155, 0, 0.08), transparent 38%),
    var(--bg);
}

.db-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--neutral-950);
}

.db-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}

.db-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(216, 155, 0, 0.26));
}

.db-role-nav {
  display: grid;
  gap: 8px;
}

.db-role-nav button,
.db-chat-link,
.db-auth-card button,
.db-plan-card button {
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 700;
}

.db-role-nav button {
  min-height: 42px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.07);
  text-align: start;
  padding: 0 13px;
}

.db-role-nav button.is-active {
  color: var(--fg-on-accent);
  background: var(--accent);
}

.db-account-card {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-lg);
}

.db-account-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-account-card span:last-child {
  color: var(--gold-300);
  font-family: var(--font-mono);
  font-size: 12px;
}

.db-kicker {
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.db-sidebar .db-kicker {
  color: rgba(255, 255, 255, 0.48);
}

.db-chat-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--fg-on-accent);
  background: var(--accent);
  box-shadow: var(--shadow-accent);
}

.db-console-link {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.db-login-link {
  color: #fff;
  background: rgba(216, 155, 0, 0.18);
  border: 1px solid rgba(216, 155, 0, 0.32);
  box-shadow: none;
}

.db-main {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}

.db-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  align-items: start;
  gap: 20px;
  width: min(1120px, 100%);
  margin: 0 auto 22px;
}

.db-top h1 {
  margin: 8px 0 0;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.18;
}

.db-auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.db-auth-card input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  color: var(--fg1);
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: 0;
}

.db-auth-card input:focus {
  border-color: var(--accent);
}

.db-auth-card button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--fg-on-accent);
  background: var(--accent);
}

.db-plans,
.db-grid {
  display: grid;
  width: min(1120px, 100%);
  margin: 0 auto;
  gap: 16px;
}

.db-plans {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.db-plan-card,
.db-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.db-plan-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 20px;
}

body[data-role="individual"] .db-plan-card[data-plan="personal"],
body[data-role="practitioner"] .db-plan-card[data-plan="clinician"],
body[data-role="company"] .db-plan-card[data-plan="company"] {
  order: -1;
}

.db-plan-card.is-selected,
.db-plan-card.is-hot {
  border-color: var(--accent);
}

.db-plan-card.is-selected {
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm);
}

.db-plan-card > b {
  position: absolute;
  inset-block-start: -11px;
  inset-inline-start: 18px;
  padding: 4px 10px;
  color: var(--fg-on-accent);
  background: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 11px;
}

.db-plan-card span {
  color: var(--fg2);
  font-weight: 700;
}

.db-plan-card strong {
  color: var(--fg1);
  font-size: 34px;
}

.db-plan-card p,
.db-panel p {
  margin: 0;
  color: var(--fg2);
  font-size: 14px;
  line-height: 1.7;
}

.db-plan-card button {
  min-height: 38px;
  color: var(--fg1);
  background: var(--surface-inset);
}

.db-plan-card.is-selected button {
  color: var(--fg-on-accent);
  background: var(--accent);
}

.db-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.db-panel {
  padding: 20px;
}

.db-panel.is-wide {
  grid-column: 1 / -1;
}

.db-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.db-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.db-panel-head h2 {
  margin: 0;
}

.db-panel-head span {
  padding: 5px 10px;
  color: var(--accent-fg);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.db-profile-note {
  margin-bottom: 14px;
}

.db-profile-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.db-profile-form label {
  display: grid;
  gap: 7px;
}

.db-profile-form label.is-wide,
.db-profile-actions.is-wide {
  grid-column: 1 / -1;
}

.db-profile-form label span {
  color: var(--fg2);
  font-size: 13px;
  font-weight: 800;
}

.db-profile-form input,
.db-profile-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  color: var(--fg1);
  background: var(--surface-inset);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  outline: 0;
}

.db-profile-form textarea {
  min-height: 86px;
  padding-block: 11px;
  resize: vertical;
}

.db-profile-form input:focus,
.db-profile-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.db-profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.db-profile-actions button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--fg-on-accent);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.db-profile-actions small {
  color: var(--fg3);
  line-height: 1.5;
}

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

.db-metric {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 14px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
}

.db-metric strong {
  color: var(--fg1);
  font-size: 28px;
}

.db-metric span {
  color: var(--fg3);
  font-size: 13px;
}

.db-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.db-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--surface-inset);
  border-radius: var(--radius-md);
  color: var(--fg2);
  font-size: 14px;
}

.db-list b {
  color: var(--fg1);
}

.db-status {
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 11px;
}

@media (max-width: 1040px) {
  .db-shell {
    grid-template-columns: 1fr;
  }

  body {
    overflow: auto;
  }

  .db-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .db-role-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .db-account-card {
    display: none;
  }

  .db-main {
    overflow: visible;
  }

  .db-top,
  .db-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .db-sidebar,
  .db-main {
    padding: 14px;
  }

  .db-sidebar {
    grid-template-columns: 1fr;
  }

  .db-brand {
    justify-content: center;
  }

  .db-chat-link {
    display: none;
  }

  .db-auth-card,
  .db-plans,
  .db-profile-form,
  .db-metric-grid {
    grid-template-columns: 1fr;
  }

  .db-panel-head,
  .db-profile-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .db-top {
    gap: 14px;
  }
}
