:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2330;
  background: #f5f3ee;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
turbo-frame { display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 22px;
  color: #cad0d2;
  background: #15272a;
}

.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 42px; color: white; font-size: 19px; font-weight: 750; letter-spacing: -.4px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #15272a; background: #f2b84b; font-family: Georgia, serif; font-weight: 800; }
nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 9px; color: #9eaaac; font-size: 14px; font-weight: 600; text-decoration: none; white-space: pre; }
.nav-link:hover, .nav-link.active { color: white; background: #22383b; }
.sidebar-status { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 15px 12px; border-top: 1px solid #304245; }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { color: white; font-size: 12px; }
.sidebar-status small { margin-top: 3px; color: #90a0a2; font-size: 12px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #db755f; box-shadow: 0 0 0 4px rgba(219,117,95,.12); }
.status-dot.online { background: #6fbe8c; box-shadow: 0 0 0 4px rgba(111,190,140,.12); }
.sign-out-button { width: 100%; padding: 10px 12px; border: 0; color: #93a1a3; background: transparent; font-size: 13px; text-align: left; cursor: pointer; }
.sign-out-button:hover { color: white; }

main { min-height: 100vh; margin-left: 244px; padding: 38px clamp(24px, 5vw, 72px) 24px; }
.topbar, .section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar { margin-bottom: 30px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(30px, 4vw, 42px); font-weight: 500; letter-spacing: -1.5px; }
h2 { margin-bottom: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.6px; }
h3 { margin-bottom: 8px; font-size: 15px; }
.eyebrow { margin-bottom: 7px; color: #6c7679; font-size: 11.5px; font-weight: 750; letter-spacing: 1.1px; text-transform: uppercase; }
.eyebrow.light { color: #f2b84b; }
.primary-button { padding: 11px 18px; border: 0; border-radius: 9px; color: #17272a; background: #f2b84b; font-size: 13.5px; font-weight: 800; cursor: pointer; box-shadow: 0 5px 14px rgba(180,125,28,.18); }
.primary-button:hover { background: #ffc85e; transform: translateY(-1px); }

.hero-card { display: grid; grid-template-columns: 1fr minmax(320px, .9fr); gap: 26px; align-items: center; padding: clamp(18px, 1.8vw, 24px); border-radius: 17px; color: white; background: linear-gradient(125deg, #1e3b3e 0%, #274c4c 66%, #39615d 100%); box-shadow: 0 18px 42px rgba(24,48,50,.12); }
.hero-card h2 { max-width: 440px; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.3; font-weight: 500; }
.question-box { padding: 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.question-box label { display: block; margin: 0 0 9px 2px; color: #d8e2e2; font-size: 12.5px; font-weight: 600; }
.question-input { display: flex; overflow: hidden; border-radius: 8px; background: white; }
.question-input input[type="search"] { width: 100%; min-width: 0; padding: 13px 14px; border: 0; outline: none; color: #253237; font-size: 12px; }
.question-input input[type="submit"] { width: 48px; border: 0; color: #17272a; background: #f2b84b; font-size: 20px; cursor: pointer; }
.answer-frame { margin: 10px 3px 0; color: #cfdcdc; font-size: 12.5px; line-height: 1.55; }
.answer-frame.answered { padding: 12px; border-left: 2px solid #f2b84b; color: #e7eeee; background: rgba(9,25,26,.18); }
.answer-frame strong { display: block; margin-bottom: 4px; color: white; }
.answer-frame p { margin-bottom: 0; }

.section-block { padding: 37px 0 30px; }
.section-heading { margin-bottom: 19px; }
.period-pill { padding: 7px 13px; border: 1px solid #dedbd2; border-radius: 999px; color: #626b68; background: #faf9f6; font-size: 12.5px; font-weight: 650; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card, .panel { border: 1px solid #e7e3da; background: #fff; box-shadow: 0 8px 25px rgba(43,48,47,.035); }
.stat-card { position: relative; padding: 21px; border-radius: 12px; }
.stat-card strong { display: block; margin: 12px 0 3px; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.stat-card p { margin-bottom: 5px; font-size: 14px; font-weight: 700; }
.stat-card small { color: #77807c; font-size: 12px; line-height: 1.45; }
.stat-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 15px; font-weight: 800; }
.stat-icon.amber { color: #b17710; background: #fff3d9; }
.stat-icon.blue { color: #4c7589; background: #e6f1f4; }
.stat-icon.coral { color: #b65d4a; background: #fae9e4; }
.stat-icon.green { color: #397c5a; background: #e7f3eb; }

.content-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; }
.panel { min-height: 270px; padding: 24px; border-radius: 13px; }
.panel-heading { padding-bottom: 17px; border-bottom: 1px solid #efede7; }
.panel-heading h2 { font-size: 20px; }
.text-button { border: 0; color: #486b66; background: transparent; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; }
.empty-state { max-width: 380px; margin: 35px auto 15px; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 43px; height: 43px; margin: 0 auto 14px; border: 1px dashed #d6c49c; border-radius: 50%; color: #b68122; background: #fff9eb; }
.empty-state p, .timeline-item p { color: #6f7674; font-size: 13px; line-height: 1.6; }
.memory-list { display: grid; }
.memory-row { display: grid; grid-template-columns: 48px 1fr; gap: 13px; padding: 16px 2px; border-bottom: 1px solid #efede7; }
.memory-row:last-child { border-bottom: 0; }
.memory-row strong { font-size: 12px; }
.memory-row p { margin: 6px 0; color: #5d6664; font-size: 13.5px; line-height: 1.55; }
.memory-row small { color: #77807c; font-size: 12px; }
.confidence { align-self: start; padding: 6px 4px; border-radius: 6px; color: #2f6b4b; background: #e7f3eb; font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.timeline-item { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 10px; margin-top: 22px; }
.timeline-item::before { content: ''; position: absolute; top: 15px; bottom: -28px; left: 5px; width: 1px; background: #e1ded5; }
.timeline-item:last-child::before { display: none; }
.timeline-node { z-index: 1; width: 11px; height: 11px; margin-top: 2px; border: 3px solid #f3c66e; border-radius: 50%; background: white; }
.timeline-item strong { font-size: 12px; }
.timeline-item p { margin: 4px 0; }
.timeline-item small { color: #7d837f; font-size: 11.5px; }
.timeline-item.muted { opacity: .6; }
footer { padding: 34px 0 12px; color: #868d8a; font-size: 12.5px; text-align: center; }

.auth-main { display: grid; min-height: 100vh; margin: 0; padding: 36px 20px; place-items: center; background: linear-gradient(145deg, #15272a 0 42%, #f5f3ee 42%); }
.auth-card { width: min(100%, 520px); padding: 38px; border: 1px solid #e4e0d6; border-radius: 16px; background: white; box-shadow: 0 24px 70px rgba(15,35,37,.18); }
.auth-card.compact { width: min(100%, 430px); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; color: #15272a; font-size: 18px; }
.auth-card h1 { margin-bottom: 10px; font-size: 34px; }
.auth-intro { margin-bottom: 26px; color: #6b7371; font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { margin-top: 8px; color: #434d4c; font-size: 12.5px; font-weight: 700; }
.auth-form input:not([type="submit"]) { width: 100%; padding: 11px 12px; border: 1px solid #dcd9d0; border-radius: 8px; outline: 0; background: #fbfaf7; font-size: 13px; }
.auth-form input:focus { border-color: #78958f; box-shadow: 0 0 0 3px rgba(91,130,123,.12); }
.auth-form small { color: #7d837f; font-size: 11.5px; }
.full-width { width: 100%; margin-top: 18px; }
.form-errors, .flash { padding: 12px 15px; border-radius: 8px; font-size: 13.5px; }
.form-errors, .flash.alert { color: #8e3f32; background: #fae9e4; }
.flash { position: fixed; z-index: 10; top: 16px; right: 16px; color: #24583e; background: #e7f3eb; box-shadow: 0 8px 24px rgba(0,0,0,.1); }

@media (max-width: 1000px) {
  .hero-card, .content-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .sidebar { position: static; width: auto; padding: 18px; }
  .sidebar nav, .sidebar-status { display: none; }
  .brand { margin: 0; }
  main { margin-left: 0; padding: 24px 16px; }
  .topbar { align-items: flex-end; }
  .hero-card { padding: 27px 22px; gap: 28px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 460px) {
  .primary-button { padding: 10px; font-size: 13px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* --- memory browsing ------------------------------------------------- */
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-pill {
  padding: 7px 13px; border: 1px solid #e7e3da; border-radius: 999px;
  color: #54736f; background: #fff; font-size: 12px; font-weight: 700; text-decoration: none;
}
.filter-pill:hover { border-color: #cfd8d2; }
.filter-pill.active { color: #fff; background: #15272a; border-color: #15272a; }

a.memory-row { text-decoration: none; color: inherit; }
a.memory-row:hover { background: #fbfaf7; }

.status-tag {
  display: inline-block; margin-right: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  color: #6b5a12; background: #fdf0d0;
}
.status-tag.active { color: #17503a; background: #d8f0e2; }
.status-tag.rejected, .status-tag.obsolete { color: #6d2a2a; background: #f7dede; }
.status-tag.superseded { color: #2f4a6d; background: #dde8f7; }
.status-tag.large { padding: 7px 15px; font-size: 12px; }

.governance-note {
  max-width: 760px; margin: 0 0 22px; padding: 14px 17px; border-radius: 11px;
  border: 1px solid #efe3c6; background: #fdfaf0; color: #6b5a12; font-size: 13px; line-height: 1.55;
}
.governance-note.small { margin-bottom: 14px; font-size: 12.5px; }

.statement-panel { margin-bottom: 22px; }
.statement {
  margin: 8px 0 22px; padding: 18px 22px; border-left: 3px solid #f2b84b;
  border-radius: 0 10px 10px 0; background: #fbfaf7;
  font-size: 17px; line-height: 1.55; font-weight: 600;
}
.rationale { margin: 8px 0 22px; max-width: 780px; line-height: 1.6; color: #44505e; }
.hint { margin-top: 18px; padding: 12px 15px; border-radius: 10px; background: #eef4fb; color: #2f4a6d; font-size: 13px; }

.memory-facts { display: flex; flex-wrap: wrap; gap: 26px; margin: 0; padding-top: 18px; border-top: 1px solid #efede7; }
.memory-facts dt { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8a958f; }
.memory-facts dd { margin: 4px 0 0; font-size: 14px; font-weight: 650; }

.evidence-list { margin: 0; padding: 0; list-style: none; }
.evidence-list li { display: grid; grid-template-columns: 104px 1fr; gap: 14px; padding: 16px 2px; border-bottom: 1px solid #efede7; }
.evidence-list li:last-child { border-bottom: 0; }
.evidence-type { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #54736f; padding-top: 3px; }
.evidence-date { margin-left: 7px; font-weight: 500; color: #8a958f; font-size: 12px; }
.evidence-title { margin: 5px 0 3px; font-weight: 600; font-size: 13.5px; }
.evidence-excerpt { margin: 3px 0 5px; color: #566270; font-size: 13px; line-height: 1.5; white-space: pre-line; }

.button-row { display: flex; gap: 9px; flex-wrap: wrap; }
.button-row form { margin: 0; }
.danger-button { padding: 11px 18px; border: 1px solid #e3cccc; border-radius: 9px; color: #6d2a2a; background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.danger-button:hover { background: #fdf5f5; }
.panel-heading.spaced { margin-top: 26px; padding-top: 18px; border-top: 1px solid #efede7; border-bottom: 0; }

.edit-form { display: grid; gap: 7px; }
.edit-form label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8a958f; }
.edit-form textarea, .edit-form input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid #e7e3da; border-radius: 9px; font-size: 13.5px; line-height: 1.5; resize: vertical; }
.edit-form input[type=submit] { justify-self: start; margin-top: 6px; padding: 9px 15px; border: 1px solid #e7e3da; border-radius: 9px; background: #fff; }
.contributors { color: #566270; font-size: 13px; }

/* --- authoring and retiring decisions --------------------------------- */
.topbar-actions { display: flex; gap: 9px; }
.filter-row-standalone { display: block; margin: 22px 0 4px; }
.wide-form { max-width: 720px; }
.edit-form select, .edit-form input[type=datetime-local] {
  width: 100%; padding: 10px 12px; border: 1px solid #e7e3da; border-radius: 9px;
  background: #fff; font-size: 13.5px;
}
.edit-form .button-row { margin-top: 14px; }
.edit-form .button-row a.danger-button { display: inline-flex; align-items: center; text-decoration: none; }
.fine-print {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid #efede7;
  color: #77807c; font-size: 12.5px; line-height: 1.6;
}
.fine-print em { font-style: normal; font-weight: 700; color: #54736f; }
.form-errors {
  margin-bottom: 18px; padding: 13px 16px; border-radius: 9px;
  background: #f8e3e3; color: #6d2a2a; font-size: 13.5px;
}
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
