:root {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  color: #241b35;
  background: #f8f7fb;
  font-size: 15px;
  font-synthesis: none;
  --text: #241b35;
  --muted: #655d73;
  --subtle: #6e647b;
  --accent: #6242ac;
  --accent-dark: #50328f;
  --accent-light: #ede5fc;
  --line: #e8e2f0;
  --surface: #fff;
  --danger: #9e354b;
  --radius: 16px;
  --spacer: clamp(18px, 3.2vw, 44px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .64; }
a { color: var(--accent-dark); }
:focus-visible { outline: 2px solid #7954c8; outline-offset: 3px; }
p, h1, h2, h3, ul, dl, dd { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.app { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 30px 17px 22px; background: #fcfbfe; border-right: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; letter-spacing: -.06em; font-size: 28px; font-weight: 720; }
.sidebar .wordmark { padding-left: 10px; }
.wordmark-dot { color: var(--accent); }
.nova-mark {
  display: inline-grid; place-items: center; width: 37px; height: 37px; margin-right: 11px;
  border-radius: 12px; font-size: 24px; line-height: 1; color: white;
  text-shadow: 0 1px 6px #5a3b9f; background: linear-gradient(145deg, #af99e6, #7653bd);
  box-shadow: inset 0 0 0 1px #8060c4, 0 3px 8px #583b9f25;
}
.nav { display: grid; gap: 5px; margin-top: 48px; }
.nav a, .logout {
  display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 9px;
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 620;
}
.nav a:hover, .logout:hover { color: var(--accent-dark); background: #f3eefb; }
.nav a[aria-current="page"] { color: var(--accent-dark); background: var(--accent-light); }
.nav-icon { display: inline-grid; place-items: center; width: 18px; font-size: 17px; font-weight: 550; }
.logout { align-self: start; margin-top: auto; border: 0; background: transparent; }
.main { min-width: 0; }
.topbar {
  display: flex; min-height: 68px; gap: 14px; justify-content: space-between; align-items: center;
  padding: 12px var(--spacer); border-bottom: 1px solid var(--line); background: #ffffff81;
}
.topbar-location { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 680; }
.pilot-dot { width: 8px; height: 8px; border-radius: 50%; background: #926acf; box-shadow: 0 0 0 3px #eee6f9; }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.select-control, input, textarea {
  min-width: 0; color: var(--text); background: var(--surface); border: 1px solid #dbd3e6;
  border-radius: 8px; padding: 8px 9px; line-height: 1.25;
}
.select-control { min-height: 37px; max-width: 100%; }
input[type="date"] { min-height: 36px; }
.primary-button, .secondary-button, .quiet-button {
  display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 36px;
  padding: 8px 13px; font-weight: 640; font-size: 13px; text-decoration: none; border-radius: 8px;
}
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: white; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { border: 1px solid #dcd4e7; background: var(--surface); color: var(--accent-dark); }
.secondary-button:hover, .quiet-button:hover { background: #f4eefc; }
.quiet-button { border: 1px solid transparent; background: transparent; color: var(--accent-dark); }
.workspace { max-width: 1440px; margin: 0 auto; padding: 31px var(--spacer) 60px; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-header h1 { font-size: clamp(28px, 3.6vw, 42px); letter-spacing: -.048em; font-weight: 730; line-height: 1.11; }
.page-header p { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.breadcrumb { display: inline-block; margin-bottom: 13px; font-size: 13px; font-weight: 640; text-decoration: none; }
.breadcrumb:hover { text-decoration: underline; }
.loading, .empty { padding: 32px 22px; text-align: center; color: var(--muted); }
.form-error { margin: 0 0 15px; padding: 11px 13px; color: var(--danger); border: 1px solid #eed5dd; border-radius: 8px; background: #fff3f7; }
.panel, .metric, .journal-day, .turn {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 3px 11px #35214c07;
}
.panel { min-width: 0; }
.panel + .panel { margin-top: 17px; }
.panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 12px; }
.panel-heading h2, .journal-day h2 { font-size: 18px; letter-spacing: -.021em; }
.panel-heading p { color: var(--muted); margin-top: 5px; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.metric { padding: 16px 17px; min-height: 109px; }
.metric.lead { background: linear-gradient(125deg, #f0e8fc 0%, #f8f4ff 62%, #f2ebfe 100%); border-color: #dfd1f2; }
.metric-label { font-weight: 620; font-size: 13px; color: var(--muted); }
.metric-value { margin-top: 6px; color: var(--text); font-size: clamp(21px, 2.55vw, 31px); font-weight: 725; letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-note { color: var(--subtle); margin-top: 5px; font-size: 12px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(220px, 1fr); gap: 17px; margin-bottom: 17px; }
.overview-grid > .panel + .panel { margin-top: 0; }
.chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin: 12px 20px 16px; }
.chart-y { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; height: 127px; color: var(--muted); font-size: 11px; }
.chart-bars { display: grid; gap: 3px; align-items: end; height: 127px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-bottom: 1px solid #d5ccdf; background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), #eee9f3 calc(25% - 1px), #eee9f3 25%); }
.bar { min-width: 0; text-align: center; display: flex; align-items: end; justify-content: center; height: 100%; }
.bar-fill { flex: 1; max-width: 27px; min-width: 0; align-self: end; background: linear-gradient(#a78cde, #7652b7); border-radius: 4px 4px 0 0; }
.chart-axis { grid-column: 2; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.breakdown { padding: 3px 20px 20px; }
.breakdown > div { display: flex; gap: 13px; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.breakdown > div:last-child { border-bottom: 0; }
.breakdown dt { color: var(--muted); font-size: 13px; }
.breakdown dd { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 12px 15px; border-bottom: 1px solid #f0ecf4; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { color: var(--subtle); font-weight: 650; font-size: 12px; background: #fbf9fd; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfafe; }
.numeric { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.name-link { color: var(--text); text-decoration: none; font-weight: 670; }
.name-link:hover { text-decoration: underline; color: var(--accent-dark); }
.name-cell { display: flex; align-items: center; gap: 9px; min-width: 122px; }
.avatar { width: 34px; height: 34px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 10px; background: var(--accent-light); color: var(--accent-dark); font-weight: 700; }
.cell-meta, .muted { color: var(--muted); font-size: 12px; }
.cell-meta { margin-top: 3px; }
.badge { display: inline-flex; width: fit-content; max-width: 100%; padding: 4px 8px; border-radius: 6px; color: #53456d; background: #eeebf5; font-size: 11px; font-weight: 685; }
.badge.ok { background: #e8f4ee; color: #1a6145; }
.badge.fail { background: #fae9ed; color: #963149; }
.badge.pending { background: #f7f0de; color: #6d5017; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; padding: 15px 20px; }
.filter { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pagination { display: flex; gap: 10px; justify-content: center; margin: 16px 0 0; }
.detail-tabs { display: flex; gap: 12px; margin: 0 0 17px; border-bottom: 1px solid var(--line); }
.detail-tabs a { padding: 9px 5px 12px; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 620; text-decoration: none; color: var(--muted); }
.detail-tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent-dark); }
.turns { display: grid; gap: 12px; }
.turn { padding: 16px 18px; scroll-margin-top: 16px; }
.turn.highlighted, .journal-entry.highlighted { border-color: #8e6fc8; box-shadow: 0 0 0 2px #b298de45; }
.turn-head, .turn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.turn-head { margin-bottom: 13px; }
.turn-head time { margin-left: auto; color: var(--muted); font-size: 12px; }
.bubble { width: fit-content; max-width: min(85%, 720px); margin: 8px 0; padding: 10px 12px; border-radius: 5px 12px 12px 12px; background: #f1eafa; }
.bubble.reply { margin-left: auto; border: 1px solid var(--line); border-radius: 12px 5px 12px 12px; background: #fbfafc; }
.bubble h3 { margin-bottom: 4px; font-size: 11px; font-weight: 730; color: var(--accent-dark); }
.bubble p, .note-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.48; font-size: 14px; }
.turn-meta { margin-top: 13px; color: var(--muted); font-size: 12px; }
.turn-meta > span + span::before { content: "·"; margin-right: 8px; }
.turn-meta .quiet-button { margin-left: auto; min-height: 31px; padding: 6px 8px; }
.turn-detail { color: var(--muted); margin-top: 10px; font-size: 13px; }
.turn-detail summary { cursor: pointer; width: fit-content; color: var(--accent-dark); font-weight: 620; }
.turn-detail .table-wrap { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.media-photo { display: block; max-width: 100%; max-height: 270px; margin-top: 8px; border-radius: 6px; }
.media-audio { display: block; width: min(310px, 64vw); max-width: 100%; height: 40px; margin-top: 8px; }
.journal-day { margin-bottom: 12px; padding: 15px 18px; }
.journal-entry { display: grid; gap: 4px; padding: 10px; margin: 3px -2px; border: 1px solid transparent; border-radius: 9px; scroll-margin-top: 18px; }
.journal-entry + .journal-entry { border-top-color: #f3edf7; }
.journal-entry h3 { font-size: 14px; overflow-wrap: anywhere; }
.journal-summary { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 12px; margin: 6px 0; }
.journal-entry .journal-summary { margin: 0; }
.profile-grid { padding: 1px 20px 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 26px; }
.profile-grid > div { min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.profile-grid dt { font-size: 12px; color: var(--muted); }
.profile-grid dd { margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.inbox-list { padding: 0 20px; }
.inbox-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; }
.inbox-item + .inbox-item { border-top: 1px solid var(--line); }
.inbox-item header { display: flex; flex-wrap: wrap; gap: 7px 12px; align-items: center; margin-bottom: 5px; }
.inbox-item time { font-size: 12px; color: var(--muted); }
.inbox-item label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.issue-form { display: grid; gap: 10px; padding: 13px; margin-top: 9px; background: #f9f6fe; border-radius: 9px; }
.issue-form label { display: grid; gap: 4px; align-items: start; font-size: 12px; color: var(--muted); }
.issue-form textarea { width: 100%; min-height: 73px; resize: vertical; }
.issue-form .form-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.issue-preview { padding: 10px 12px; margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; }
.issue-preview p { margin-top: 5px; }
.startup { margin: 25vh auto; max-width: 28ch; text-align: center; color: var(--muted); }
.sign-in {
  min-height: 100vh; display: grid; align-items: center; justify-items: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 15%, #eae1ff 0%, #f7f3fd 47%, #f8f7fb 75%);
}
.sign-in-card { width: 100%; max-width: 402px; padding: 34px; background: white; border: 1px solid #e5dbf1; border-radius: 21px; box-shadow: 0 17px 50px #54378017; }
.sign-in h1 { margin-top: 26px; letter-spacing: -.045em; font-size: 29px; }
.sign-in-card > p { color: var(--muted); margin-top: 6px; }
.sign-in form { display: grid; gap: 8px; margin-top: 24px; }
.sign-in form label { font-size: 13px; font-weight: 650; }
.sign-in form input { min-height: 41px; }
.sign-in form button { margin-top: 6px; min-height: 40px; }
.sign-in .form-error { margin: 0; font-size: 13px; }

@media (max-width: 980px) {
  .app { grid-template-columns: 166px minmax(0, 1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 710px) {
  .app { display: block; }
  .sidebar { height: auto; position: static; padding: 11px 13px 0; display: grid; grid-template-columns: 1fr auto; row-gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .wordmark { padding-left: 1px; font-size: 24px; }
  .sidebar .nova-mark { width: 31px; height: 31px; font-size: 20px; margin-right: 7px; border-radius: 9px; }
  .nav { display: flex; flex-wrap: wrap; grid-row: 2; grid-column: 1 / -1; margin-top: 0; gap: 0; }
  .nav a { padding: 8px 7px 9px; border-radius: 7px 7px 0 0; font-size: 12px; }
  .nav-icon { width: 14px; font-size: 14px; }
  .nav a .nav-icon { display: none; }
  .logout { grid-row: 1; grid-column: 2; font-size: 12px; padding: 7px 8px; align-self: center; }
  .topbar { min-height: 51px; padding-block: 8px; align-items: flex-start; }
  .topbar-location { margin-top: 9px; white-space: nowrap; }
  .period { justify-content: flex-end; }
  .workspace { padding-top: 23px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric { padding: 12px; min-height: 93px; }
  .inbox-item { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .inbox-item label { justify-self: start; }
}
@media (max-width: 420px) {
  .topbar { flex-wrap: wrap; }
  .period { justify-content: flex-start; }
  .turn { padding: 12px; }
  .turn-head time { margin-left: 0; }
  .bubble { max-width: 96%; }
  .sign-in-card { padding: 24px; }
}

.chart-bars:has(> :nth-child(50)) { gap: 1px; }
.pagination-above { margin: 0 0 12px; }
.pagination:has(> [hidden]) { display: none; }
.error-code { color: var(--danger); overflow-wrap: anywhere; }
.linked-entries, .tool-list { padding-left: 22px; margin-top: 8px; font-size: 13px; line-height: 1.6; }
.reply-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.startup button { margin-top: 14px; }
.session-button { margin-top: 22px; min-height: 40px; }
