:root {
  --ink: #17171b;
  --muted: #6d6c73;
  --line: #e7e5e2;
  --soft: #f7f6f4;
  --paper: #fff;
  --nav: #1a1a2e;
  --nav-2: #1b1d36;
  --orange: #ff4d27;
  --orange-dark: #dc3515;
  --orange-soft: #fff1eb;
  --green: #0e765a;
  --shadow: 0 18px 50px rgba(23, 20, 17, .10);
  --radius: 16px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 10px 14px; background: white; border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid rgba(255,77,39,.38); outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 16px 18px; display: flex; flex-direction: column; color: #e8e8ef; background: var(--nav); z-index: 30; }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 16px 27px; }
.brand { display: flex; flex-direction: column; }
.brand-name { color: var(--orange); font-size: 28px; font-weight: 800; letter-spacing: -.8px; line-height: 1; }
.brand-sub { margin-top: 5px; color: #9899aa; font-size: 10px; }
.sidebar-close { display: none; color: white; }
.account-card { width: 100%; min-height: 42px; margin: -8px 0 14px; padding: 0 12px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; color: #272733; background: #fff; text-align: left; cursor: pointer; font-size: 12px; font-weight: 700; }
.account-card:hover { border-color: var(--orange); }
.account-icon { color: #555665; text-align: center; }
.getting-started { width: 100%; margin-bottom: 17px; padding: 10px 11px 8px; border: 1px solid rgba(255,77,39,.42); border-radius: 9px; color: #ff7959; background: rgba(255,77,39,.08); cursor: pointer; text-align: left; }
.getting-started > span { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.getting-started small { font-size: 9px; }
.getting-started i { display: block; height: 3px; margin-top: 8px; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.16); }
.getting-started b { display: block; width: 80%; height: 100%; background: var(--orange); }
.nav-label { margin: 0 8px 7px; color: #686a82; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.primary-nav { display: grid; gap: 6px; }
.nav-item { min-height: 48px; padding: 0 15px; border-radius: 10px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; color: #d0d1da; font-size: 13px; transition: .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.065); color: white; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.075); box-shadow: inset 3px 0 var(--orange); }
.nav-item.active .nav-icon { color: var(--orange); }
.nav-icon { font-size: 18px; text-align: center; }
.nav-meta { min-width: 21px; padding: 2px 6px; border-radius: 9px; background: rgba(255,255,255,.09); color: #b9bac5; font-size: 10px; text-align: center; }
.nav-meta.alert { color: #ff8b72; background: rgba(255,77,39,.15); }
.sidebar-footer { margin-top: auto; display: grid; gap: 3px; }
.profile-button { width: 100%; padding: 12px; border: 0; background: transparent; color: white; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; text-align: left; border-radius: 10px; cursor: pointer; }
.profile-button:hover { background: rgba(255,255,255,.06); }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--nav); font-size: 12px; font-weight: 750; }
.profile-button strong, .profile-button small { display: block; }
.profile-button strong { font-size: 12px; }
.profile-button small { color: #9697a7; margin-top: 3px; }
.nav-item.quiet { min-height: 42px; }

.workspace { min-width: 0; }
.topbar { height: 64px; padding: 0 26px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.35px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 9px; display: grid; place-items: center; background: transparent; cursor: pointer; }
.icon-btn svg, .search-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-btn.sidebar-close { display: none; }
.icon-btn:hover { background: var(--soft); }
.menu-button { display: none; }
.search-button { height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-size: 12px; }
.explore-button { height: 38px; margin-left: 6px; padding: 0 14px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 8px; color: #fff; background: #FF7033; cursor: pointer; font-size: 11px; font-weight: 700; }
.explore-button:hover { background: var(--orange-dark); }
kbd { padding: 3px 5px; border: 1px solid #dedbd7; border-radius: 5px; background: #f7f6f4; color: #7a7874; font-size: 9px; }

.main-layout { display: grid; grid-template-columns: minmax(570px, 1fr) 380px; min-height: calc(100vh - 64px); }
.today-column { width: min(100%, 880px); padding: 46px 44px 70px; justify-self: center; }
.greeting-row { margin-bottom: 26px; display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--orange-dark); font-size: 10px; font-weight: 750; letter-spacing: 1.5px; text-transform: uppercase; }
.sun { display: inline-block; margin-right: 5px; font-size: 14px; }
.greeting-row h2 { margin: 0; font-size: clamp(28px, 3vw, 38px); letter-spacing: -1.5px; }
.greeting-copy { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.date-label { flex: none; color: var(--muted); font-size: 11px; }

.priority-card { padding: 25px 27px 23px; border: 1px solid #ffceb9; border-radius: var(--radius); background: radial-gradient(circle at 94% 0, #fff5ef 0, #fff 38%); box-shadow: 0 8px 30px rgba(206,91,46,.06); }
.priority-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.priority-pill { display: inline-flex; width: max-content; padding: 5px 9px; color: var(--orange-dark); background: var(--orange-soft); border-radius: 20px; font-size: 10px; font-weight: 700; }
.confidence { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.confidence-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.priority-heading { margin: 9px 0 21px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.overline { margin: 0 0 5px; color: #8a8580; font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.priority-heading h3 { margin: 0; font-size: clamp(23px, 2.5vw, 31px); line-height: 1.14; letter-spacing: -1px; }
.round-arrow { width: 42px; height: 42px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 22px; cursor: pointer; transition: .18s ease; }
.round-arrow:hover { color: white; border-color: var(--orange); background: var(--orange); transform: translateX(2px); }
.decision-facts { margin: 0; border-top: 1px solid var(--line); }
.decision-facts > div { display: grid; grid-template-columns: 195px 1fr; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); align-items: center; }
.decision-facts dt { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; }
.decision-facts dd { margin: 0; color: #57555a; font-size: 12px; line-height: 1.45; }
.decision-facts dd strong { color: #dd3213; }
.fact-icon { width: 28px; height: 28px; display: grid; place-items: center; background: var(--soft); border-radius: 50%; font-size: 15px; }
.fact-icon.warning { color: #e53819; }
.evidence-row { padding: 12px 2px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; }
.evidence-row strong { color: var(--ink); }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--ink); font-size: 11px; font-weight: 650; cursor: pointer; }
.text-button:hover { color: var(--orange-dark); }
.primary-button { width: 100%; min-height: 44px; padding: 0 18px; border: 0; border-radius: 8px; display: flex; justify-content: center; align-items: center; gap: 10px; color: #fff; background: linear-gradient(110deg, #ff3e1f, #ff582e); box-shadow: 0 6px 15px rgba(255,77,39,.18); font-weight: 700; font-size: 12px; cursor: pointer; transition: .18s ease; }
.primary-button:hover { background: linear-gradient(110deg, #e93719, #ef4824); transform: translateY(-1px); }

.list-section { margin-top: 27px; scroll-margin-top: 100px; }
.section-heading { margin-bottom: 11px; display: flex; justify-content: space-between; align-items: end; }
.section-heading h3 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.stacked-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list-row { width: 100%; min-height: 63px; padding: 9px 15px; border: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 12px; background: white; text-align: left; cursor: pointer; transition: .16s ease; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fcfaf8; }
.rank { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 10px; font-weight: 700; }
.row-content strong, .row-content small { display: block; }
.row-content strong { font-size: 12px; font-weight: 650; }
.row-content small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.row-side { display: flex; align-items: center; gap: 13px; }
.time-chip { padding: 4px 7px; border-radius: 6px; background: var(--soft); color: var(--muted); font-size: 9px; }
.row-arrow { font-size: 18px; transition: .16s ease; }
button:hover .row-arrow { transform: translateX(3px); }
.watch-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.watch-row { min-height: 72px; padding: 10px 15px; border: 0; border-right: 1px solid var(--line); display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; background: white; text-align: left; cursor: pointer; }
.watch-row:last-child { border: 0; }
.watch-row:hover { background: #fcfaf8; }
.watch-row strong, .watch-row small { display: block; }
.watch-row strong { font-size: 10px; line-height: 1.3; }
.watch-row small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.watch-row small.change { color: var(--orange-dark); }
.change i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--orange); }
.watch-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); }
.watch-icon.orange { background: var(--orange-soft); color: var(--orange-dark); }

.chat-panel { position: sticky; top: 82px; height: calc(100vh - 82px); padding: 39px 26px 22px; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: linear-gradient(160deg, #fffaf6 0, #fff 42%, #fff7f2 100%); overflow: hidden; }
.chat-heading { display: flex; align-items: flex-start; gap: 12px; }
.sapio-mark { color: var(--orange); font-size: 26px; line-height: 1; }
.chat-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.7px; }
.chat-heading .eyebrow { margin-bottom: 5px; }
.chat-intro { margin: 12px 0 18px 38px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.prompt-list { display: grid; gap: 8px; }
.prompt-button { width: 100%; min-height: 55px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 9px; background: rgba(255,255,255,.82); text-align: left; cursor: pointer; transition: .16s ease; }
.prompt-button:hover { border-color: #ffc2ac; box-shadow: 0 4px 14px rgba(197,97,52,.07); transform: translateY(-1px); }
.prompt-button strong, .prompt-button small { display: block; }
.prompt-button strong { font-size: 11px; }
.prompt-button small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.chat-thread { flex: 1; min-height: 105px; margin: 14px 0 10px; padding-right: 4px; overflow-y: auto; scrollbar-width: thin; }
.empty-chat { height: 100%; display: grid; place-content: center; color: #aaa6a2; text-align: center; }
.empty-chat span { color: #ffc3ae; font-size: 20px; }
.empty-chat p { margin: 8px 0 0; font-size: 9px; line-height: 1.5; }
.message { max-width: 92%; margin-bottom: 9px; padding: 10px 12px; border-radius: 12px; font-size: 10px; line-height: 1.5; animation: message-in .25s ease both; }
.message.user { margin-left: auto; color: #fff; background: #292a38; border-bottom-right-radius: 3px; }
.message.assistant { background: white; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.message.assistant::before { content: "✦ Sapio"; display: block; margin-bottom: 5px; color: var(--orange-dark); font-weight: 750; font-size: 8px; letter-spacing: .5px; text-transform: uppercase; }
.typing { color: var(--muted); }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }
.chat-form { padding: 10px 10px 8px 13px; border: 1px solid #ddd9d5; border-radius: 13px; background: white; box-shadow: 0 8px 24px rgba(34,29,25,.06); }
.chat-form textarea { width: 100%; padding: 0; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; line-height: 1.4; }
.chat-form textarea::placeholder { color: #aaa6a2; }
.chat-form-footer { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; }
.chat-form-footer span { color: #99958f; font-size: 8px; }
.send-button { width: 31px; height: 31px; border: 0; border-radius: 50%; color: white; background: var(--orange); font-size: 16px; cursor: pointer; }
.send-button:hover { background: var(--orange-dark); }
.disclaimer { margin: 8px 0 0; color: #aaa6a2; font-size: 8px; text-align: center; }

.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(16,16,26,.44); backdrop-filter: blur(2px); }
.review-drawer { position: fixed; z-index: 60; inset: 0 0 0 auto; width: min(600px, 100%); display: grid; grid-template-rows: auto 1fr auto; background: white; box-shadow: -24px 0 60px rgba(10,10,20,.20); animation: drawer-in .27s cubic-bezier(.2,.8,.2,1); }
.review-drawer[hidden], .backdrop[hidden] { display: none; }
@keyframes drawer-in { from { transform: translateX(100%); } }
.drawer-header { padding: 25px 28px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.drawer-header h2 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -.7px; }
.drawer-header .eyebrow { margin-bottom: 5px; }
.drawer-header .icon-btn { flex: none; font-size: 24px; }
.drawer-body { padding: 25px 28px 35px; overflow-y: auto; }
.drawer-summary { padding: 18px; border-radius: 12px; background: var(--orange-soft); }
.drawer-summary p { margin: 12px 0 0; font-size: 12px; line-height: 1.55; }
.recommendation { margin-top: 24px; }
.recommendation h3 { margin: 5px 0 7px; font-size: 21px; }
.recommendation > p:last-of-type { color: var(--muted); font-size: 12px; line-height: 1.55; }
.recommendation-stats { margin-top: 17px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; }
.recommendation-stats span { padding: 13px; border-right: 1px solid var(--line); }
.recommendation-stats span:last-child { border: 0; }
.recommendation-stats strong, .recommendation-stats small { display: block; }
.recommendation-stats strong { font-size: 17px; }
.recommendation-stats small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.evidence-details { margin-top: 23px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.evidence-details summary { padding: 16px 0; display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.evidence-details summary span { color: var(--muted); font-size: 10px; font-weight: 500; }
.evidence-details ul { margin: 0; padding: 0 0 13px; list-style: none; }
.evidence-details li { padding: 9px 0 9px 15px; border-left: 2px solid #ffd1bf; }
.evidence-details li span, .evidence-details li small { display: block; }
.evidence-details li span { font-size: 11px; font-weight: 650; }
.evidence-details li small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.ask-context-button { width: 100%; margin-top: 19px; padding: 13px; border: 1px solid #ffc4ae; border-radius: 9px; color: var(--orange-dark); background: #fffaf8; font-size: 11px; font-weight: 650; cursor: pointer; }
.ask-context-button:hover { background: var(--orange-soft); }
.decision-note { margin-top: 22px; }
.decision-note label { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; }
.decision-note label span { color: var(--muted); font-size: 9px; font-weight: 400; }
.decision-note textarea { width: 100%; margin-top: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; resize: vertical; font-size: 11px; }
.drawer-actions { padding: 17px 28px; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto auto 1fr; gap: 9px; background: white; }
.secondary-button { min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 11px; font-weight: 650; cursor: pointer; }
.secondary-button:hover { background: var(--soft); }
.approve-button { min-width: 205px; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; max-width: calc(100% - 30px); padding: 12px 18px; border-radius: 9px; color: white; background: #22232d; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: .24s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.modal-open { overflow: hidden; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .main-layout { grid-template-columns: minmax(510px, 1fr) 330px; }
  .today-column { padding: 38px 30px 60px; }
  .chat-panel { padding-left: 20px; padding-right: 20px; }
  .decision-facts > div { grid-template-columns: 160px 1fr; }
}

@media (max-width: 940px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 260px; transition: transform .24s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .icon-btn.sidebar-close, .menu-button { display: grid; }
  .topbar { padding: 0 20px; }
  .explore-button { padding: 0 11px; font-size: 0; }
  .explore-button span { font-size: 14px; }
  .main-layout { grid-template-columns: 1fr; }
  .today-column { width: min(100%, 760px); }
  .chat-panel { position: relative; top: auto; height: auto; min-height: 590px; border-top: 1px solid var(--line); border-left: 0; padding: 35px max(24px, calc((100% - 700px)/2)) 30px; }
  .chat-thread { height: 190px; flex: none; }
}

@media (max-width: 600px) {
  .topbar { height: 68px; padding: 0 14px; }
  .topbar p, .top-actions .icon-btn, .search-button kbd, .explore-button { display: none; }
  .search-button { width: 38px; padding: 0; justify-content: center; font-size: 0; }
  .search-button span { font-size: 18px; }
  .main-layout { min-height: calc(100vh - 68px); }
  .today-column { padding: 27px 15px 45px; }
  .greeting-row { align-items: flex-start; }
  .greeting-row h2 { font-size: 29px; }
  .date-label { display: none; }
  .priority-card { padding: 20px 17px 17px; }
  .confidence { display: none; }
  .priority-heading h3 { font-size: 24px; }
  .round-arrow { display: none; }
  .decision-facts > div { grid-template-columns: 1fr; gap: 7px; padding: 13px 0; }
  .decision-facts dt { gap: 7px; }
  .fact-icon { width: 24px; height: 24px; font-size: 12px; }
  .evidence-row { align-items: flex-start; gap: 10px; }
  .watch-grid { grid-template-columns: 1fr; }
  .watch-row { border-right: 0; border-bottom: 1px solid var(--line); }
  .row-content small, .time-chip { display: none; }
  .list-row { padding-left: 11px; }
  .chat-panel { top: auto; min-height: 620px; padding: 30px 15px 22px; }
  .chat-intro { margin-left: 0; }
  .review-drawer { width: 100%; }
  .drawer-header, .drawer-body { padding-left: 18px; padding-right: 18px; }
  .drawer-header h2 { font-size: 21px; }
  .recommendation-stats { grid-template-columns: 1fr; }
  .recommendation-stats span { border-right: 0; border-bottom: 1px solid var(--line); }
  .drawer-actions { padding: 12px; grid-template-columns: 1fr 1fr; }
  .approve-button { min-width: 0; grid-column: 1 / -1; grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
