/* Cristal técnico: shared skin over the existing native components. */
:root {
  --brand: #B22222;
  --bg: #111113;
  --panel: #1a1a1e;
  --panel-raised: #232328;
  --line: #36363d;
  --text: #f1f0f2;
  --muted: #b5b4bd;
  --subtle: #aaa8b2;
  --accent: #edb5b5;
  --cyan: #d7d5de;
  --orange: #f2c58d;
  --success: #9ad5b4;
  font-size: 16px;
  background: var(--bg);
}
body { background: radial-gradient(ellipse at 60% 0, #29282d66, transparent 65%), var(--bg); }
button { background: #28282e; border-color: #44434b; border-radius: 8px; transition: background 140ms, border-color 140ms, box-shadow 140ms; }
button:hover { background: #35343c; border-color: #78737d; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: #982020; border-color: #e88787; box-shadow: 0 3px 18px color-mix(in srgb, var(--brand) 13%, transparent); }
button.small { font-size: 13px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #f1c6c6; outline-offset: 4px; }
input, textarea, select { background: #121215; border-color: #4b4952; font-size: 16px; }
input:focus, textarea:focus, select:focus { outline-color: #e5b5b5; }
input::placeholder, textarea::placeholder { color: #aaa7b3; }
label { font-size: 14px; color: #d5d3da; }
small, .meta { font-size: 12px; color: var(--muted); }
.eyebrow, .breadcrumb, .next-label, .mission-meta { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.eyebrow { font-size: 11px; letter-spacing: 1.3px; color: var(--muted); }
.eyebrow.accent { color: var(--accent); }
h1 { font-size: 32px; letter-spacing: -.8px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
.text-button { color: #e1d5d8; font-size: 14px; }
.text-button:hover, a:hover { color: #fff; }
.badge, .quiet-badge { font-size: 12px; background: #2c2b32; color: #d6d3dd; }
.quiet-badge { border-color: #47444d; background: transparent; }
.status-active, .status-completed, .status-verified, .status-reading, .status-writing { color: var(--success); background: #24362e; }
.status-active::before, .status-completed::before, .status-verified::before { content: '✓'; }
.status-failed { color: #ffc7cb; background: #4a2830; }
.status-failed::before { content: '×'; }
.status-verify, .status-approval_required, .status-blocked, .status-waiting_input, .status-permission, .status-cancel_unknown { color: var(--orange); background: #3e3429; }
.status-verify::before, .status-approval_required::before, .status-blocked::before, .status-cancel_unknown::before { content: '⚠'; }
.layout { grid-template-columns: 218px minmax(0, 1fr); }
.layout[data-panel="notes"], .layout[data-panel="jarwan"] { grid-template-columns: 218px minmax(0, 1fr) 340px; }
.sidebar { background: #161619ed; border-color: var(--line); padding: 28px 14px 18px; z-index: 25; }
.brand { margin-bottom: 42px; }
.brand-mark { color: #fff; background: var(--brand); border-radius: 9px; font-size: 26px; padding: 7px 10px; letter-spacing: -3px; transform: none; }
.brand small { color: var(--muted); letter-spacing: 1.7px; font-size: 9px; }
.nav-caption { color: var(--subtle); font-size: 10px; }
.sidebar nav button { font-size: 14px; color: var(--muted); min-height: 46px; }
.sidebar nav button:hover { background: #29272d; }
.sidebar nav button.on { color: #fff; background: color-mix(in srgb, var(--brand) 17%, transparent); box-shadow: inset 3px 0 var(--brand); }
.sidebar nav button.on .icon { color: #f4b7b7; }
.count { background: #40323a; }
.avatar { background: #32262c; border-color: #695058; color: #f0d0d5; }
.profile { font-size: 13px; }
.profile small { font-size: 11px; }
.focus-rail { background: #242024; border-color: #514048; }
.focus-rail > .text-button { color: var(--text); }
.main { padding: 0 32px 24px; }
.topbar { height: 86px; margin-bottom: 28px; gap: 16px; border-color: var(--line); }
.breadcrumb { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb strong { color: var(--text); }
.topbar > .flex { min-width: 0; }
.topbar form { background: #1b1b20; border-color: var(--line); width: 270px; min-width: 130px; margin-left: auto; }
.topbar form input { font-size: 13px; }
.topbar kbd { background: #27262d; border-color: #504c56; color: var(--muted); }
.panel-tools { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.panel-tools button[aria-expanded="true"] { background: color-mix(in srgb, var(--brand) 15%, transparent); border-color: #815051; color: #fff; }
.main-footer { border-color: var(--line); color: var(--subtle); margin-top: 36px; }
.page-head { margin-bottom: 24px; }
.page-head .eyebrow { display: none; }
.page-head p { font-size: 16px; color: var(--muted); }
.panel, .project-card, .mission-card, .note-card, .idea-card, .connection-card, .session-card, .resume-card {
  background: linear-gradient(145deg, #ffffff05, #ffffff00 65%), #1c1c20e8;
  border: 1px solid #ffffff17;
  border-radius: 12px;
  box-shadow: 0 6px 24px #00000016, inset 0 1px #ffffff04;
}
.panel-head { border-color: var(--line); padding: 19px 22px; }
.panel-head h2 { font-size: 18px; }
.panel-body { padding: 22px; }
.panel-body > p, .project-summary, .next-action > p, .mission-card > p, .note-card > p, .idea-card > p { font-size: 16px; }
.home-priority { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(245px, 1fr); gap: 20px; align-items: stretch; }
.resume-card { padding: 28px; background: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--brand) 8%, transparent), transparent 70%), linear-gradient(135deg, #262329, #1b1b1f); border-top: 2px solid var(--brand); }
.resume-card::after, .resume-card::before { display: none; }
.resume-card h2 { font-size: 28px; line-height: 1.25; margin: 18px 0 14px; color: var(--text); }
.resume-card > p { font-size: 16px; color: #ccc8d0; }
.resume-next { background: #12111480; border-left: 2px solid #ad6767; padding: 14px 16px; margin: 20px 0; }
.resume-next strong { font-size: 16px; color: #eee5e8; font-weight: 500; }
.next-label { color: #c6abb0; font-size: 11px; }
.resume-card > .flex.wrap button { font-size: 14px; }
details { background: #17161b; border-color: #3f3944; font-size: 14px; padding: 8px 12px; }
details > summary { color: #c8c3ce; font-size: 13px; cursor: pointer; padding: 6px 0; line-height: 1.5; }
details[open] > summary { color: #f1e8ed; }
.resume-source { margin-top: 16px; }
.quick-capture .panel-body { display: grid; gap: 16px; }
.quick-capture #quick-idea { display: grid; gap: 12px; margin: 0; }
.quick-capture #quick-idea label { margin: 0; }
.quick-capture #quick-idea input { font-size: 16px; background: #121215; }
.quick-capture #quick-idea .meta { font-size: 12px; }
.home-attention { margin-top: 20px; }
.home-attention .panel-body { padding-top: 14px; padding-bottom: 14px; }
.attention-list article { border-color: var(--line); }
.attention-list p { font-size: 15px; }
.attention-list h3 { font-size: 16px; }
.attention-clear { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.attention-clear .icon { color: var(--success); }
.section-title { margin-top: 30px; }
.section-title h2 { font-size: 22px; }
.project-grid { grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr)); gap: 18px; }
.project-grid > .project-card:nth-child(3):last-child { grid-column: auto; }
.project-card { padding: 22px 22px 0; border-top: 1px solid #ffffff22; }
.project-mark, .color-cyan .project-mark, .color-orange .project-mark, .color-violet .project-mark, .color-green .project-mark { color: #e9dfe4; background: #333037; border: 1px solid #56505b; }
.project-title h3 { font-size: 20px; }
.project-summary { margin: 16px 0; }
.next-action { background: #151518; border-color: #51454b; }
.next-action > span { color: #c9b4bc; font-size: 11px; }
.project-foot { color: var(--muted); font-size: 12px; }
.project-card > .provenance { background: #151518; border-color: var(--line); margin-left: -22px; margin-right: -22px; padding: 12px 22px; font-size: 12px; }
.home-more { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 8px; }
.source-refresh, .filter-notice, .registry-reference, .canonical-fact, .selection-note, .notice, .mission-flow { background: #222126; border-color: #48424c; color: #ddd5df; }
.source-state, .fact-provenance { font-size: 12px; }
.source-refresh { margin-top: 12px; }
.toolbar .selected, .filter.selected { background: color-mix(in srgb, var(--brand) 19%, transparent); border-color: #99565b; color: #fff; }
.detail-back { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.mission-contract { margin-top: 20px; }
.mission-meta, .mission-meta span { font-size: 12px; }
.mission-actions { border-color: var(--line); }
.note-card p, #notes-conflict p { white-space: pre-wrap; }
.empty p { font-size: 15px; }
.empty h3 { font-size: 17px; }
.event p { font-size: 15px; }
.event time, .event-meta { font-size: 12px; }
dialog { background: #1c1b20; border-color: #504952; }
dialog p { font-size: 16px; }
pre { background: #131216; border-color: #48424b; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-banner { background: #2b2520; border-color: #665143; color: #efd8b8; }
.notes-panel, .jarwan {
  position: sticky; top: 0; height: 100dvh; width: auto; min-width: 0;
  display: flex; flex-direction: column; padding: 0;
  background: linear-gradient(115deg, #ffffff04, transparent), #19191ded;
  border-left: 1px solid #ffffff1c; box-shadow: -10px 0 30px #00000010;
  z-index: 30; overflow: auto; animation: panel-enter 160ms ease-out;
}
.notes-panel[hidden], .jarwan[hidden], .panel-scrim[hidden] { display: none !important; }
.context-head, .jarwan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 24px 22px 20px; border-bottom: 1px solid var(--line); }
.context-head h2 { display: flex; align-items: center; gap: 9px; margin-top: 8px; font-size: 22px; }
.context-head .eyebrow { font-size: 10px; }
#notes-content { padding: 0 22px 24px; }
.notes-section { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.notes-section h3 { font-size: 14px; }
#notes-list { display: grid; gap: 6px; max-height: 180px; overflow: auto; margin: 8px 0 20px; }
.note-choice { display: grid; text-align: left; justify-content: stretch; gap: 4px; padding: 11px 12px; background: #ffffff03; border: 1px solid #ffffff10; }
.note-choice strong { font-size: 14px; overflow-wrap: anywhere; }
.note-choice small { font-size: 11px; }
.note-choice.selected { background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: #7e4b51; }
.notes-empty { padding: 10px 0; }
.note-owner { display: flex; gap: 8px; align-items: center; color: #d8c3cb; font-size: 13px; padding-top: 18px; border-top: 1px solid var(--line); }
#notes-body { min-height: 200px; }
#notes-save { width: 100%; margin-top: 12px; }
#notes-status { font-size: 13px; color: var(--success); margin-top: 12px; line-height: 1.5; }
#notes-status.note-error { color: #ffd0b0; }
.notes-storage { margin-top: 12px; }
.notes-placeholder { padding: 50px 0; display: grid; gap: 14px; color: var(--muted); }
.notes-placeholder > span { display: grid; place-items: center; width: 50px; height: 50px; background: #ffffff06; border: 1px solid var(--line); border-radius: 12px; }
.notes-placeholder h3 { color: var(--text); }
.jarwan-head { flex-wrap: wrap; }
.jarwan-head .quiet-badge { margin-left: 0; }
.jarwan-intro { padding: 20px; }
.jarwan-intro > .sprite { display: none; }
.jarwan-intro h3 { font-size: 20px; }
.jarwan-intro p { font-size: 15px; }
.jarwan-context, .jarwan-compose { padding: 20px; border-color: var(--line); }
.chat-message { background: #2b2830; border-color: #4c424d; }
.chat-message p { font-size: 15px; }
.chat-message.user { background: #3b292f; }
.panel-scrim { position: fixed; inset: 0; width: 100%; height: 100%; background: #0009; z-index: 49; border: 0; border-radius: 0; }
.panel-scrim:hover { background: #0009; }
@keyframes panel-enter { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 1101px) and (max-width: 1400px) {
  .layout, .layout[data-panel="notes"], .layout[data-panel="jarwan"] { grid-template-columns: 190px minmax(0, 1fr); }
  .layout[data-panel="notes"], .layout[data-panel="jarwan"] { grid-template-columns: 190px minmax(0, 1fr) 310px; }
  .main { padding-inline: 24px; }
  .context-open .home-priority { grid-template-columns: 1fr; }
  .context-open .quick-capture .panel-body { gap: 10px; }
  .context-open .topbar .breadcrumb { display: none; }
}
@media (max-width: 1100px) {
  .layout, .layout[data-panel="notes"], .layout[data-panel="jarwan"] { grid-template-columns: 190px minmax(0, 1fr); }
  .main { padding-inline: 24px; }
  .home-priority { grid-template-columns: 1fr; }
  .context-overlay { overflow: hidden; }
  .context-overlay .notes-panel, .context-overlay .jarwan { background: #1b1a1f; }
  .notes-panel, .jarwan, .chat-open .jarwan { position: fixed; inset: 0 0 0 auto; width: min(390px, 100%); height: 100dvh; z-index: 50; transform: none; }
  .topbar { gap: 10px; }
  .topbar .breadcrumb { display: none; }
}
@media (max-width: 760px) {
  .layout, .layout[data-panel="notes"], .layout[data-panel="jarwan"] { display: block; }
  .sidebar { position: fixed; width: 230px; transform: translateX(-100%); }
  .menu-open .sidebar { transform: none; }
  .mobile-menu { display: inline-flex; }
  .main { padding-inline: 20px; }
  .topbar { height: 76px; margin-bottom: 24px; }
  .topbar > .flex { flex-shrink: 0; }
  .topbar form { min-width: 38px; width: 38px; padding: 0 9px; border: 0; background: transparent; position: relative; }
  .topbar form input { position: absolute; width: 36px; height: 38px; inset: 0; font-size: 0; color: transparent; background: transparent; border: 0; padding: 0; }
  .topbar form input:focus { position: fixed; width: calc(100vw - 40px); left: 20px; top: 16px; height: 44px; background: #211e24; color: var(--text); font-size: 16px; padding: 11px; z-index: 35; }
  .topbar kbd { display: none; }
  .panel-tools button { min-height: 42px; padding: 8px 10px; }
  .page-head { align-items: flex-start; gap: 12px; }
  .page-head h1 { font-size: 28px; overflow-wrap: anywhere; }
  .page-head p { font-size: 16px; }
  .page-head > button { font-size: 12px; padding: 8px; flex-shrink: 0; }
  .resume-card { padding: 23px; }
  .resume-card h2 { font-size: 26px; }
  .resume-card > p, .resume-next strong { font-size: 16px; }
  #notes-list { max-height: 128px; }
  #notes-body { min-height: 160px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card > .meta { font-size: 12px; }
  .project-summary, .next-action > p, .panel-body > p { font-size: 16px; }
  .project-card > .provenance { font-size: 12px; }
  .two-columns, .notes-grid, .connection-grid { grid-template-columns: 1fr; }
  .section-title h2 { font-size: 21px; }
  .main-footer { flex-wrap: wrap; gap: 10px; }
  .main-footer span { font-size: 10px; }
  .review-banner { padding: 14px; }
  .review-banner span { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

.auth-card { background: #1c1b20; border-color: var(--line); }
.auth-card > p, .auth-card input { font-size: 16px; }
