:root {
  --saffron: #c45c1f;
  --saffron-deep: #9a4518;
  --blue-rich: #0c2d5c;
  --blue-mid: #143d78;
  --pearl: #f7f5f0;
  --pearl-soft: #ebe7df;
  --jet: #0a0a0a;
  --jet-soft: #1a1a1a;
  --text-on-dark: rgba(247, 245, 240, 0.94);
  --text-muted-dark: rgba(247, 245, 240, 0.72);
  --text-on-light: #141414;
  --text-muted-light: #3d3d3d;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(10, 10, 10, 0.18);
  --font-display: "Cormorant Garamond", "Georgia", serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.dashboard-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-on-dark);
  background: linear-gradient(145deg, var(--blue-rich) 0%, var(--blue-mid) 48%, #0a1f3d 100%);
  position: relative;
}

.dashboard-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 85% 15%, rgba(196, 92, 31, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 50% at 10% 90%, rgba(247, 245, 240, 0.06), transparent 50%);
  z-index: 0;
}

.dashboard-body.dashboard-pending {
  visibility: hidden;
}

.dashboard-body.dashboard-ready {
  visibility: visible;
}

.dashboard-body > .skip-link,
.dashboard-body > .site-header,
.dashboard-body > .auth-modal,
.dashboard-body > .dashboard-frame,
.dashboard-body > .site-footer {
  position: relative;
  z-index: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  background: var(--jet);
  color: var(--pearl);
  z-index: 120;
  border-radius: 6px;
}

/* Header (aligned with marketing site, tuned for hero-like backdrop) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 29, 61, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(247, 245, 240, 0.12);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: var(--pearl);
  text-decoration: none;
}

.brand span {
  color: #e8925a;
}

.nav-links {
  display: flex;
  gap: 0.25rem 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--pearl);
  border-bottom-color: var(--saffron);
  outline: none;
}

.nav-links a.nav-links__current {
  color: var(--pearl);
  border-bottom-color: var(--saffron);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.auth-cluster {
  display: flex;
  align-items: center;
  gap: 0.35rem 0.5rem;
  flex-wrap: wrap;
}

.auth-cluster[hidden] {
  display: none !important;
}

.auth-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--pearl-soft);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.35rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--saffron);
  color: var(--pearl);
  box-shadow: 0 4px 14px rgba(196, 92, 31, 0.35);
}

.btn-primary:hover {
  background: var(--saffron-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--pearl-soft);
  border: 2px solid rgba(247, 245, 240, 0.35);
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
}

.btn-ghost:hover {
  border-color: var(--saffron);
  background: rgba(196, 92, 31, 0.12);
  transform: translateY(-1px);
}

.btn-dark {
  background: var(--jet);
  color: var(--pearl);
  box-shadow: 0 4px 14px rgba(10, 10, 10, 0.2);
}

.btn-dark:hover {
  background: #222;
  transform: translateY(-1px);
}

.modal-open {
  overflow: hidden;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(4px);
}

.auth-modal__dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--pearl);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(12, 45, 92, 0.1);
  padding: 1.5rem 1.5rem 1.75rem;
}

.auth-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.auth-modal__head h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0;
  color: var(--blue-rich);
  line-height: 1.2;
}

.modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(12, 45, 92, 0.08);
  color: var(--blue-rich);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.modal-close:hover {
  background: rgba(196, 92, 31, 0.15);
}

.auth-alert {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.92rem;
  margin-bottom: 1rem;
  line-height: 1.45;
}

.auth-alert[hidden] {
  display: none !important;
}

.auth-alert--error {
  background: rgba(196, 92, 31, 0.12);
  color: var(--saffron-deep);
  border: 1px solid rgba(196, 92, 31, 0.35);
}

.auth-alert--success {
  background: rgba(12, 45, 92, 0.08);
  color: var(--blue-rich);
  border: 1px solid rgba(12, 45, 92, 0.2);
}

.auth-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted-light);
  margin-bottom: 0.35rem;
}

.auth-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(12, 45, 92, 0.18);
  background: #fff;
  margin-bottom: 0.85rem;
}

.auth-form input:focus {
  outline: 2px solid var(--saffron);
  outline-offset: 0;
  border-color: transparent;
}

.auth-form .btn[type="submit"] {
  width: 100%;
  margin-top: 0.35rem;
}

.auth-form__row {
  display: flex;
  justify-content: flex-end;
  margin: -0.35rem 0 0.85rem;
}

.auth-form__row a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue-rich);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 92, 31, 0.45);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-muted-light);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(12, 45, 92, 0.12);
}

.btn-google {
  width: 100%;
  margin-top: 0.25rem;
  background: var(--pearl);
  color: var(--jet);
  border: 1px solid rgba(10, 10, 10, 0.14);
  box-shadow: none;
  font-weight: 600;
  gap: 0.5rem;
}

.btn-google:hover {
  background: var(--pearl-soft);
  transform: translateY(-1px);
}

.auth-switch {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--text-muted-light);
  text-align: center;
}

.auth-switch a {
  font-weight: 700;
  color: var(--blue-rich);
  text-decoration: none;
  border-bottom: 1px solid rgba(196, 92, 31, 0.45);
}

/* Shell */
.dashboard-frame {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.dashboard-sidebar {
  width: 230px;
  flex-shrink: 0;
  position: sticky;
  top: 5.25rem;
  align-self: flex-start;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(10, 10, 10, 0.28);
  border: 1px solid rgba(247, 245, 240, 0.14);
}

.dashboard-sidebar__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted-dark);
  margin: 0 0 0.75rem;
}

.dashboard-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dashboard-sidebar a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.96rem;
  border-left: 3px solid transparent;
}

.dashboard-sidebar a:hover,
.dashboard-sidebar a:focus-visible {
  background: rgba(247, 245, 240, 0.08);
  outline: none;
}

.dashboard-sidebar a[aria-current="page"] {
  background: rgba(196, 92, 31, 0.28);
  border-left-color: var(--saffron);
  color: var(--pearl);
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius);
  background: rgba(10, 10, 10, 0.22);
  border: 1px solid rgba(247, 245, 240, 0.12);
  box-shadow: var(--shadow);
}

.dashboard-main h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin: 0 0 0.75rem;
  color: var(--pearl);
  line-height: 1.15;
}

.dashboard-main .dashboard-lead {
  margin: 0 0 1.25rem;
  color: var(--text-muted-dark);
  font-size: 1.05rem;
}

.dashboard-panel {
  padding: 1rem 0;
  border-top: 1px solid rgba(247, 245, 240, 0.12);
}

.dashboard-panel:first-of-type {
  border-top: none;
  padding-top: 0;
}

.site-footer {
  background: var(--jet);
  color: var(--text-muted-dark);
  padding: 2.5rem 1.5rem;
  font-size: 0.9rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.site-footer a {
  color: var(--pearl-soft);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--pearl);
}

@media (max-width: 820px) {
  .dashboard-frame {
    flex-direction: column;
  }

  .dashboard-sidebar {
    width: 100%;
    position: static;
  }

  .dashboard-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .dashboard-sidebar a {
    flex: 1 1 auto;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .dashboard-sidebar a[aria-current="page"] {
    border-left-color: transparent;
    border-bottom-color: var(--saffron);
  }
}

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