:root {
  color-scheme: light;
  --ink: #302a24;
  --muted: #746d63;
  --canvas: #eee7dc;
  --paper: #fffaf1;
  --paper-2: #f6eee2;
  --line: #d8cbb9;
  --brown: #40342a;
  --gold: #9b7747;
  --green: #4f6f5c;
  --danger: #9a4e42;
  --shadow: 0 24px 70px rgba(55, 43, 34, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); }
.story {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #f1e7d7;
}
.story::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("family-engraving.webp") 68% center / cover no-repeat;
}
.story::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(247,240,228,.98) 0%, rgba(247,240,228,.91) 32%, rgba(247,240,228,.44) 56%, rgba(247,240,228,.03) 82%), linear-gradient(0deg, rgba(226,210,187,.76), transparent 34%);
}
.brand { display: flex; align-items: center; gap: 12px; }
.seal { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(64,52,42,.42); border-radius: 50%; color: var(--gold); font: 500 1rem Georgia, serif; }
.wordmark { letter-spacing: .16em; font-weight: 600; }
.submark { display: block; margin-top: 3px; color: rgba(64,52,42,.64); font-size: .78rem; letter-spacing: .03em; }
.story-copy { max-width: 410px; }
.lineage { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--gold); font-size: .86rem; letter-spacing: .03em; }
.lineage::before { content: ""; width: 44px; height: 1px; background: currentColor; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; color: var(--brown); }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1.03; }
h2 { font-size: clamp(1.8rem, 3vw, 2.45rem); }
h3 { margin: 0; font-size: 1rem; }
p { line-height: 1.6; }
.story-copy p { max-width: 380px; color: rgba(63,53,44,.78); }
.signoff { color: rgba(63,53,44,.7); font-size: .82rem; line-height: 1.55; }
.signoff a { color: var(--brown); }

.auth-panel { min-height: 100vh; padding: 42px; display: grid; place-items: center; background: var(--paper); }
.auth-card { width: min(100%, 400px); }
.eyebrow { margin-bottom: 10px; color: var(--gold); font-size: .78rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.lead { margin: 14px 0 28px; color: var(--muted); }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
label { font-size: .9rem; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 12px 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(155,119,71,.14); }
textarea { min-height: 125px; resize: vertical; }
.button { min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; font-weight: 650; }
.button:hover { border-color: var(--gold); }
.button-primary { background: var(--brown); color: #fffaf1; border-color: var(--brown); }
.button-quiet { min-height: 36px; padding: 7px 10px; background: transparent; color: var(--muted); }
.button-block { width: 100%; }
.auth-note { margin-top: 18px; color: var(--muted); font-size: .86rem; text-align: center; }
.totp-qr { display: block; width: min(100%, 280px); margin: 22px auto 16px; border-radius: 10px; background: white; padding: 10px; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 22px 0; }
.otp input { min-width: 0; padding: 13px 3px; text-align: center; font-size: 1.1rem; }
.auth-actions { display: grid; gap: 9px; }

.portal { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { padding: 28px 20px; display: flex; flex-direction: column; gap: 30px; color: #f7f0e4; background: var(--brown); }
.sidebar .seal { border-color: rgba(255,255,255,.42); }
.sidebar .submark { color: rgba(255,255,255,.62); }
.nav { display: grid; gap: 6px; }
.nav button { width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: rgba(255,255,255,.74); background: transparent; text-align: left; cursor: pointer; }
.nav button:hover, .nav button[aria-current="page"] { color: #fff; background: rgba(255,255,255,.11); }
.sidebar-note { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.17); color: rgba(255,255,255,.66); font-size: .82rem; line-height: 1.55; }
.workspace { min-width: 0; }
.topbar { min-height: 72px; padding: 14px clamp(18px, 4vw, 34px); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-title { color: var(--muted); }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #eadcca; color: var(--brown); font-weight: 700; }
.content { padding: clamp(22px, 4vw, 38px); }
.page-head { margin-bottom: 26px; }
.page-head p { max-width: 720px; margin: 9px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card { padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(55,43,34,.05); }
.card-wide { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: #eee2cf; color: #75572f; font-size: .75rem; font-weight: 700; }
.muted { color: var(--muted); }
.doc-list, .people, .apps { display: grid; gap: 10px; }
.doc, .person, .app-item { padding: 15px; display: flex; justify-content: space-between; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.doc p, .person p, .app-item p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.person-main { display: flex; align-items: center; gap: 12px; }
.person-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-2); color: var(--gold); font-weight: 700; }
.proposal { max-width: 820px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.status { min-height: 24px; margin-top: 12px; color: var(--green); font-weight: 650; }
.status-error { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #d8b8ac; border-radius: 8px; background: #fff4ef; color: #8b3d2f; }
.footer { margin: 26px clamp(22px, 4vw, 38px); padding-top: 18px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.mobile-menu { display: none; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .story { min-height: 560px; }
  .auth-panel { min-height: auto; }
  .portal { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-menu { display: block; }
  .topbar { flex-wrap: wrap; }
  .mobile-nav { width: 100%; display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
  .mobile-nav button { white-space: nowrap; }
}

@media (max-width: 620px) {
  .story { min-height: 500px; padding: 24px; }
  .story::after { background-position: 70% center; }
  .story-copy { max-width: 75%; }
  .auth-panel { padding: 34px 22px; }
  .grid, .form-grid { grid-template-columns: 1fr; }
  .card-wide, .form-wide { grid-column: auto; }
  .doc, .person, .app-item { align-items: flex-start; flex-direction: column; }
}
