/* Estate Untangled — shared app styles
   Palette and fonts match the marketing site (estateuntangled.com). */

:root {
  --navy: #1a2a3a;
  --navy-deep: #101b27;
  --parchment: #efe8d8;
  --parchment-light: #f7f3e9;
  --brass: #a9822f;
  --brass-light: #c9a857;
  --sage: #5c7a5e;
  --rust: #9c4530;
  --ink: #22201a;
  --paper-text: #2a2620;
  --cream-text: #f2eee2;
  --purple: #7a6a9e;
  --line: rgba(169, 130, 47, 0.35);
  --bg: var(--parchment-light);
  --surface: #ffffff;
  --text: var(--paper-text);
  --text-dim: #6a6556;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--navy-deep);
    --surface: #182635;
    --text: var(--cream-text);
    --text-dim: #b8b2a0;
    --line: rgba(201, 168, 87, 0.28);
  }

}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Source Sans 3", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

header.masthead {
  background: var(--navy);
  color: var(--cream-text);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.masthead a.brand {
  font-family: "Fraunces", serif;
  font-weight: 600;
  color: var(--cream-text);
  text-decoration: none;
  font-size: 1.1rem;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

/* The "untangling swoosh" — an asymmetric, tapered stroke under the
   wordmark: thick near "Estate," tapering to a point past "Untangled,"
   like something being pulled straight in one motion. */
header.masthead a.brand::after {
  content: "";
  display: block;
  width: 128px;
  height: 11px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20224%2020%22%3E%3Cpath%20d%3D%22M2%2015%20C%2060%2025%2C%20160%2022%2C%20222%203%20C%20168%2013%2C%2088%2018%2C%202%2015%20Z%22%20fill%3D%22%23C9A857%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* A quiet "you are here" tag next to the logo — small and dimmed so it
   reads as a location label, not another nav item competing with "How it
   works" / "Sign out". Used as a static span on the dashboard itself, and
   as the back-to-dashboard link on every guided-flow topic page — same
   class either way, so the two never drift apart in font/color again. */
.masthead-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.masthead-page-tag {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  color: rgba(216, 210, 194, 0.55);
  padding-left: 14px;
  border-left: 1px solid rgba(216, 210, 194, 0.25);
  text-decoration: none;
}

a.masthead-page-tag:hover {
  color: var(--brass-light);
}

header.masthead nav a,
header.masthead button.link {
  color: #d8d2c2;
  text-decoration: none;
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

header.masthead nav a:hover,
header.masthead button.link:hover {
  color: var(--brass-light);
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

main.dashboard {
  display: block;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 56px 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--brass);
  border-radius: 10px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  position: relative;
  box-shadow: 0 2px 14px rgba(16, 27, 39, 0.06);
}

@media (prefers-color-scheme: dark) {
  .card {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}

.card h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.card p.dek {
  color: var(--text-dim);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-top: 18px;
}

label:first-of-type {
  margin-top: 0;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

select:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

input[type="file"] {
  width: 100%;
  font-size: 0.88rem;
  color: var(--text-dim);
}

button.primary {
  width: 100%;
  margin-top: 26px;
  padding: 12px;
  background: var(--navy);
  color: var(--cream-text);
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover {
  background: var(--navy-deep);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.switch-link {
  margin-top: 22px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.switch-link a {
  color: var(--brass);
  text-decoration: none;
  font-weight: 600;
}

.message {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  display: none;
}

.message.error {
  background: rgba(156, 69, 48, 0.12);
  color: var(--rust);
  border: 1px solid rgba(156, 69, 48, 0.3);
}

.message.success {
  background: rgba(92, 122, 94, 0.12);
  color: var(--sage);
  border: 1px solid rgba(92, 122, 94, 0.3);
}

.message.visible {
  display: block;
}

.dashboard .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  display: block;
  margin-bottom: 8px;
}

/* ---- Dashboard welcome zone (a warmer, more personal top-of-page than
   an admin panel — a big version of the wordmark and the greeting,
   centered). The "Dashboard" location label and the signed-in email
   both used to live here; both were moved out — the label now sits as
   a quiet tag next to the logo in the masthead (see .masthead-page-tag
   above), and the email was dropped entirely as unnecessary clutter
   once the greeting already names the person. */

.dashboard-welcome {
  text-align: center;
  margin-bottom: 12px;
}

.dashboard-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

.dashboard-brand-word {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 2.1rem;
  color: var(--text);
}

/* Same swoosh asset as the small header wordmark (header.masthead
   a.brand::after) — just scaled up, so the big and small versions read
   as the same mark rather than two different logos. */
.dashboard-brand-swoosh {
  display: block;
  width: 210px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20224%2020%22%3E%3Cpath%20d%3D%22M2%2015%20C%2060%2025%2C%20160%2022%2C%20222%203%20C%20168%2013%2C%2088%2018%2C%202%2015%20Z%22%20fill%3D%22%23C9A857%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Inline "what should we call you?" prompt shown instead of a name, for
   accounts that don't have one saved yet (created before signup asked
   for a name). Deliberately minimal — an underline-only input rather
   than a boxed form field — so it reads as part of the greeting, not
   as a separate settings form. */
.dashboard-name-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.dashboard-name-prompt input[type="text"] {
  width: 220px;
  padding: 4px 2px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.92rem;
}

.dashboard-name-prompt input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--brass);
}

.dashboard-name-prompt button {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brass);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
}

.dashboard-name-prompt button:hover {
  color: var(--brass-light);
}

/* ---- App footer (dashboard.html) — a quiet navy band matching the
   marketing site's footer treatment, mostly branding, with "Manage
   billing" tucked in rather than sitting in clear view up top. ---- */

.app-footer {
  background: var(--navy-deep);
  padding: 28px 20px;
  margin-top: 48px;
}

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

.app-footer-inner > span {
  color: #8a8474;
  font-size: 0.85rem;
}

.app-footer-link {
  background: none;
  border: none;
  color: #8a8474;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.app-footer-link:hover {
  color: var(--brass-light);
}

.dashboard .surface-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--brass);
  border-radius: 10px;
  padding: 28px;
  margin-top: 28px;
  position: relative;
  box-shadow: 0 2px 14px rgba(16, 27, 39, 0.06);
}

@media (prefers-color-scheme: dark) {
  .dashboard .surface-block {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  }
}

.dashboard .surface-block p {
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* Guided-setup topic rows on the dashboard — a small welcoming nudge on
   hover, set by dashboard.html's renderTopicsList(). */
.topic-row {
  transition: padding-left 0.15s ease;
}

.topic-row:hover {
  padding-left: 6px;
}

/* ---- Per-topic icons ----
   Small line icons from assets/topic-icons.js, tinted via the same
   brass/sage/rust/purple rotation as the accent rules below. Icons use
   stroke="currentColor" internally, so tinting is just a `color` rule. */

.topic-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brass);
}

.topic-icon svg {
  width: 100%;
  height: 100%;
}

.topic-icon-sage {
  color: var(--sage);
}

.topic-icon-rust {
  color: var(--rust);
}

.topic-icon-purple {
  color: var(--purple);
}

/* Larger circular badge version, used on each topic's intro screen. */
.topic-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: var(--brass);
  color: var(--cream-text);
}

.topic-badge svg {
  width: 26px;
  height: 26px;
}

.topic-badge-sage {
  background: var(--sage);
}

.topic-badge-rust {
  background: var(--rust);
}

.topic-badge-purple {
  background: var(--purple);
}

/* ---- Per-topic accent colors ----
   guided-flow.js sets document.body.dataset.topic on each topic page, so
   the question card's top border and progress bar pick up a color from
   the same brass/sage/rust/purple rotation used on the marketing site's
   hero "folder tabs" — each topic feels a little more distinct without
   abandoning the shared, understated look. Only 4 colors for 7 topics,
   so two topics do share a color each (property/legal, financial/wishes)
   — that's by design, not a bug, mirroring the homepage's 4-color rotation. */
body[data-topic="property"] .card,
body[data-topic="legal"] .card {
  border-top-color: var(--sage);
}

body[data-topic="financial"] .card,
body[data-topic="wishes"] .card {
  border-top-color: var(--rust);
}

body[data-topic="insurance"] .card {
  border-top-color: var(--purple);
}

body[data-topic="property"] .progress-fill,
body[data-topic="legal"] .progress-fill {
  background: var(--sage);
}

body[data-topic="financial"] .progress-fill,
body[data-topic="wishes"] .progress-fill {
  background: var(--rust);
}

body[data-topic="insurance"] .progress-fill {
  background: var(--purple);
}

/* ---- Guided question flow (trusted contact, and later topics) ---- */

.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brass);
  border-radius: 2px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.badge-required,
.badge-encrypted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  margin-right: 8px;
}

.badge-required {
  background: rgba(156, 69, 48, 0.1);
  color: var(--rust);
  border: 1px solid rgba(156, 69, 48, 0.28);
}

.badge-encrypted {
  background: rgba(92, 122, 94, 0.12);
  color: var(--sage);
  border: 1px solid rgba(92, 122, 94, 0.3);
}

.choice-row {
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.choice-row:hover {
  border-color: var(--brass);
}

.choice-row.selected {
  border-color: var(--brass);
  background: #faf3e4;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .choice-row.selected {
    background: rgba(201, 168, 87, 0.14);
  }

  /* Headings and choice options default to --ink (a near-black, meant for
     the light parchment background) — on the dark surface/bg colors above
     that reads as almost invisible. Repoint both to --text, which already
     tracks light/dark correctly. This has to come after the unconditional
     h1/h2/h3 and .choice-row rules above, since equal-specificity rules
     are resolved by source order, not by media-query nesting. */
  h1, h2, h3 {
    color: var(--text);
  }

  .choice-row {
    color: var(--text);
  }
}

.field-error {
  color: var(--rust);
  font-size: 0.85rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-error.hidden {
  display: none;
}

input.has-error,
textarea.has-error {
  border-color: var(--rust) !important;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-btn:hover {
  color: var(--brass);
}

.skip-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.skip-btn:hover {
  color: var(--rust);
}

button.primary.inline {
  width: auto;
  margin-top: 0;
}

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

/* ---- Vault (read-only view of everything stored) ---- */

.dashboard-cta-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 13px;
  border-radius: 6px;
  background: var(--navy);
  color: var(--cream-text);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease;
}

.dashboard-cta-btn:hover {
  background: var(--navy-deep);
}

.vault-topic {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.vault-topic:last-child {
  border-bottom: none;
}

.vault-topic-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.vault-topic-head h3 {
  font-size: 1.05rem;
}

.vault-qa {
  margin-top: 16px;
}

.vault-qa:first-of-type {
  margin-top: 0;
}

.vault-q {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.vault-a {
  color: var(--ink);
  font-size: 0.96rem;
}

@media (prefers-color-scheme: dark) {
  .vault-a {
    color: var(--text);
  }
}

.vault-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-style: italic;
}

.vault-finish-link {
  display: inline-block;
  margin-top: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--brass);
  text-decoration: none;
}

.vault-finish-link:hover {
  color: var(--brass-light);
}

.doc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.doc-row:last-child {
  border-bottom: none;
}

.doc-name {
  font-weight: 600;
}

.doc-meta {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 2px;
}

.doc-download {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--brass);
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.doc-download:hover {
  color: var(--brass-light);
  border-color: var(--brass-light);
}

.doc-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.doc-remove {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
}

.doc-remove:hover {
  color: var(--rust);
  border-color: var(--rust);
}

.upload-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 22px;
  background: var(--bg);
}

.vault-note {
  margin-top: 32px;
  padding: 20px 22px;
  background: rgba(92, 122, 94, 0.08);
  border: 1px solid rgba(92, 122, 94, 0.25);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
}
