/* ============================================================
   Propositum Wealth Management — Internal Tools
   Shared stylesheet. Editorial finance aesthetic:
   deep navy ink, warm heritage gold, Bodoni serif display,
   Manrope sans body.
   ============================================================ */

:root {
  --navy-900: #0a1f3c;
  --navy-800: #0f2c52;   /* brand navy */
  --navy-700: #16395f;
  --navy-600: #1f486f;
  --gold-500: #b8922a;   /* brand gold */
  --gold-400: #cba94a;
  --gold-300: #e0c878;
  --paper:    #f7f5f0;   /* warm off-white */
  --paper-2:  #efece4;
  --ink:      #14202e;
  --white:    #ffffff;

  --line-on-dark:  rgba(184, 146, 42, 0.35);
  --line-on-light: rgba(15, 44, 82, 0.12);
  --hairline:      rgba(255, 255, 255, 0.10);

  --shadow-sm: 0 1px 2px rgba(10, 31, 60, 0.06);
  --shadow-md: 0 10px 30px rgba(10, 31, 60, 0.10);
  --shadow-lg: 0 24px 60px rgba(10, 31, 60, 0.18);

  --serif: "Bodoni Moda", "Didot", "Bodoni 72", "Times New Roman", serif;
  --sans:  "Manrope", "Helvetica Neue", "Segoe UI", sans-serif;

  --maxw: 1120px;
  --radius: 4px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0 0 .5em; color: var(--navy-800); }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: .3px; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.15rem; letter-spacing: .2px; }
p  { margin: 0 0 1rem; }

.eyebrow {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin: 0 0 .9rem;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; padding: 40px 0 72px; }
.section { margin-top: 40px; }
.muted { color: rgba(20, 32, 46, 0.62); }
.center { text-align: center; }

/* ============================================================
   Brand header / nav
   ============================================================ */
.site-header {
  background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: var(--white);
  border-bottom: 1px solid var(--line-on-dark);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding-top: 18px; padding-bottom: 18px;
}

/* Brand lockup (inline, font-rendered so it is crisp at any size) */
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--white); }
.brand__mark { width: 38px; height: 46px; flex: 0 0 auto; }
.brand__mark polygon { stroke: var(--gold-500); }
.brand__mark text { fill: var(--white); font-family: var(--serif); }
.brand__type { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--white);
}
.brand__sub {
  font-family: var(--sans);
  font-size: .56rem;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-top: 5px;
}

.back-link {
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--gold-300);
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 4px;
  transition: color .15s ease;
}
.back-link:hover { color: var(--white); }

.header-tag {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold-400);
  white-space: nowrap;
}

/* ---------- Page intro band ---------- */
.page-intro { padding: 8px 0 4px; }
.page-intro h1 { margin-bottom: .25em; }
.page-intro p { max-width: 64ch; color: rgba(20, 32, 46, 0.66); }
.rule {
  width: 64px; height: 2px; background: var(--gold-500);
  margin: 18px 0 0; border: 0;
}

/* ============================================================
   Tool selector hub (index)
   ============================================================ */
.hub-hero { padding: 56px 0 8px; text-align: center; }
.hub-hero .rule { margin-left: auto; margin-right: auto; }
.hub-hero p { max-width: 56ch; margin-left: auto; margin-right: auto; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 40px;
}
.tile {
  position: relative;
  display: flex; flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line-on-light);
  border-radius: var(--radius);
  padding: 30px 30px 28px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}
.tile::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--gold-500);
  transform: scaleY(0); transform-origin: top;
  transition: transform .22s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(184,146,42,.45); }
.tile:hover::before { transform: scaleY(1); }
.tile:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 3px; }
.tile__icon {
  width: 44px; height: 44px; margin-bottom: 18px;
  color: var(--navy-800);
}
.tile__icon svg { width: 100%; height: 100%; }
.tile__name { font-family: var(--serif); font-size: 1.35rem; color: var(--navy-800); margin: 0 0 .35em; }
.tile__desc { font-size: .92rem; color: rgba(20,32,46,.64); margin: 0; }
.tile__go {
  margin-top: 18px; font-family: var(--sans); font-size: .78rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-500);
  display: inline-flex; align-items: center; gap: 7px;
}
.tile__go svg { width: 16px; height: 16px; transition: transform .18s ease; }
.tile:hover .tile__go svg { transform: translateX(4px); }

/* ============================================================
   Cards / panels
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--line-on-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}
.card + .card { margin-top: 24px; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card__head h2, .card__head h3 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.grid-2-wide { display: grid; grid-template-columns: 0.95fr 1.05fr; gap: 26px; align-items: start; }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
label, .label {
  display: block;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--navy-700);
  margin-bottom: 7px;
}
.label-note { font-weight: 500; text-transform: none; letter-spacing: 0; color: rgba(20,32,46,.5); font-size: .82rem; margin-left: 6px; }

input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="password"],
select, textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-on-light);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(184,146,42,.16);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230f2c52' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; top: 50%; transform: translateY(-50%); color: rgba(20,32,46,.5); font-size: .9rem; pointer-events: none; }
.input-affix .affix-left { left: 13px; }
.input-affix .affix-right { right: 13px; }
.input-affix input.has-left { padding-left: 28px; }
.input-affix input.has-right { padding-right: 34px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--sans); font-size: .82rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 13px 26px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform .12s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-800); color: var(--white); border-color: var(--navy-800); }
.btn-primary:hover { background: var(--navy-900); box-shadow: var(--shadow-md); }
.btn-gold { background: var(--gold-500); color: var(--navy-900); border-color: var(--gold-500); }
.btn-gold:hover { background: var(--gold-400); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--navy-800); border-color: var(--line-on-light); }
.btn-ghost:hover { border-color: var(--gold-500); color: var(--gold-500); }
.btn-sm { padding: 8px 14px; font-size: .72rem; }
.btn:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }

/* ---------- Mode toggle (segmented) ---------- */
.segmented {
  display: inline-flex; background: var(--paper-2);
  border: 1px solid var(--line-on-light); border-radius: 999px; padding: 4px;
}
.segmented { flex: 0 0 auto; }
.segmented button {
  font-family: var(--sans); font-size: .78rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  border: 0; background: transparent; color: var(--navy-700);
  padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: all .15s ease;
}
.segmented button[aria-pressed="true"] { background: var(--navy-800); color: var(--white); box-shadow: var(--shadow-sm); }

/* ============================================================
   Tables
   ============================================================ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
table.data caption { text-align: left; font-size: .78rem; color: rgba(20,32,46,.55); margin-bottom: 8px; }
table.data th, table.data td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line-on-light); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  font-family: var(--sans); font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--navy-700);
  border-bottom: 1.5px solid var(--gold-500);
}
table.data tbody tr:hover { background: rgba(184,146,42,.05); }
table.data tfoot td { font-weight: 700; color: var(--navy-800); border-top: 1.5px solid var(--line-on-light); border-bottom: none; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: #1d6b3f; }
.neg { color: #a32b2b; }

/* Matrix table (correlation) */
table.matrix { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.matrix th, table.matrix td { padding: 6px; text-align: center; border: 1px solid var(--line-on-light); }
table.matrix thead th, table.matrix tbody th { background: var(--paper-2); font-family: var(--sans); font-size: .76rem; font-weight: 700; color: var(--navy-700); }
table.matrix input { text-align: center; padding: 7px 4px; }
table.matrix td.diag input { background: var(--paper-2); color: rgba(20,32,46,.5); }

/* ---------- Stat / result blocks ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat {
  background: var(--paper); border: 1px solid var(--line-on-light);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat__label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-500); margin: 0 0 6px; line-height: 1.3; min-height: 2.6em; }
.stat__value { font-family: var(--serif); font-size: 1.7rem; color: var(--navy-800); line-height: 1; }
.stat__hint { font-size: .8rem; color: rgba(20,32,46,.55); margin-top: 6px; }

/* ---------- Chart ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100% !important; }

/* ---------- Dynamic asset rows ---------- */
.asset-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.asset-row .field { margin-bottom: 0; }
.icon-btn {
  width: 40px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-on-light); background: var(--white); border-radius: var(--radius);
  cursor: pointer; color: var(--navy-700); transition: all .15s ease;
}
.icon-btn:hover { border-color: #a32b2b; color: #a32b2b; }

/* ============================================================
   Disclaimer / compliance
   ============================================================ */
.disclaimer {
  border: 1px solid var(--line-on-light);
  border-left: 3px solid var(--gold-500);
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: .85rem;
  color: rgba(20,32,46,.72);
}
.disclaimer strong { color: var(--navy-800); }
.disclaimer--inline { margin-top: 22px; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--navy-900);
  color: rgba(255,255,255,.72);
  border-top: 1px solid var(--line-on-dark);
  font-size: .8rem;
  flex-shrink: 0;
}
.site-footer .wrap { padding-top: 30px; padding-bottom: 30px; }
.footer-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.footer-top .brand__name { font-size: 1.05rem; }
.footer-disclaimer { max-width: 90ch; line-height: 1.55; color: rgba(255,255,255,.6); }
.footer-meta { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); display: flex; flex-wrap: wrap; gap: 6px 18px; color: rgba(255,255,255,.45); font-size: .74rem; }

/* ---------- Helpers ---------- */
.hidden { display: none !important; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.small { font-size: .82rem; }
.tag {
  display: inline-block; font-family: var(--sans); font-size: .68rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold-500);
  border: 1px solid var(--line-on-light); border-radius: 999px; padding: 3px 11px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .grid-2, .grid-2-wide { grid-template-columns: 1fr; }
  .tile-grid { grid-template-columns: 1fr; gap: 16px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .asset-row { grid-template-columns: 1fr 1fr; }
  .asset-row .icon-btn { grid-column: 2; justify-self: end; }
}
@media (max-width: 560px) {
  .site-header .wrap { flex-wrap: wrap; gap: 10px; }
  .brand__sub { display: none; }
  main { padding-top: 28px; }
  .card { padding: 20px; }
}

/* ============================================================
   Auth gate + sign-out + login page
   ============================================================ */
/* Hide protected pages until sign-in is confirmed (no content flash). */
html.gate-pending body { visibility: hidden; }

.header-actions { display: flex; align-items: center; gap: 18px; }
.signout-btn {
  font-family: var(--sans); font-size: .78rem; font-weight: 700;
  letter-spacing: .04em; color: var(--gold-300);
  background: transparent; border: 0; cursor: pointer;
  padding: 8px 4px; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; transition: color .15s ease;
}
.signout-btn:hover { color: var(--white); }
.signout-btn svg { width: 15px; height: 15px; }

/* ---- Login page ---- */
.login-body {
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(184,146,42,.10), transparent 60%),
    linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 60%, #07172e 100%);
  min-height: 100vh;
}
.login-shell {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: rgba(13, 33, 60, 0.66);
  border: 1px solid var(--line-on-dark);
  border-radius: 8px;
  padding: 38px 34px 30px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-mark { width: 40px; height: 48px; margin: 0 auto 12px; }
.login-word { font-family: var(--serif); font-size: 1.45rem; letter-spacing: .14em; color: var(--white); }
.login-sub { font-family: var(--sans); font-size: .56rem; font-weight: 600; letter-spacing: .34em; text-transform: uppercase; color: var(--gold-400); margin-top: 6px; }

.login-card .login-label { color: rgba(255,255,255,.78); }
.login-card input[type="email"], .login-card input[type="password"] {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.16);
  color: var(--white);
}
.login-card input[type="email"]::placeholder, .login-card input[type="password"]::placeholder { color: rgba(255,255,255,.4); }
.login-card input[type="email"]:focus, .login-card input[type="password"]:focus {
  background: rgba(255,255,255,.10);
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(184,146,42,.22);
}
.login-remember {
  display: flex; align-items: center; gap: 9px; margin: 4px 0 20px;
  font-family: var(--sans); font-size: .82rem; font-weight: 500;
  letter-spacing: 0; text-transform: none; color: rgba(255,255,255,.7); cursor: pointer;
}
.login-remember input { width: 16px; height: 16px; accent-color: var(--gold-500); cursor: pointer; }
.login-error {
  background: rgba(163,43,43,.18); border: 1px solid rgba(214,120,120,.5);
  color: #f1c9c9; border-radius: var(--radius); padding: 11px 14px;
  font-size: .85rem; margin-bottom: 18px;
}
.login-foot { margin: 22px 0 0; font-size: .74rem; line-height: 1.5; color: rgba(255,255,255,.42); text-align: center; }
.login-copyright { margin-top: 22px; font-size: .72rem; letter-spacing: .06em; color: rgba(255,255,255,.34); }

/* ---------- Print (so generated previews print cleanly) ---------- */
@media print {
  .site-header, .site-footer, .btn-row, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
