:root {
  color-scheme: dark;
  --bg: #05090d;
  --panel: #0a1118;
  --panel-raised: #101a24;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f7fa;
  --muted: #9ca9b6;
  --accent: #ff6a1a;
  --accent-hover: #ff7d3a;
  --blue: #55b7ff;
  --success: #42d392;
  --danger: #ff6b72;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 12%, rgba(40, 104, 148, 0.2), transparent 36rem),
    radial-gradient(circle at 82% 90%, rgba(255, 106, 26, 0.11), transparent 30rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 1rem;
  background: var(--danger);
  color: #190306;
  font-weight: 800;
  text-align: center;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(440px, 1.1fr);
}

.brand-panel,
.portal-panel {
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 5rem);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(12, 26, 38, 0.94), rgba(4, 10, 15, 0.96)),
    var(--panel);
}

.brand-panel::after {
  content: "";
  position: absolute;
  width: 34rem;
  height: 34rem;
  right: -18rem;
  bottom: -15rem;
  border: 1px solid rgba(255, 106, 26, 0.3);
  border-radius: 50%;
  box-shadow:
    0 0 0 5rem rgba(255, 106, 26, 0.035),
    0 0 0 10rem rgba(85, 183, 255, 0.025);
  pointer-events: none;
}

.brand-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  width: fit-content;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 9px 7px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.035);
}

.brand-mark span {
  display: block;
  height: 3px;
  background: var(--accent);
  transform-origin: left center;
}

.brand-mark span:nth-child(1) {
  width: 76%;
}

.brand-mark span:nth-child(2) {
  width: 100%;
}

.brand-mark span:nth-child(3) {
  width: 58%;
}

.brand-text {
  letter-spacing: 0.12em;
  font-weight: 700;
}

.brand-text strong {
  color: var(--accent);
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin-block: 5rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.brand-copy h1,
.portal-heading h2,
.account-header h2 {
  margin: 0;
  line-height: 1.04;
}

.brand-copy h1 {
  max-width: 8ch;
  font-size: clamp(3rem, 6vw, 6rem);
  letter-spacing: -0.055em;
}

.brand-copy p:last-child {
  max-width: 34rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.7;
}

.back-link {
  position: relative;
  z-index: 1;
  width: fit-content;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover,
.portal-footer a:hover,
.text-button:hover,
.back-button:hover {
  color: var(--text);
}

.portal-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.portal-card {
  width: min(100%, 580px);
  margin: auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  background: rgba(10, 17, 24, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.portal-heading h2,
.account-header h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.045em;
}

.portal-heading > p:last-child {
  margin: 0.9rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  padding: 0.9rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab-button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.form-stack {
  display: grid;
  gap: 1.15rem;
}

.form-stack label {
  display: grid;
  gap: 0.55rem;
}

.form-stack label > span {
  font-size: 0.9rem;
  font-weight: 700;
}

.form-stack small {
  color: var(--muted);
  line-height: 1.45;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  outline: none;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(85, 183, 255, 0.14);
  background: rgba(255, 255, 255, 0.065);
}

input:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.75rem !important;
  color: var(--muted);
  line-height: 1.5;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0.8rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 0;
  font-weight: 800;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

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

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

.secondary-button {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.text-button,
.back-button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.message {
  margin: 1.5rem 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--blue);
  background: rgba(85, 183, 255, 0.08);
  color: #dcefff;
  line-height: 1.5;
}

.message.success {
  border-left-color: var(--success);
  background: rgba(66, 211, 146, 0.08);
  color: #d9ffed;
}

.message.error {
  border-left-color: var(--danger);
  background: rgba(255, 107, 114, 0.08);
  color: #ffdfe1;
}

.loading-view {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.account-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.account-section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

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

.account-section h3 {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
}

.account-section > p {
  margin: -0.4rem 0 1.25rem;
  color: var(--muted);
  line-height: 1.6;
}

.account-detail {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.account-detail strong {
  color: var(--success);
}

.portal-footer {
  width: min(100%, 580px);
  margin: 1.5rem auto 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.portal-footer a {
  text-decoration: none;
}

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

  .brand-panel,
  .portal-panel {
    min-height: auto;
  }

  .brand-panel {
    gap: 3rem;
    padding-bottom: 3rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-copy {
    margin: 1rem 0;
  }

  .brand-copy h1 {
    max-width: none;
  }

  .portal-panel {
    min-height: 65vh;
  }
}

@media (max-width: 560px) {
  .brand-panel,
  .portal-panel {
    padding: 1.25rem;
  }

  .portal-card {
    padding: 1.4rem;
  }

  .account-header {
    flex-direction: column;
  }

  .account-header .secondary-button {
    width: 100%;
  }

  .portal-footer {
    flex-direction: column;
  }
}

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


/* Version 4: secure account-deletion controls */
.danger-section h3 { color: #ff9b9f; }

.danger-outline-button,
.danger-button {
  min-height: 48px;
  padding: 0.8rem 1.15rem;
  border-radius: 0;
  font-weight: 800;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.danger-outline-button {
  border: 1px solid rgba(255, 107, 114, 0.5);
  background: rgba(255, 107, 114, 0.06);
  color: #ffdfe1;
}

.danger-outline-button:hover:not(:disabled) {
  border-color: var(--danger);
  background: rgba(255, 107, 114, 0.12);
}

.danger-button {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #210406;
}

.danger-button:hover:not(:disabled) { background: #ff858b; }

.danger-outline-button:active:not(:disabled),
.danger-button:active:not(:disabled) { transform: translateY(1px); }

.danger-outline-button:disabled,
.danger-button:disabled { cursor: wait; opacity: 0.65; }

.delete-account-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 107, 114, 0.25);
}

.danger-warning {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--danger);
  background: rgba(255, 107, 114, 0.08);
  color: #ffdfe1;
  line-height: 1.5;
}

.danger-warning span { color: #e9b9bc; }

.delete-actions {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) minmax(220px, 1.35fr);
  gap: 0.8rem;
}

@media (max-width: 560px) {
  .delete-actions { grid-template-columns: 1fr; }
}
