:root {
  color-scheme: dark;
  --canvas: #0b101a;
  --sidebar: #0d121d;
  --panel: #121a29;
  --panel-raised: #182235;
  --line: #263247;
  --ink: #f2f1ed;
  --soft: #a9b4c5;
  --accent: #f2bf86;
  --accent-ink: #23170c;
  --sidebar-width: 226px;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; background: var(--canvas); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 4px;
}
h1, h2, h3, p, figure, blockquote { margin: 0; }
button, .primary, .outline { white-space: nowrap; }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 5; top: 10px; left: 14px; transform: translateY(-160%); background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; }
.skip:focus { transform: none; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
  padding: 27px 17px 19px; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px; font-size: 15px; font-weight: 760; letter-spacing: .13em; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  font-size: 25px; color: var(--accent); background: #211e22; border: 1px solid #4d3d32;
}
.brand small { display: block; margin-top: 4px; font-size: 9px; letter-spacing: .2em; color: var(--soft); }
nav { display: grid; gap: 6px; margin-top: 46px; }
nav a { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 8px; border: 1px solid transparent; color: var(--soft); font-size: 13px; font-weight: 560; }
nav a:hover, nav a[aria-current] { color: var(--ink); background: var(--panel-raised); }
nav a[aria-current] { border-color: var(--line); color: var(--accent); }
.profile { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 4px 3px; border-top: 1px solid var(--line); }
.profile img { object-fit: cover; object-position: center 26%; border-radius: 50%; }
.profile strong, .profile small { display: block; }
.profile strong { font-size: 13px; }
.profile small { font-size: 11px; color: var(--soft); margin-top: 4px; }

main { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { height: 69px; padding: 0 max(30px, calc((100% - 1330px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
#breadcrumb { color: var(--soft); font-size: 13px; }
#breadcrumb span { padding: 0 8px; opacity: .69; }
.top-actions { display: flex; align-items: center; gap: 18px; }
time { font-size: 12px; color: var(--soft); white-space: nowrap; }
.content { max-width: 1390px; margin: 0 auto; padding: 28px 30px 42px; }
.hero { isolation: isolate; min-height: 432px; position: relative; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #0d1523; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,#0e1727 0%,#0e1727 33%,#0e1727ec 46%,#0e172748 64%,transparent 88%),linear-gradient(0deg,#090e19 0%,transparent 29%); }
.hero-portrait { position: absolute; z-index: -2; right: 0; top: 0; height: 100%; width: 66%; object-fit: cover; object-position: center 33%; }
.hero-copy { padding: 45px clamp(28px,5vw,77px) 49px; max-width: 690px; }
.eyebrow { font-size: 11px; line-height: 1.4; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow span { margin: 0 3px; opacity: .54; }
.hero h1 { font: 400 clamp(46px, 5.75vw, 87px)/.99 var(--serif); letter-spacing: -.055em; margin: 21px 0 18px; }
.hero h1 em { font-weight: 400; color: var(--accent); }
.hero-description { color: #c0c9d6; font-size: 15px; line-height: 1.65; max-width: 355px; margin-bottom: 24px; }
.hero-link { position: absolute; right: 22px; bottom: 20px; padding: 9px 12px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; background: #0b101bd9; border: 1px solid var(--line); border-radius: 8px; }
.hero-link:hover { border-color: var(--accent); }

.primary, .outline { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 670; border-radius: 8px; transition: background .15s ease, border-color .15s ease; }
.primary { padding: 10px 15px; min-height: 42px; font-size: 13px; color: var(--accent-ink); background: var(--accent); border: 1px solid transparent; }
.primary:hover { background: #ffd6a9; }
.outline { min-height: 35px; padding: 7px 11px; color: var(--ink); background: #111a28; border: 1px solid var(--line); font-size: 12px; }
.outline:hover { border-color: #7b879b; background: var(--panel-raised); }
.outline[aria-pressed=true] { color: var(--accent); border-color: #6f5944; }
.metrics, .phase-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.metrics { margin: 17px 0; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 13px; }
.metric { min-height: 114px; display: flex; align-items: flex-start; gap: 13px; padding: 17px; }
.metric-icon { width: 35px; height: 35px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; border: 1px solid #534237; background: #27232a; color: var(--accent); }
.metric h2 { font-size: 12px; color: var(--soft); font-weight: 580; }
.metric strong { display: block; margin: 3px 0 1px; font-size: 25px; line-height: 1.14; letter-spacing: -.03em; }
.metric small { font-size: 11px; color: var(--soft); }
.overview-grid { display: grid; grid-template-columns: minmax(0,1.57fr) minmax(0,1fr); gap: 15px; }
.section-card { padding: 21px; min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.section-card h2, .empty h2 { font-size: 18px; letter-spacing: -.018em; font-weight: 690; }
.section-heading p, .muted { font-size: 13px; line-height: 1.56; color: var(--soft); }
.section-heading p { margin-top: 5px; }
.tasks { display: grid; gap: 7px; }
.task { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-height: 45px; border: 1px solid var(--line); border-radius: 8px; background: #101827; }
.task label { display: flex; flex: 1; min-width: 0; align-items: center; gap: 9px; padding: 10px 12px; cursor: pointer; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.task input { flex: 0 0 auto; height: 16px; width: 16px; margin: 0; accent-color: var(--accent); }
.task .done span { text-decoration: line-through; color: var(--soft); }
.subtle { color: var(--soft); font-size: 11px; padding: 8px 11px; border: 0; background: transparent; }
.subtle:hover { color: var(--accent); }
.north-star { background: radial-gradient(ellipse at 100% 0%, #2b252c, transparent 75%),var(--panel); }
.north-star blockquote { font: 400 clamp(22px,2.1vw,32px)/1.27 var(--serif); max-width: 440px; color: #f1e5d8; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-size: 12px; margin-top: 18px; }
.text-link:hover { text-decoration: underline; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 17px; margin: 12px 0 25px; }
.page-heading h1 { font: 400 clamp(39px,5vw,68px)/1 var(--serif); letter-spacing: -.05em; }
.page-heading p { color: var(--soft); margin-top: 10px; font-size: 14px; line-height: 1.5; }
.phase-grid .eyebrow { margin-bottom: 9px; }
.phase-detail { margin: 7px 0 14px; min-height: 62px; }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 55px 20px; }
.empty svg { color: var(--accent); }
.empty p, .record p, .journal-body { color: var(--soft); font-size: 14px; line-height: 1.55; }
.lab-column h2 { margin-bottom: 12px; }
.record { padding: 13px; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; }
.record h3, .record p, .journal-card h2, .journal-body { overflow-wrap: anywhere; }
.record h3 { font-size: 15px; }
.record p, .journal-body { white-space: pre-wrap; margin-top: 8px; }
.record .outline, .journal-card .outline { margin-top: 14px; }
.journal-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.journal-card .eyebrow { margin-bottom: 7px; }
.gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.portrait-card { overflow: hidden; }
.portrait-preview { display: block; width: 100%; padding: 0; border: 0; background: var(--canvas); }
.portrait-preview:focus-visible { outline-offset: -4px; }
.portrait-preview img { display: block; width: 100%; aspect-ratio: 4/4.6; object-fit: cover; object-position: center 29%; }
figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; font-size: 13px; }
dialog { width: min(500px,calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 22px; color: var(--ink); background: var(--panel); border: 1px solid #465169; border-radius: 13px; }
dialog::backdrop { background: #04060bd9; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 16px; }
.dialog-heading h2 { font-size: 20px; }
form { display: grid; gap: 12px; }
form label { display: grid; gap: 6px; font-size: 13px; }
form input, form textarea, form select { width: 100%; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); padding: 9px; background: var(--canvas); }
textarea { resize: vertical; min-height: 80px; }
.form-actions, .backup-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.danger { border: 0; background: transparent; color: #ff9d9d; padding: 9px; margin-right: auto; font-size: 13px; }
.zoom-portrait { display: block; width: auto; height: auto; max-width: 100%; max-height: 75dvh; margin: auto; border-radius: 7px; }
.file-label { cursor: pointer; }
.file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-label:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }
.toast { position: fixed; bottom: 18px; right: 18px; width: min(360px,calc(100% - 36px)); z-index: 4; background: #233147; color: var(--ink); padding: 12px 15px; border: 1px solid #53627b; border-radius: 9px; font-size: 13px; }
@media (max-width: 1100px) {
  :root { --sidebar-width: 190px; }
  .content { padding-inline: 23px; }
  .topbar { padding-inline: 23px; }
}
@media (max-width: 850px) {
  :root { --sidebar-width: 68px; }
  .sidebar { padding: 20px 8px 14px; }
  .brand { padding-inline: 5px; }
  .brand > span:last-child, .profile > span, nav a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  nav a { justify-content: center; padding: 12px 0; }
  .profile { justify-content: center; }
  .phase-grid { grid-template-columns: 1fr; }
  .phase-detail { min-height: 0; }
}
@media (max-width: 620px) {
  main { margin-left: 0; padding-bottom: 66px; }
  .sidebar { z-index: 3; inset: auto 0 0; width: 100%; padding: 5px 5px max(5px, env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .sidebar .brand, .sidebar .profile { display: none; }
  nav { display: grid; grid-template-columns: repeat(5,1fr); gap: 3px; margin: 0; }
  nav a { flex-direction: column; gap: 3px; padding: 6px 1px; font-size: 10px; }
  nav a > span { position: static; width: auto; height: auto; clip-path: none; }
  .topbar { height: 55px; }
  .topbar, .content { padding-inline: 14px; }
  .content { padding-top: 15px; }
  .top-actions { gap: 8px; }
  .top-actions time { display: none; }
  .hero { min-height: 520px; display: flex; align-items: end; }
  .hero-portrait { width: 100%; height: 71%; object-position: center 31%; }
  .hero::before { background: linear-gradient(0deg,#0d1523 12%,#0d1523 28%,transparent 70%); }
  .hero-copy { padding: 28px 19px 51px; }
  .hero h1 { font-size: clamp(44px,10vw,64px); margin: 14px 0 12px; }
  .hero-description { font-size: 13px; margin-bottom: 14px; }
  .hero-link { right: 12px; bottom: 11px; }
  .metrics { gap: 6px; margin: 12px 0; }
  .metric { padding: 9px 7px; gap: 7px; flex-direction: column; min-height: 114px; }
  .metric-icon { width: 29px; height: 29px; }
  .metric h2 { font-size: 11px; }
  .metric strong { font-size: 20px; }
  .overview-grid, .journal-grid { grid-template-columns: 1fr; gap: 11px; }
  .section-card { padding: 15px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .gallery { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .toast { bottom: 68px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.avatar {
  flex: 0 0 38px; height: 38px; display: grid; place-items: center; overflow: hidden;
  border-radius: 50%; background: #27232a; color: var(--accent);
}
.hero-art {
  position: absolute; z-index: -2; right: 6%; top: 10%; width: 44%; height: 80%;
  border-radius: 50%; background: radial-gradient(ellipse, #cd995868, #2e49665a 31%, transparent 69%);
}
.hero-art span { position: absolute; top: 50%; left: 50%; width: 93%; height: 54%; border: 1px solid #efba786f; border-radius: 50%; transform: translate(-50%,-50%) rotate(-27deg); }
.hero-art span:nth-child(2) { transform: translate(-50%,-50%) rotate(27deg); }
.hero-art span:nth-child(3) { transform: translate(-50%,-50%) rotate(85deg); }
@media (max-width: 620px) { .hero-art { inset: 3% 10% auto; width: 80%; height: 63%; } }
