:root {
  --ink: #1f2a24;
  --muted: #68726c;
  --paper: #f7f3ec;
  --paper-strong: #fffdf9;
  --line: rgba(53, 78, 64, 0.18);
  --line-strong: rgba(53, 78, 64, 0.34);
  --evergreen: #244b3b;
  --evergreen-2: #34604e;
  --moss: #78917f;
  --warm: #b67d55;
  --gold: #d3b57c;
  --rose: #9e6d68;
  --shadow: 0 24px 70px rgba(31, 42, 36, 0.12);
  --shadow-soft: 0 14px 40px rgba(31, 42, 36, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--paper);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(211, 181, 124, 0.24), transparent 27%),
    radial-gradient(circle at 88% 30%, rgba(120, 145, 127, 0.21), transparent 31%),
    radial-gradient(circle at 48% 82%, rgba(182, 125, 85, 0.13), transparent 28%),
    linear-gradient(180deg, #fbf8f2 0%, #f2eee6 100%);
}
.ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(43, 70, 55, 0.1);
  background: rgba(250, 247, 241, 0.82);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 48% 52%;
  color: #fff;
  font-family: var(--serif);
  font-size: 15px;
  background: var(--evergreen);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-family: var(--serif); font-size: 19px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-actions form { margin: 0; }
.nav-link, .text-button { color: var(--evergreen); font-weight: 700; font-size: 14px; text-decoration: none; }
.text-button { border: 0; padding: 8px; background: transparent; cursor: pointer; }
.user-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }

.message-stack {
  position: fixed;
  top: 86px;
  right: 22px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 44px));
}
.message { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-strong); box-shadow: var(--shadow-soft); font-size: 14px; }
.message-success { border-color: rgba(36, 75, 59, .28); }
.message-error { border-color: rgba(158, 109, 104, .4); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--evergreen); box-shadow: 0 10px 24px rgba(36,75,59,.2); }
.button-primary:hover { background: var(--evergreen-2); }
.button-secondary { color: var(--evergreen); border-color: var(--line-strong); background: rgba(255,255,255,.52); }
.button-ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button-small { min-height: 38px; padding: 8px 14px; }
.button-wide { width: 100%; }

.eyebrow { margin: 0 0 9px; color: var(--warm); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 90px; }
.narrow-page { width: min(760px, calc(100% - 40px)); }
.page-heading { margin-bottom: 34px; }
.page-heading h1, .form-page-heading h1, .auth-intro h1 { margin: 0; font-family: var(--serif); font-size: clamp(38px, 5vw, 66px); font-weight: 500; line-height: .98; letter-spacing: -.045em; }
.page-heading p:not(.eyebrow), .form-page-heading p, .auth-intro p { max-width: 680px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.back-link { display: inline-block; margin-bottom: 30px; color: var(--evergreen); font-size: 14px; font-weight: 800; text-decoration: none; }
.form-page-heading { margin-bottom: 28px; }

.form-card {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(45, 70, 57, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 249, .9);
  box-shadow: var(--shadow-soft);
}
.stacked-form { display: grid; gap: 22px; }
.two-column-form, .memory-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.full-span { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span { color: #3b4841; font-size: 12px; font-weight: 850; letter-spacing: .04em; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-control, .auth-form input, .auth-form select, .auth-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(48, 73, 60, .2);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: rgba(255,255,255,.8);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.form-control, .auth-form textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
select[multiple].form-control { min-height: 174px; padding: 8px; }
select[multiple].form-control option { padding: 9px 10px; border-radius: 8px; }
.people-field > label > span { color: #3b4841; font-size: 12px; font-weight: 850; letter-spacing: .04em; }
.many2many-widget { position: relative; }
.many2many-tags-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 6px 9px;
  border: 1px solid rgba(48, 73, 60, .2);
  border-radius: 11px;
  background: rgba(255,255,255,.8);
  cursor: text;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.many2many-tags-control:focus-within { border-color: var(--evergreen); box-shadow: 0 0 0 4px rgba(36,75,59,.1); }
.many2many-selected { display: contents; }
.many2many-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 29px;
  padding: 4px 5px 4px 10px;
  border: 1px solid rgba(36,75,59,.14);
  border-radius: 7px;
  color: var(--evergreen);
  background: rgba(120,145,127,.16);
  font-size: 12px;
  font-weight: 800;
}
.many2many-tag > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.many2many-tag-remove {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.many2many-tag-remove:hover, .many2many-tag-remove:focus-visible { color: #fff; background: var(--evergreen); outline: none; }
.many2many-search {
  flex: 1 1 150px;
  min-width: 120px;
  min-height: 30px;
  padding: 3px 4px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}
.many2many-search::-webkit-search-cancel-button { display: none; }
.many2many-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 250px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fffdfa;
  box-shadow: 0 16px 34px rgba(32,50,41,.16);
}
.many2many-option {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.many2many-option:hover, .many2many-option.is-active { color: var(--evergreen); background: rgba(120,145,127,.14); }
.many2many-empty { margin: 0; padding: 11px; color: var(--muted); font-size: 12px; }
.form-control:focus, .auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus { border-color: var(--evergreen); box-shadow: 0 0 0 4px rgba(36,75,59,.1); }
.errorlist { margin: 0; padding: 0; list-style: none; color: #8e3f3d; font-size: 12px; }
.form-errors { padding: 13px 15px; border: 1px solid rgba(142,63,61,.25); border-radius: 12px; color: #7e3634; background: rgba(158,109,104,.1); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.date-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 18px; border-radius: 16px; background: rgba(120,145,127,.09); }
.date-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.file-field input { padding: 9px; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.story-field > label > span { color: #3b4841; font-size: 12px; font-weight: 850; letter-spacing: .04em; }
.dictation-tools { display: flex; align-items: center; gap: 12px; margin-top: 3px; }
.dictation-tools .is-active { color: #fff; background: var(--evergreen); }
.tool-status { color: var(--muted); font-size: 12px; line-height: 1.45; }
.privacy-callout { margin: 1px 0 0; padding: 11px 13px; border-left: 3px solid rgba(182,125,85,.45); border-radius: 0 10px 10px 0; color: var(--muted); background: rgba(182,125,85,.07); font-size: 11px; line-height: 1.55; }
.card-links { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.card-links .card-open { margin-top: 0; }
.card-edit { color: var(--muted); font-size: 11px; font-weight: 850; text-decoration: none; }
.card-edit:hover { color: var(--evergreen); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

.auth-page .topbar { position: relative; }
.auth-shell { display: grid; place-items: center; min-height: calc(100vh - 74px); padding: 50px 20px 80px; }
.auth-panel { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(340px, 1fr); align-items: center; gap: clamp(38px, 8vw, 100px); width: min(1000px, 100%); }
.auth-shell-wide .auth-panel { width: min(1120px, 100%); }
.auth-intro p { max-width: 430px; }
.auth-form { display: grid; gap: 20px; }
.form-footnote { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.form-footnote a { color: var(--evergreen); font-weight: 800; }

.join-panel { margin: -8px 0 28px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.5); }
.inline-form { display: flex; align-items: flex-end; gap: 14px; }
.grow { flex: 1; }
.archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.archive-card {
  position: relative;
  min-height: 330px;
  padding: 28px 28px 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,253,249,.8);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.archive-card::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(120,145,127,.22), transparent 68%); }
.archive-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.archive-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 35px; }
.archive-card h2 { margin: 0 0 12px; font-family: var(--serif); font-size: 36px; font-weight: 500; letter-spacing: -.03em; }
.archive-card > p:not(.eyebrow) { max-width: 520px; color: var(--muted); line-height: 1.65; }
.role-badge, .status-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 11px; border-radius: 999px; color: var(--evergreen); background: rgba(120,145,127,.14); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.place-line { display: block; margin-top: 20px; color: var(--muted); font-size: 13px; }
.card-link { position: absolute; left: 28px; bottom: 27px; z-index: 1; color: var(--evergreen); font-weight: 900; font-size: 14px; }
.empty-dashboard, .empty-state, .empty-review { padding: 55px 28px; border: 1px dashed var(--line-strong); border-radius: 24px; text-align: center; background: rgba(255,255,255,.34); }
.empty-mark, .empty-icon { display: block; margin-bottom: 12px; color: var(--warm); font-size: 34px; }
.empty-dashboard h2, .empty-state h3 { font-family: var(--serif); font-size: 34px; font-weight: 500; }
.empty-dashboard p, .empty-state p { color: var(--muted); }

.hero-shell { padding: 62px 20px 42px; }
.person-card { width: min(840px, 100%); margin: 0 auto; text-align: center; }
.portrait-wrap { position: relative; display: inline-grid; place-items: center; margin-bottom: 26px; }
.portrait { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; font-family: var(--serif); background: linear-gradient(145deg, #315b49, #1e4033); box-shadow: 0 18px 42px rgba(36,75,59,.22), inset 0 0 0 1px rgba(255,255,255,.18); }
.portrait-large { width: 126px; height: 126px; font-size: 35px; }
.portrait-small { width: 58px; height: 58px; font-size: 18px; }
.portrait-ring { position: absolute; inset: -10px; border: 1px solid rgba(182,125,85,.35); border-radius: 46% 54% 51% 49%; transform: rotate(-7deg); }
.person-card h1 { margin: 0; font-family: var(--serif); font-size: clamp(54px, 8vw, 92px); font-weight: 500; line-height: .92; letter-spacing: -.055em; }
.life-dates { margin: 18px 0 0; color: var(--warm); font-size: 14px; font-weight: 800; }
.person-summary { max-width: 690px; margin: 20px auto 0; color: var(--muted); font-family: var(--serif); font-size: 20px; line-height: 1.55; }
.archive-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 24px; margin-top: 28px; color: var(--muted); font-size: 13px; }
.archive-stats span { display: inline-flex; align-items: baseline; gap: 5px; }
.archive-stats strong { color: var(--ink); font-size: 18px; }
.privacy-note { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.45); font-size: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }

.workspace { display: grid; grid-template-columns: 310px minmax(0, 1fr); align-items: start; gap: clamp(32px, 5vw, 76px); width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 100px; }
.filter-panel { position: sticky; top: 98px; padding: 23px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,253,249,.79); box-shadow: var(--shadow-soft); backdrop-filter: blur(12px); }
.filter-form { display: grid; gap: 20px; }
.filter-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.filter-heading h2, .timeline-toolbar h2 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 500; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.filter-grid .field > span, .sort-row .field > span { font-size: 10px; }
.search-input-wrap { position: relative; }
.search-input-wrap > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input-wrap input { padding-left: 34px; }
.sort-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

.timeline-section { min-width: 0; }
.timeline-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-controls { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.44); }
.segmented { min-height: 34px; padding: 6px 12px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.segmented.active { color: #fff; background: var(--evergreen); }
.timeline-intro { position: relative; width: min(680px, 100%); margin: 0 auto 32px; padding: 16px 18px 16px 52px; border: 1px solid var(--line); border-radius: 18px; color: var(--muted); background: rgba(255,255,255,.46); font-size: 13px; line-height: 1.55; }
.timeline-intro p { margin: 0; }
.intro-knot { position: absolute; left: 20px; top: 50%; width: 13px; height: 13px; border: 3px solid var(--paper); border-radius: 50%; background: var(--warm); transform: translateY(-50%); box-shadow: 0 0 0 1px rgba(182,125,85,.35); }

.timeline { position: relative; width: min(900px, 100%); margin: 0 auto; padding: 10px 0 30px; }
.timeline::before { content: ''; position: absolute; top: -34px; bottom: 0; left: 50%; width: 1px; background: linear-gradient(180deg, rgba(182,125,85,.45), var(--line-strong) 9%, var(--line) 92%, transparent); }
.timeline-item { position: relative; display: grid; grid-template-columns: 1fr 80px 1fr; min-height: 180px; margin-top: var(--gap); }
.timeline-item:first-child { margin-top: 26px; }
.timeline-card { position: relative; width: min(390px, 100%); padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,249,.88); box-shadow: var(--shadow-soft); transition: transform .2s ease, box-shadow .2s ease; }
.timeline-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.side-left .timeline-card { grid-column: 1; justify-self: end; }
.side-right .timeline-card { grid-column: 3; justify-self: start; }
.timeline-year { position: absolute; top: 19px; left: 50%; z-index: 2; display: grid; place-items: center; width: 62px; min-height: 30px; padding: 4px 7px; border: 1px solid rgba(36,75,59,.2); border-radius: 999px; color: var(--evergreen); background: var(--paper); font-size: 11px; font-weight: 900; transform: translateX(-50%); }
.branch-dot { position: absolute; top: 66px; left: 50%; z-index: 3; width: 11px; height: 11px; border: 3px solid var(--paper); border-radius: 50%; background: var(--warm); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(182,125,85,.35); }
.branch-line { position: absolute; top: 65px; left: 25%; width: 25%; height: 1px; background: var(--line-strong); }
.side-right .branch-line { left: 50%; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.type-chip { display: inline-flex; padding: 6px 9px; border-radius: 999px; color: var(--evergreen); background: rgba(120,145,127,.14); font-size: 9px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.type-voice { color: #624e72; background: rgba(117,90,135,.12); }
.type-photo, .type-video { color: #6d5035; background: rgba(182,125,85,.13); }
.type-letter { color: #6d5d37; background: rgba(211,181,124,.17); }
.posted-meta { color: var(--muted); font-size: 10px; }
.historic-date { margin: 18px 0 6px; color: var(--warm); font-size: 12px; font-weight: 850; opacity: var(--text-opacity); }
.timeline-card h3 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 500; line-height: 1.08; letter-spacing: -.025em; opacity: var(--text-opacity); }
.excerpt { margin: 13px 0 0; color: #465048; font-family: var(--serif); font-size: 16px; line-height: 1.62; opacity: var(--text-opacity); }
.card-media { margin-top: 18px; overflow: hidden; border-radius: 14px; background: rgba(120,145,127,.1); }
.card-media img { display: block; width: 100%; height: 150px; object-fit: cover; }
.card-media:not(.media-image) { display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 15px; color: var(--evergreen); font-weight: 800; font-size: 13px; }
.media-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(36,75,59,.12); }
.voice-preview { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px; border-radius: 14px; color: #63536e; background: rgba(117,90,135,.08); font-size: 11px; font-weight: 800; }
.play-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: #756087; font-size: 10px; }
.waveform { flex: 1; height: 24px; opacity: .5; background: repeating-linear-gradient(90deg, #756087 0 2px, transparent 2px 6px); mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%); }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.author-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.author-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--moss); font-size: 10px; font-weight: 900; }
.author-block > span { display: flex; flex-direction: column; min-width: 0; }
.author-block strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.author-block small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-small { min-height: 26px; padding: 5px 8px; font-size: 8px; }
.memory-pending .timeline-card { border-style: dashed; }
.people-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.people-chips span { padding: 5px 8px; border-radius: 999px; color: var(--muted); background: rgba(120,145,127,.1); font-size: 9px; font-weight: 800; }
.card-open { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0; border: 0; color: var(--evergreen); background: transparent; font-size: 12px; font-weight: 900; cursor: pointer; }
.timeline.compact .timeline-item { min-height: 150px; margin-top: 34px !important; }
.timeline.compact .timeline-card { padding: 18px; }
.timeline.compact .excerpt { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

.memory-dialog { width: min(650px, calc(100% - 30px)); max-height: min(830px, calc(100vh - 36px)); padding: 0; border: 0; border-radius: 26px; color: var(--ink); background: var(--paper-strong); box-shadow: 0 30px 100px rgba(17,28,22,.32); }
.memory-dialog::backdrop { background: rgba(22,31,26,.48); backdrop-filter: blur(6px); }
.dialog-close { position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255,253,249,.9); font-size: 24px; cursor: pointer; }
.dialog-scroll { max-height: inherit; overflow-y: auto; padding: 34px; }
.drawer-media { margin: -34px -34px 30px; overflow: hidden; border-radius: 26px 26px 0 0; background: rgba(120,145,127,.12); }
.drawer-media img, .drawer-media video { display: block; width: 100%; max-height: 380px; object-fit: cover; }
.drawer-media audio { width: calc(100% - 40px); margin: 25px 20px; }
.drawer-media.media-document { padding: 38px; text-align: center; }
.drawer-date { color: var(--warm); font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.memory-dialog h2 { margin: 9px 0 20px; font-family: var(--serif); font-size: clamp(34px, 6vw, 50px); font-weight: 500; line-height: 1.04; letter-spacing: -.035em; }
.drawer-story { color: #3f4943; font-family: var(--serif); font-size: 19px; line-height: 1.75; }
.drawer-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.meta-box { padding: 14px; border-radius: 14px; background: rgba(120,145,127,.08); }
.meta-box span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.meta-box strong { font-size: 12px; }
.people-chips-large span { padding: 7px 10px; font-size: 11px; }

.moderation-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 26px; align-items: start; }
.moderation-column { display: grid; gap: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: 30px; font-weight: 500; }
.section-heading > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--evergreen); background: rgba(120,145,127,.14); font-weight: 900; font-size: 12px; }
.review-card { padding: 21px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,253,249,.85); box-shadow: var(--shadow-soft); }
.review-card-heading { display: flex; align-items: center; gap: 12px; }
.review-card-heading h3 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 500; }
.review-card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.split-review-heading { justify-content: space-between; align-items: flex-start; }
.review-body { margin: 18px 0 0; color: #465048; font-family: var(--serif); font-size: 16px; line-height: 1.65; }
.review-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.review-actions form { margin: 0; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .filter-panel { position: relative; top: auto; }
  .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-heading, .filter-form > .full-width, .filter-form > .button-wide { grid-column: 1 / -1; }
  .filter-grid, .sort-row { grid-column: span 1; }
  .moderation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { padding-inline: 16px; }
  .brand-copy small, .nav-link, .user-pill { display: none; }
  .page-shell { width: min(100% - 28px, 1180px); padding-top: 38px; }
  .split-heading { align-items: flex-start; flex-direction: column; }
  .archive-grid { grid-template-columns: 1fr; }
  .auth-panel { grid-template-columns: 1fr; gap: 24px; }
  .two-column-form, .memory-form { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .date-fields { grid-column: auto; grid-template-columns: 1fr; }
  .date-hint { grid-column: auto; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .filter-form { grid-template-columns: 1fr; }
  .filter-heading, .filter-form > .full-width, .filter-form > .button-wide, .filter-grid, .sort-row { grid-column: 1; }
  .timeline-toolbar { align-items: flex-start; flex-direction: column; }
  .timeline::before { left: 23px; }
  .timeline-item { display: block; min-height: 0; margin-top: 38px; padding-left: 52px; }
  .timeline-year { top: 0; left: 23px; width: 46px; min-height: 26px; transform: translateX(-50%); }
  .branch-dot { top: 48px; left: 23px; }
  .branch-line, .side-right .branch-line { top: 47px; left: 23px; width: 29px; }
  .side-left .timeline-card, .side-right .timeline-card { width: 100%; }
  .person-card h1 { font-size: clamp(50px, 16vw, 72px); }
  .portrait-large { width: 105px; height: 105px; }
  .drawer-meta-grid { grid-template-columns: 1fr; }
  .dialog-scroll { padding: 26px; }
  .drawer-media { margin: -26px -26px 26px; }
}

@media (max-width: 600px) {
  .dictation-tools, .capture-heading { align-items: stretch; flex-direction: column; }
  .capture-limit { align-self: flex-start; }
  .capture-actions .button { width: 100%; }
}

@media (max-width: 480px) {
  .topbar-actions { gap: 8px; }
  .topbar-actions .button-small { display: none; }
  .hero-shell { padding-top: 42px; }
  .workspace { width: min(100% - 24px, 1320px); }
  .filter-grid, .sort-row { grid-template-columns: 1fr; }
  .archive-stats { gap: 8px 14px; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .review-actions { align-items: stretch; flex-direction: column-reverse; }
  .review-actions form, .review-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.review-media { margin-top: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: rgba(120,145,127,.08); }
.review-media img, .review-media video { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.review-media audio { display: block; width: calc(100% - 28px); margin: 14px; }
.review-media.media-document { padding: 20px; text-align: center; }

/* Archive creation and private invitation controls */
.heading-actions, .empty-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.archive-create-form { width: min(760px, 100%); margin: 0 auto 80px; }
.invite-panel { width: min(760px, 100%); margin: 28px auto 0; padding: 22px; border: 1px solid var(--line); border-radius: 22px; text-align: left; background: rgba(255,253,249,.82); box-shadow: var(--shadow-soft); }
.invite-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.invite-panel-heading h2 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 500; }
.invite-panel-heading > p { max-width: 270px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.invite-copy-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.copy-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.invite-panel .tool-status { display: block; margin-top: 14px; }

@media (max-width: 680px) {
  .heading-actions, .empty-actions { width: 100%; }
  .heading-actions .button, .empty-actions .button { width: 100%; }
  .invite-panel-heading, .invite-copy-row { align-items: stretch; flex-direction: column; }
  .invite-panel-heading > p { max-width: none; }
  .invite-copy-row .button { width: 100%; }
}
