:root {
  --ink: #18211d;
  --muted: #647069;
  --paper: #f2efe7;
  --white: #fffdf8;
  --line: #d7d2c7;
  --forest: #14251f;
  --forest-2: #20372e;
  --blue: #244b5a;
  --gold: #caa15a;
  --rust: #9b493a;
  --sage: #dfe5dc;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold); }
.eyebrow { margin: 0 0 11px; color: #6f825f; font-size: 9px; font-weight: 800; letter-spacing: .17em; }

.access-gate { min-height: 100vh; padding: 90px max(30px, 7vw) 55px; display: grid; grid-template-columns: minmax(380px, 1.15fr) minmax(360px, .85fr); gap: 90px; align-items: center; position: relative; overflow: hidden; background: var(--forest); color: var(--white); }
.access-gate:after { content: "DJ"; position: absolute; left: 5vw; bottom: 18px; color: rgba(255,255,255,.035); font: 400 220px/.8 Iowan Old Style, Baskerville, Georgia, serif; pointer-events: none; }
.gate-brand { position: absolute; top: 30px; left: max(30px, 7vw); z-index: 2; display: flex; align-items: center; gap: 12px; }
.gate-brand > span, .brand > span { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid currentColor; font-size: 9px; font-weight: 800; }
.gate-brand strong, .gate-brand small, .brand strong, .brand small { display: block; }
.gate-brand strong { font-size: 13px; }
.gate-brand small { margin-top: 3px; color: #aebcb4; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.gate-story { max-width: 760px; position: relative; z-index: 1; }
.gate-story .eyebrow { color: #b7c8bb; }
.gate-story h1 { max-width: 720px; margin: 0; font: 400 62px/.98 Iowan Old Style, Baskerville, Georgia, serif; }
.gate-story > p:not(.eyebrow) { max-width: 590px; margin: 25px 0 38px; color: #bdc9c2; font: 400 18px/1.5 Iowan Old Style, Georgia, serif; }
.gate-story dl { max-width: 620px; margin: 0; border-top: 1px solid rgba(255,255,255,.18); }
.gate-story dl div { padding: 12px 0; display: grid; grid-template-columns: 140px 1fr; gap: 20px; border-bottom: 1px solid rgba(255,255,255,.18); }
.gate-story dt { color: #92a59a; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.gate-story dd { margin: 0; color: #dfe6e2; font-size: 12px; }
.gate-panel { width: 100%; max-width: 520px; justify-self: end; padding: 46px; position: relative; z-index: 2; background: var(--white); color: var(--ink); border-top: 7px solid var(--gold); box-shadow: 0 32px 80px rgba(0,0,0,.27); }
.gate-panel h2 { margin: 0; font: 400 38px/1.05 Iowan Old Style, Baskerville, Georgia, serif; }
.gate-panel > p:not(.eyebrow):not(.form-error) { color: var(--muted); font-size: 13px; }
.gate-panel small { display: block; margin-top: 20px; color: var(--muted); font-size: 10px; }
.form-error { min-height: 18px; margin: 3px 0; color: #9a3131; font-size: 11px; }

label { display: grid; gap: 6px; margin: 15px 0; color: #41544a; font-size: 11px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 2px; background: var(--white); color: var(--ink); font-weight: 400; }
input:focus, textarea:focus, select:focus { border-color: var(--forest); }
textarea { min-height: 96px; resize: vertical; }
.primary, .back, .top-actions button, .top-actions a, .surface header button { min-height: 40px; padding: 9px 13px; border: 1px solid var(--forest); border-radius: 2px; background: var(--forest); color: var(--white); cursor: pointer; font-size: 11px; font-weight: 750; }
.back { display: block; margin-top: 10px; text-align: center; background: transparent; color: var(--forest); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { width: 270px; padding: 26px 16px; position: fixed; inset: 0 auto 0 0; z-index: 8; background: #0f1d18; color: #eef2ef; }
.brand { padding: 0 8px 28px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand > span { color: #e4c47f; }
.brand strong { font-size: 13px; }
.brand small { margin-top: 3px; color: #93a69b; font-size: 9px; letter-spacing: .08em; }
.sidebar nav { display: grid; gap: 2px; margin-top: 22px; }
.sidebar nav button { min-height: 39px; padding: 9px 9px; border: 0; border-left: 2px solid transparent; background: transparent; color: #adbbb3; text-align: left; cursor: pointer; font-size: 12px; }
.sidebar nav button i { width: 31px; display: inline-block; color: #71867b; font-size: 9px; font-style: normal; }
.sidebar nav button.active, .sidebar nav button:hover { border-left-color: var(--gold); background: #1e352c; color: white; }
.side-foot { position: absolute; left: 25px; right: 25px; bottom: 24px; display: flex; gap: 10px; color: #91a298; font-size: 9px; line-height: 1.45; }
.side-foot > span { width: 7px; height: 7px; margin-top: 4px; background: var(--gold); }
.side-foot strong { display: block; color: #dbe3de; font-size: 10px; }

.app-shell > main { grid-column: 2; min-width: 0; }
.topbar { min-height: 74px; padding: 0 42px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 30px; border-bottom: 1px solid var(--line); background: rgba(242,239,231,.96); backdrop-filter: blur(14px); }
.topbar .eyebrow { margin: 0; color: #718076; font-size: 8px; }
.topbar strong { font: 400 17px/1.25 Iowan Old Style, Georgia, serif; }
.top-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.top-actions a, .top-actions button { min-height: 33px; padding: 7px 10px; background: transparent; color: var(--forest); }
.top-actions span { margin-right: 7px; }
.menu { display: none; }

.view { max-width: 1500px; padding: 48px 42px 85px; display: none; }
.view.active { display: block; }
.welcome { min-height: 365px; padding: 55px 58px; display: grid; grid-template-columns: minmax(0, 1fr) 140px 130px; gap: 42px; align-items: center; background: var(--forest); color: white; border-bottom: 8px solid var(--gold); }
.welcome .eyebrow { color: #b8c8bc; }
.welcome h1, .heading h1 { margin: 0; font: 400 49px/1.04 Iowan Old Style, Baskerville, Georgia, serif; }
.welcome p:not(.eyebrow) { max-width: 650px; color: #c7d2cb; font: 400 17px/1.5 Iowan Old Style, Georgia, serif; }
.researcher-mark { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 11px; }
.researcher-mark img { width: 130px; height: 188px; object-fit: cover; border: 1px solid rgba(255,255,255,.22); filter: saturate(.85); }
.researcher-mark span { color: #d6bd87; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.date-mark { min-height: 190px; padding-left: 30px; display: grid; align-content: center; border-left: 1px solid rgba(255,255,255,.2); }
.date-mark strong { font: 400 66px/.9 Iowan Old Style, Georgia, serif; color: #e5c480; }
.date-mark span { margin-top: 10px; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.context-strip { padding: 19px 25px; display: grid; grid-template-columns: 1.3fr 1fr .6fr; gap: 1px; background: var(--blue); color: white; }
.context-strip > div { padding: 3px 20px; border-left: 1px solid rgba(255,255,255,.18); }
.context-strip span, .context-strip strong { display: block; }
.context-strip span { color: #a9bcc3; font-size: 8px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.context-strip strong, .context-strip a { margin-top: 6px; color: #e4ebed; font-size: 10px; font-weight: 650; }
.context-strip a { display: inline-block; color: #e7c685; border-bottom: 1px solid currentColor; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-top: 0; background: var(--white); }
.metrics div { min-height: 104px; padding: 20px 24px; border-right: 1px solid var(--line); }
.metrics div:last-child { border: 0; }
.metrics span { display: block; color: var(--muted); font-size: 10px; }
.metrics strong { color: var(--forest); font: 400 37px/1.3 Iowan Old Style, Georgia, serif; }

.two-col { margin-top: 22px; display: grid; grid-template-columns: minmax(320px, .85fr) minmax(380px, 1.15fr); gap: 20px; }
.surface { padding: 26px; background: var(--white); border: 1px solid var(--line); }
.surface header { margin-bottom: 18px; padding-bottom: 16px; display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.surface h2 { margin: 0; font: 400 25px/1.2 Iowan Old Style, Georgia, serif; }
.surface header button { min-height: 30px; padding: 5px 8px; background: transparent; color: var(--forest); }
.stack { display: grid; gap: 2px; }
.stack label { margin: 7px 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.heading { max-width: 920px; margin-bottom: 34px; }
.heading h1 { font-size: 47px; }
.heading > p:not(.eyebrow) { max-width: 760px; color: var(--muted); font-size: 15px; }
.records { display: grid; gap: 10px; }
.record { padding: 15px; border: 1px solid var(--line); background: #fdfcf8; }
.record-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.record strong { display: block; font-size: 13px; }
.record .meta { color: #70835f; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.record p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.record-actions { display: flex; gap: 6px; align-items: center; }
.record-actions button, .record-actions a { padding: 0; border: 0; background: transparent; color: var(--forest); cursor: pointer; font-size: 10px; }
.record-actions .remove { color: var(--rust); }
.empty { padding: 27px 7px; color: var(--muted); font-size: 12px; }
.settings { max-width: 850px; }
.settings li { margin: 12px 0; color: var(--muted); }
.settings > p { color: var(--muted); font-size: 12px; }
.settings-grid { align-items: start; }
.settings-actions { display: grid; gap: 9px; margin-top: 24px; }
.import-control { min-height: 40px; margin: 0; padding: 9px 13px; display: block; border: 1px solid var(--forest); color: var(--forest); text-align: center; cursor: pointer; }
.import-control input { display: none; }
.quiet-danger { min-height: 38px; padding: 8px 12px; border: 1px solid #ba9b93; background: transparent; color: var(--rust); cursor: pointer; font-size: 10px; font-weight: 700; }
.toast { padding: 10px 13px; position: fixed; right: 20px; bottom: 20px; z-index: 12; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; background: var(--forest); color: white; border-left: 4px solid var(--gold); font-size: 11px; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1050px) {
  .access-gate { grid-template-columns: 1fr 430px; gap: 45px; }
  .gate-story h1 { font-size: 50px; }
  .welcome { grid-template-columns: 1fr 110px; }
  .researcher-mark { display: none; }
}

@media (max-width: 900px) {
  .access-gate { padding: 105px 24px 45px; grid-template-columns: 1fr; gap: 40px; }
  .gate-brand { left: 24px; }
  .gate-story h1 { font-size: 46px; }
  .gate-story dl { display: none; }
  .gate-panel { justify-self: start; }
  .app-shell { display: block; }
  .app-shell > main { min-width: 0; }
  .sidebar { transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .topbar { padding: 0 20px; }
  .menu { display: block; border: 0; background: transparent; color: var(--forest); }
  .view { padding: 28px 18px 60px; }
  .welcome { padding: 38px; grid-template-columns: 1fr 100px; }
  .welcome h1 { font-size: 41px; }
  .date-mark { min-height: 150px; padding-left: 22px; }
  .date-mark strong { font-size: 52px; }
  .context-strip { grid-template-columns: 1fr; gap: 12px; }
  .context-strip > div { padding: 6px 10px; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .gate-story h1 { font-size: 39px; }
  .gate-story > p:not(.eyebrow) { font-size: 16px; }
  .gate-panel { padding: 31px 23px; }
  .gate-panel h2 { font-size: 32px; }
  .top-actions span, .top-actions a { display: none; }
  .welcome { padding: 31px 25px; grid-template-columns: 1fr; }
  .welcome h1, .heading h1 { font-size: 37px; }
  .date-mark { min-height: 0; padding: 18px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.2); }
  .date-mark strong { font-size: 42px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics div { border-bottom: 1px solid var(--line); }
  .row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar, .toast { transition: none; }
}
