:root {
  --ink: #f7f2e7;
  --paper: #0d1718;
  --paper-deep: #091011;
  --panel: #132324;
  --panel-soft: #172a2a;
  --muted: rgba(247, 242, 231, 0.64);
  --line: rgba(247, 242, 231, 0.16);
  --gold: #c5944f;
  --gold-light: #e3ba7b;
  --danger: #efae9d;
}

* { box-sizing: border-box; }

html { background: var(--paper-deep); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input { font: inherit; }

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 72px;
  padding: 12px clamp(20px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
}

.site-brand img { display: block; width: 132px; height: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-nav a { text-decoration: none; }
.site-nav a:hover, .site-nav .is-current { color: var(--ink); }

.account-shell {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 72px - 74px);
  margin: 0 auto;
  padding: clamp(56px, 10vw, 128px) 0 84px;
}

.auth-panel { width: min(100%, 520px); margin: 0 auto; }

.section-kicker {
  margin: 0 0 14px;
  color: var(--gold-light);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2 { font-family: Literata, Georgia, serif; font-weight: 500; }

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.7rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.auth-intro {
  max-width: 430px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.auth-form { display: grid; gap: 12px; margin-top: 38px; }

.auth-form label { font-size: 0.86rem; font-weight: 600; }

.auth-form input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: rgba(247, 242, 231, 0.05);
}

.auth-form input::placeholder { color: rgba(247, 242, 231, 0.38); }
.auth-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197, 148, 79, 0.18); }
#code { max-width: 220px; font-size: 1.22rem; letter-spacing: 0.18em; text-align: center; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:disabled { cursor: wait; opacity: 0.62; }
.button-primary { color: #1b140b; background: var(--gold); }
.button-primary:hover:not(:disabled) { background: var(--gold-light); }
.button-secondary { color: var(--ink); border-color: var(--line); background: transparent; }
.button-secondary:hover:not(:disabled) { border-color: rgba(247, 242, 231, 0.46); }

.auth-form .button { width: max-content; margin-top: 8px; }

.notice {
  margin-top: 28px;
  padding: 12px 14px;
  border-left: 2px solid var(--gold);
  color: var(--ink);
  background: rgba(197, 148, 79, 0.12);
  font-size: 0.93rem;
}

.notice.is-error { border-color: var(--danger); color: var(--danger); background: rgba(239, 174, 157, 0.1); }
.form-caption, .form-help { margin: 0; color: var(--muted); }
.form-caption strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.form-help { font-size: 0.86rem; }

.text-button {
  width: max-content;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover { color: var(--ink); }

.privacy-note { margin: 38px 0 0; color: var(--muted); font-size: 0.78rem; }
.privacy-note a:hover { color: var(--ink); }

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line);
}

.dashboard-heading h1 { font-size: clamp(2.5rem, 5vw, 4.2rem); }
.user-email { margin: 14px 0 0; color: var(--muted); }

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.account-section {
  min-height: 250px;
  padding: clamp(24px, 4vw, 42px);
  background: var(--panel);
}

.account-section p:not(.section-kicker) { max-width: 380px; margin: 26px 0 0; color: var(--muted); }
.section-heading h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.14; }
.charts-section { grid-column: span 2; min-height: 280px; background: var(--panel-soft); }
.empty-state { margin-top: 38px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.empty-state p { margin: 0 !important; color: var(--ink) !important; }
.empty-state span { display: block; margin-top: 7px; color: var(--muted); font-size: 0.9rem; }

.account-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px clamp(20px, 4vw, 58px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--paper-deep);
  font-size: 0.8rem;
}

.account-footer p { margin: 0; }
.account-footer a { color: var(--muted); }
.account-footer a:hover { color: var(--ink); }

@media (max-width: 680px) {
  .site-header { min-height: 62px; padding-inline: 18px; }
  .site-brand img { width: 114px; }
  .site-nav { gap: 14px; font-size: 0.78rem; }
  .site-nav a:first-child { display: none; }
  .account-shell { width: min(100% - 32px, 1120px); min-height: calc(100vh - 62px - 70px); padding-top: 62px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; padding-bottom: 30px; }
  .account-grid { grid-template-columns: 1fr; }
  .charts-section { grid-column: auto; }
  .account-section { min-height: 0; }
  .account-footer { padding-inline: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
