:root {
  color-scheme: light;
  --bg: #f6f6f4; --surface: #fcfcfb; --surface-2: #f0f0ed; --line: #e3e2dd; --line-strong: #cfcdc6;
  --text: #0b0b0b; --text-2: #52514e; --muted: #77756f;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e6f0fc;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --good: #0b7a3e; --bad: #c0392b; --warn: #946200;
  --area-op: .12; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 10px rgba(0,0,0,.04);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2e2e2b; --line-strong: #3d3d39;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #94938a;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #1c2b3f;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --good: #4cc27f; --bad: #ff8a7a; --warn: #e3b341; --area-op: .18; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2e2e2b; --line-strong: #3d3d39;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #94938a;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #1c2b3f;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --good: #4cc27f; --bad: #ff8a7a; --warn: #e3b341; --area-op: .18; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings: "tnum" 1; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); min-height: 1em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.pos { color: var(--good); } .neg { color: var(--text); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; } h2 { font-size: 15px; margin: 0 0 10px; } h3 { font-size: 13px; margin: 0 0 8px; color: var(--text-2); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; min-width: 0; max-width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; font-size: 12px; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.chip.warn { color: var(--warn); } .chip.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

/* layout */
.nav { position: fixed; inset: 0 auto 0 0; width: 228px; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; padding: 4px 10px 16px; }
.logo { width: 24px; height: 24px; border-radius: 7px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM14 4v4h4M9 13h6M9 16.5h4' stroke='white' stroke-width='1.7' fill='none' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav svg, .tabbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
main { margin-left: 228px; padding: 22px 28px 48px; }
#view { max-width: 1180px; margin: 0 auto; }
.tabbar { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; flex: 1; }
.hero { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.hero-sub { color: var(--text-2); font-size: 13px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.stat .l { font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

/* charts */
.chart { display: block; width: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis0 { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.dashed { stroke-dasharray: 4 4; stroke-width: 1.6; }
.chart .area { opacity: var(--area-op); }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .bar { stroke: var(--surface); stroke-width: 0; }
.chart .clickable { cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.dash { height: 3px; vertical-align: 2px; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.14); font-size: 12px; min-width: 150px; display: none; }
.tip-h { font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; } .tip-row span { flex: 1; color: var(--text-2); } .tip-row i { width: 8px; height: 8px; border-radius: 2px; }
.spark { display: block; }

/* lists */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row.click { cursor: pointer; border-radius: 8px; }
.row.click:hover { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #fff; }
.group-h { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 4px 6px; font-weight: 650; border-bottom: 1px solid var(--line); }
.group-h .num { font-weight: 650; }
.barline { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.barline > i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }
.barline.over > i { background: var(--series-2); }
.barline .mark { position: relative; }
table.tx { width: 100%; border-collapse: collapse; }
table.tx th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.tx td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tx tr.click { cursor: pointer; } table.tx tr.click:hover td { background: var(--surface-2); }
table.tx td.desc { max-width: 340px; } table.tx .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.tx tr.sel td { background: var(--accent-soft); }
.day-h td { background: var(--bg) !important; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px 8px !important; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 11px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.monthpick { display: inline-flex; align-items: center; gap: 4px; }
.monthpick b { min-width: 118px; text-align: center; }
.icon-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); margin-bottom: 16px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; }
.kv label { color: var(--text-2); font-size: 13px; }
.tag-kind { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.32); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: 18px 20px 40px; box-shadow: -8px 0 30px rgba(0,0,0,.12); }
.drawer-panel .close { position: absolute; top: 12px; right: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.skeleton { height: 220px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 1020px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 899px) {
  .nav { display: none; }
  main { margin-left: 0; padding: 14px 16px calc(78px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; }
  .tabbar a.on { color: var(--accent-ink); font-weight: 600; }
  .tabbar svg { width: 22px; height: 22px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .hero { font-size: 26px; }
  .card { padding: 14px; border-radius: 12px; }
  table.tx .hide-m { display: none; }
  table.tx td.desc { max-width: 52vw; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
  h1 { font-size: 20px; }
}
.show-m { display: none; }
@media (max-width: 899px) { .show-m { display: inline; } }
.grow { flex: 1; min-width: 0; }
table.tx.fixed { table-layout: fixed; }
table.tx.fixed td.desc { max-width: none; }
table.tx .cat-col { width: 150px; }
@media (max-width: 899px) { table.tx .cat-col { width: 104px; } }
@media (max-width: 899px) { .banner { display: block; } .banner .btn { margin-top: 6px; } }

/* Ask AI */
.ask { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; min-height: calc(100vh - 140px); }
.ask-list { display: flex; flex-direction: column; gap: 4px; }
.ask-list .row { padding: 8px 10px; border: 0; border-radius: 9px; }
.ask-list .row.on { background: var(--accent-soft); color: var(--accent-ink); }
.ask-main { display: flex; flex-direction: column; min-width: 0; }
.ask-msgs { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 12px; }
.msg { max-width: 899px; }
.msg.user { align-self: flex-end; background: var(--accent-soft); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.ai { align-self: flex-start; width: 100%; }
.msg.ai .body { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 12px 16px; overflow-wrap: anywhere; }
.msg.ai .body p { margin: 0 0 8px; } .msg.ai .body p:last-child { margin-bottom: 0; }
.msg.ai .body ul, .msg.ai .body ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.ai .body table { border-collapse: collapse; margin: 6px 0; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.msg.ai .body th, .msg.ai .body td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.msg.ai .body h3, .msg.ai .body h4 { margin: 8px 0 4px; font-size: 14px; color: var(--text); }
.msg .src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.msg .status { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ask-input { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 4px; display: flex; gap: 8px; align-items: flex-end; }
.ask-input textarea { flex: 1; resize: none; min-height: 44px; max-height: 180px; border-radius: 12px; padding: 11px 14px; }
.ask-input .icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); border-color: var(--accent); color: #fff; }
.ask-input { flex-wrap: wrap; }
.ask-input .webrow { flex: 0 0 100%; }
.ask-input .webtoggle { cursor: pointer; font: inherit; font-size: 13px; padding: 6px 12px; min-height: 32px; }
.ask-input .webtoggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.msg .src .chip.web { text-decoration: none; }
.ask-sugg { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.ask-sugg button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 7px 12px; cursor: pointer; text-align: left; }
.dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }
@media (max-width: 899px) {
  .ask { grid-template-columns: 1fr; min-height: auto; }
  .ask-side { display: none; } .ask-side.open { display: block; }
  .ask-input { bottom: calc(64px + env(safe-area-inset-bottom)); }
}


/* shared */
.tabbar a.tab-main svg { width: 26px; height: 26px; color: var(--accent); }
.stats { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.tabbar a { min-height: 44px; justify-content: center; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.chip.bad { color: var(--bad); border-color: var(--bad); background: transparent; }
.chip.good { color: var(--good); }
.icon-btn { width: 40px; height: 40px; flex: none; }
.menu { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 4px; box-shadow: 0 8px 28px rgba(0,0,0,.18); min-width: 190px; max-width: calc(100vw - 16px); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.menu button:hover { background: var(--surface-2); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.quick input { flex: 1 1 260px; min-height: 44px; border-radius: 12px; padding: 8px 14px; }
.quick .btn { min-height: 44px; border-radius: 12px; }
.btn { min-height: 38px; }
.btn.small { min-height: 32px; }
.toast { display: flex; align-items: center; gap: 14px; bottom: 28px; }
.toast .btn { background: transparent; color: var(--bg); border-color: var(--bg); min-height: 32px; padding: 3px 12px; }
.day-sep { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 4px 2px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: var(--text); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline input[type=number] { width: 80px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 99px; padding: 6px 12px; cursor: pointer; min-height: 38px; }
.pick label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.preview { background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 8px 12px; font-weight: 600; margin-bottom: 12px; }
.note-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.note-box.warn { color: var(--warn); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.codebox { font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
pre.code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; white-space: pre; max-width: 100%; }
.row .btn, .row .icon-btn { flex: none; }
.row.wrap { flex-wrap: wrap; }
.sugg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sugg:last-child { border-bottom: 0; }
.explain { white-space: pre-wrap; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.chart text { font-family: inherit; }
@media (max-width: 899px) {
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); justify-content: space-between; }
  .cols2 { grid-template-columns: 1fr 1fr; }
  .drawer-panel { padding: 16px 16px 40px; }
  .filters select { flex: 1 1 40%; }
  .quick .btn { flex: 1 1 40%; }
  input, select, textarea { font-size: 16px; }
}

/* Ask AI: suggestion checklists */
.acts { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.acts-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.acts-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.acts-head .grow { flex: 1 1 140px; }
.acts-list { display: flex; flex-direction: column; gap: 6px; }
.acard { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface-2); min-width: 0; }
.acard.done { opacity: .75; }
.acard .ck { display: flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; cursor: pointer; }
.acard .ck input { width: 20px; height: 20px; }
.acard .abody { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.acard .atitle { font-weight: 600; }
.acard .ameta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.acard .adiff { font-size: 13px; margin-top: 3px; } .acard .adiff .was { text-decoration: line-through; color: var(--muted); }
.acard .abtns { display: flex; gap: 6px; flex-shrink: 0; }
.acts .btn { min-height: 40px; }
.acts-skip { margin: 8px 0 0; }
@media (max-width: 899px) {
  .acard { flex-wrap: wrap; } .acard .abody { flex-basis: calc(100% - 60px); }
  .acard .abtns { width: 100%; } .acard .abtns .btn { flex: 1; }
  .acts-head .btn { flex: 1 1 auto; }
}

/* Pantry */
.chip.good { color: var(--good); } .chip.bad { color: var(--bad); border-color: var(--bad); background: transparent; }
.chip.low { color: var(--warn); border-color: var(--warn); background: transparent; }
.chip.expired { color: var(--bad); border-color: var(--bad); background: transparent; font-weight: 600; }
.chip.expiring { color: var(--warn); border-color: var(--warn); background: transparent; font-weight: 600; }
.page-head h1 { min-width: 0; }
.seg.wrap { flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; min-height: 40px; white-space: nowrap; }
.chips button.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.suggest { position: relative; flex: 1 1 200px; min-width: 0; }
.suggest input { width: 100%; }
.sg-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.16); max-height: 240px; overflow-y: auto; }
.sg-list button { display: flex; width: 100%; text-align: left; padding: 10px 12px; min-height: 42px; border: 0; background: transparent; cursor: pointer; justify-content: space-between; gap: 8px; align-items: center; }
.sg-list button:hover, .sg-list button.act { background: var(--surface-2); }
@media (max-width: 1020px) { .weekgrid { grid-template-columns: 1fr; } .daycol { min-height: 0; } }
@media (max-width: 900px) {
  .rcp-row { grid-template-columns: 1fr 1fr; padding: 10px 0; }
  .rcp-row.head { display: none; }
  .rcp-row .full { grid-column: 1 / -1; }
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { min-width: 0; }
.acard .aedit { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.acard .aedit select, .acard .aedit input { min-height: 38px; }
.acard .aedit .num-in { width: 76px; }
.acard .aedit select { max-width: 150px; }
.acard.skip { opacity: .7; }
.acts-head .chip { flex: none; }
.statrow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.statrow a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; text-decoration: none; }
.statrow a:hover { border-color: var(--line-strong); }
@media (max-width: 899px) { .statrow { grid-template-columns: repeat(2, minmax(0, 1fr)); } .statrow a:last-child { grid-column: 1 / -1; } }
.tabbar a { min-width: 0; }
.tabbar .tab-main { position: relative; }
.row .main .t.wrapt { white-space: normal; overflow-wrap: anywhere; }
.swatches button { min-width: 36px; }
.mem-row { display: flex; gap: 8px; align-items: center; min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mem-row .grow { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.mem-row input { flex: 1 1 160px; }
.log-row .btn { min-height: 40px; }
@media (max-width: 899px) {
  .ing-edit { grid-template-columns: minmax(0, 1fr) 60px 70px 40px 40px; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .addbar .qty { width: 68px; }
  .addbar select { max-width: 92px; }
  .addbar .btn { flex: 1 1 100%; }
  .meal .btn { min-height: 40px; }
}
@media (max-width: 899px) { .btn.small { min-height: 40px; } .icon-btn { min-width: 40px; } .seg button { min-height: 40px; } }
a.btn { display: inline-flex; align-items: center; justify-content: center; }
.ask-input .webtoggle { white-space: normal; text-align: left; border-radius: 14px; }
.ask-sugg button { min-height: 40px; }
.swatches button { width: 40px; height: 40px; }
@media (max-width: 899px) { select, input:not([type=checkbox]):not([type=radio]):not([type=file]) { min-height: 40px; } }

/* hub app switcher: a fixed slot so it works with the sidebar (desktop) and the tab bar layout (mobile) */
#integ-nav.integ-slot { position: fixed; z-index: 45; top: 12px; left: 184px; }
#integ-nav.integ-slot .integ-nav-btn { width: 32px; height: 32px; }
@media (max-width: 899px) { #integ-nav.integ-slot { left: auto; right: 12px; top: calc(10px + env(safe-area-inset-top)); } #integ-nav.integ-slot .integ-nav-menu { left: auto; right: 0; } #app:has(#integ-nav.integ-nav) #main { padding-top: calc(52px + env(safe-area-inset-top)); } }

/* ===================== Notes ===================== */
:root { --sel: rgba(42,120,214,.22); --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sheet-list button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; min-height: 52px; margin-bottom: 8px; cursor: pointer; }
.sheet-list button:hover { background: var(--surface-2); }
.sheet-list svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sheet-list small { display: block; color: var(--muted); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.icon-btn.mini { width: 28px; height: 28px; min-width: 0; border-radius: 7px; }
.icon-btn.mini svg { width: 14px; height: 14px; }
.kbd { display: inline-block; font: 600 11px/1 var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; color: var(--text-2); background: var(--surface-2); margin-left: auto; white-space: nowrap; }
.m-only { display: none; }
.grow { flex: 1; min-width: 0; }
.chips-inline { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip.dim { opacity: .65; border-style: dashed; }
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
a.stat-card:hover { border-color: var(--line-strong); text-decoration: none; }
.stat-card .v { font-size: 22px; font-weight: 650; display: flex; align-items: center; min-height: 30px; }
.stat-card .v svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-card .l { font-size: 12px; color: var(--muted); }

/* nav extras */
.nav { overflow-y: auto; gap: 1px; }
.nav a { padding: 6px 10px; }
.nav .brand { padding-bottom: 12px; }
.tree-head { display: flex; align-items: center; gap: 4px; padding: 2px 6px 2px 10px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tree-head span { flex: 1; }
.tree-head .icon-btn { border-color: transparent; background: transparent; }
.nav .tree { flex: 1 1 120px; overflow-y: auto; min-height: 120px; }
.nav-foot { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.tree svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tree .tr-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px calc(8px + var(--d, 0) * 14px); border-radius: 7px; color: var(--text-2); font-size: 13px; min-height: 28px; cursor: pointer; text-decoration: none; position: relative; }
.tree .tr-row:hover { background: var(--surface-2); text-decoration: none; }
.tree .tr-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .tr-folder { font-weight: 550; color: var(--text); }
.tree .tr-folder.cur .nm { color: var(--accent-ink); }
.tree .tr-note.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tree .tr-row .cnt, .tr-sec-h .cnt { font-size: 11px; color: var(--muted); font-weight: 400; }
.tree .caret { transition: transform .12s; stroke: var(--muted); }
.tree .caret.open { transform: rotate(90deg); }
.tree .pin { width: 12px; height: 12px; stroke: var(--muted); }
.tree .tr-more { opacity: 0; border: 0; background: transparent; width: 24px; height: 24px; padding: 0; border-radius: 6px; cursor: pointer; display: grid; place-items: center; color: var(--text-2); flex: none; }
.tree .tr-row:hover .tr-more, .tree .tr-more:focus-visible { opacity: 1; }
.tree .tr-more:hover { background: var(--line); }
.tree .drop-on { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.tr-sec-h { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; padding: 6px 8px 3px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; cursor: pointer; text-align: left; }
.tr-sec-h.plain { cursor: default; }
.tree-host.tree .tr-root { min-height: 60px; padding-bottom: 12px; }

/* modal, menu additions */
.modal { position: fixed; inset: 0; z-index: 65; }
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.32); }
.modal-box { position: absolute; top: 11vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); max-height: 76vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px 18px; box-shadow: 0 18px 60px rgba(0,0,0,.28); }
.modal-box.small { width: min(440px, calc(100vw - 24px)); }
.modal-box.palette { padding: 12px; }
.qs-in { width: 100%; font-size: 16px; padding: 10px 12px; border-radius: 10px; }
.qs-list { margin-top: 8px; max-height: 50vh; overflow-y: auto; }
.qs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; min-height: 40px; }
.qs-item svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; flex: none; }
.qs-item.on, .qs-item:hover { background: var(--accent-soft); }
.qs-item.dis { opacity: .5; }
.qs-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qs-foot .kbd { margin-left: 0; }
.menu-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px 6px; flex-wrap: wrap; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu-title { padding: 8px 12px 2px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.menu button { display: flex; align-items: center; gap: 12px; }
.menu button:disabled { opacity: .45; cursor: default; }
.menu button:disabled:hover { background: transparent; }
.kv-list .row { padding: 7px 2px; min-height: 0; }

/* note page */
.note-main-wrap { padding: 0 !important; }
.note-main-wrap #view { max-width: none; margin: 0; }
.note-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: 100vh; }
.note-page.no-side { grid-template-columns: minmax(0, 1fr); }
.note-page.no-side .note-side { display: none; }
.note-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; background: var(--bg); }
.note-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 18px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; flex: none; }
.note-bar .icon-btn { width: 34px; height: 34px; }
.back-btn { display: none !important; }
.mode-m { display: none; }
.mode-seg button { padding: 5px 11px; }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status.warn { color: var(--warn); font-weight: 600; } .save-status.err { color: var(--bad); font-weight: 600; }
.ai-btn { border-color: var(--line-strong); }
.note-head { padding: 14px 28px 0; flex: none; max-width: 940px; width: 100%; margin: 0 auto; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; }
.crumbs .sep { opacity: .6; }
.title-row { display: flex; align-items: center; gap: 8px; }
.note-title { flex: 1; font-size: 26px; font-weight: 700; letter-spacing: -.01em; border: 0; background: transparent; padding: 2px 0; border-radius: 0; border-bottom: 2px solid transparent; }
.note-title:focus { outline: none; border-bottom-color: var(--accent); }
.pin-ind { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#note-banners .banner { margin: 8px 18px 0; }
.banner.conflict { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.note-ed { flex: 1; min-height: 0; position: relative; }
.note-foot { display: flex; align-items: center; gap: 10px; padding: 5px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex: none; background: var(--surface); }
.note-foot .chip { font-size: 11px; }
.ed-wrap { display: flex; height: 100%; }
.ed-cm { flex: 1; min-width: 0; height: 100%; }
.ed-cm .cm-editor { height: 100%; background: transparent; color: var(--text); font: 15.5px/1.7 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.ed-cm .cm-editor.cm-focused { outline: none; }
.ed-cm .cm-scroller { overflow: auto; font-family: inherit; line-height: inherit; }
.ed-cm .cm-content { max-width: 940px; margin: 0 auto; padding: 10px 28px 160px; caret-color: var(--text); }
.ed-cm .cm-line { padding: 0 2px; }
.ed-cm .cm-cursor, .ed-cm .cm-dropCursor { border-left: 2px solid var(--text); }
.ed-cm .cm-selectionBackground, .ed-cm .cm-focused .cm-selectionBackground { background: var(--sel) !important; }
.ed-cm .cm-placeholder { color: var(--muted); }
.mode-source .ed-cm .cm-editor, .mode-split .ed-cm .cm-editor { font-family: var(--mono); font-size: 14px; }
.mode-split .ed-cm .cm-content { max-width: none; padding-left: 20px; padding-right: 20px; }
.ed-prev { display: none; flex: 1; min-width: 0; overflow: auto; padding: 10px 28px 80px; outline: none; }
.ed-prev > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.mode-split .ed-prev { display: block; border-left: 1px solid var(--line); background: var(--surface); }
.mode-split .ed-prev > * { margin-left: 0; }
.mode-preview .ed-cm { display: none; }
.mode-preview .ed-prev { display: block; }
.ed-cm .cm-searchMatch { background: color-mix(in srgb, var(--series-4) 35%, transparent); }
.ed-cm .cm-panels { background: var(--surface); color: var(--text); border-color: var(--line); }
.ed-cm .cm-panels input, .ed-cm .cm-panels button { font-size: 13px; }
/* live preview decorations */
.mode-live .ed-cm .cm-h { font-weight: 700; line-height: 1.3; padding-top: .35em; }
.mode-live .ed-cm .cm-h1 { font-size: 1.7em; } .mode-live .ed-cm .cm-h2 { font-size: 1.45em; } .mode-live .ed-cm .cm-h3 { font-size: 1.25em; }
.mode-live .ed-cm .cm-h4 { font-size: 1.1em; } .mode-live .ed-cm .cm-h5 { font-size: 1em; } .mode-live .ed-cm .cm-h6 { font-size: .9em; color: var(--text-2); }
.tk-head { font-weight: 700; } .mode-source .tk-head, .mode-split .tk-head { color: var(--accent-ink); }
.tk-strong { font-weight: 700; } .tk-em { font-style: italic; } .tk-strike { text-decoration: line-through; color: var(--text-2); }
.tk-link { color: var(--accent-ink); } .tk-code { font-family: var(--mono); font-size: .92em; } .tk-quote { color: var(--text-2); }
.tk-mark { color: var(--muted); } .tk-kw { color: var(--series-7); } .tk-str { color: var(--series-3); } .tk-num { color: var(--series-2); }
.tk-com { color: var(--muted); font-style: italic; } .tk-type { color: var(--series-1); } .tk-prop { color: var(--series-5); }
.ed-cm .cm-icode { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border-radius: 4px; padding: 0 3px; }
.ed-cm .cm-codeblock { font-family: var(--mono); font-size: 13px; background: var(--surface-2); line-height: 1.55; }
.ed-cm .cm-cb-first { border-radius: 8px 8px 0 0; padding-top: 4px; } .ed-cm .cm-cb-last { border-radius: 0 0 8px 8px; padding-bottom: 4px; }
.ed-cm .cm-quote { border-left: 3px solid var(--line-strong); padding-left: 12px !important; color: var(--text-2); }
.ed-cm .cm-callout { --cc: var(--series-1); border-left-color: var(--cc); background: color-mix(in srgb, var(--cc) 10%, transparent); }
.ed-cm .cm-callout-first { font-weight: 650; color: var(--text); border-radius: 8px 8px 0 0; }
.cm-callout-warning, .callout-warning, .callout-question, .callout-help, .callout-caution { --cc: var(--series-4) !important; }
.cm-callout-danger, .cm-callout-error, .cm-callout-bug, .callout-danger, .callout-error, .callout-bug, .callout-failure { --cc: var(--series-8) !important; }
.cm-callout-tip, .cm-callout-success, .callout-tip, .callout-success, .callout-check, .callout-done { --cc: var(--series-3) !important; }
.cm-callout-summary, .callout-summary, .callout-abstract, .callout-tldr { --cc: var(--series-7) !important; }
.ed-cm .cm-listmark { color: var(--accent-ink); font-weight: 600; }
.ed-cm .cm-wikilink { color: var(--accent-ink); cursor: text; border-bottom: 1px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); }
.ed-cm .cm-wikilink:hover { background: var(--accent-soft); }
.ed-cm .cm-wikilink.unresolved { color: var(--text-2); opacity: .8; border-bottom-style: dashed; }
.ed-cm .cm-wikilink-src { border-bottom: 0; background: var(--accent-soft); border-radius: 4px; }
.ed-cm .cm-link-text { color: var(--accent-ink); text-decoration: underline; }
.ed-cm .cm-tag { color: var(--accent-ink); background: var(--accent-soft); border-radius: 99px; padding: 0 6px; font-size: .92em; }
.ed-cm .cm-fm { font-family: var(--mono); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.ed-cm .cm-task-cb { width: 16px; height: 16px; margin: 0 4px 0 0; vertical-align: -2px; accent-color: var(--accent); cursor: pointer; }
.ed-cm .cm-task-done { color: var(--muted); text-decoration: line-through; }
.ed-cm .cm-hr { display: block; border-top: 1px solid var(--line-strong); margin: .7em 0; }
.ed-cm .cm-embed-img { max-width: 100%; max-height: 340px; border-radius: 8px; display: block; margin: 6px 0; }
.ed-cm .cm-tooltip { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); overflow: hidden; }
.ed-cm .cm-tooltip.cm-tooltip-autocomplete > ul { font-family: inherit; font-size: 13.5px; max-height: 260px; }
.ed-cm .cm-tooltip.cm-tooltip-autocomplete > ul > li { padding: 5px 10px; display: flex; gap: 10px; align-items: baseline; }
.ed-cm .cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected] { background: var(--accent-soft); color: var(--text); }
.ed-cm .cm-completionDetail { color: var(--muted); margin-left: auto; font-style: normal; font-size: 12px; }
.ed-cm .cm-completionLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rendered markdown (preview, hover, AI answers) */
.md { font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.md h1 { font-size: 1.7em; margin: .9em 0 .4em; } .md h2 { font-size: 1.4em; margin: .9em 0 .4em; } .md h3 { font-size: 1.2em; margin: .8em 0 .3em; color: var(--text); font-weight: 650; }
.md h4, .md h5, .md h6 { font-size: 1em; margin: .8em 0 .3em; color: var(--text); }
.md h1:first-child, .md h2:first-child { margin-top: .2em; }
.md p { margin: 0 0 .8em; } .md ul, .md ol { padding-left: 1.5em; margin: .2em 0 .8em; }
.md li > p { margin: 0; }
.md li.task-item { list-style: none; margin-left: -1.4em; position: relative; }
.md li.task-item.done { color: var(--muted); text-decoration: line-through; }
.md .task-cb { width: 16px; height: 16px; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--accent); cursor: pointer; }
.md .task-send { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 6px; opacity: 0; border-radius: 6px; margin-left: 4px; }
.md li:hover > .task-send, .md li:hover .task-send { opacity: 1; } .md .task-send:hover { background: var(--surface-2); }
@media (pointer: coarse) { .md .task-send { opacity: .8; } }
.sent-chip { margin-left: 8px; text-decoration: none; }
.md blockquote { border-left: 3px solid var(--line-strong); margin: .8em 0; padding: .1em 14px; color: var(--text-2); }
.md blockquote.callout { --cc: var(--series-1); border-left: 4px solid var(--cc); background: color-mix(in srgb, var(--cc) 10%, var(--surface)); border-radius: 0 10px 10px 0; color: var(--text); padding: 8px 14px; }
.md .callout-title { display: block; font-weight: 700; color: var(--cc); margin-bottom: 2px; }
.md pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font: 13px/1.5 var(--mono); }
.md code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border-radius: 4px; padding: 0 4px; } .md pre code { background: transparent; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: .6em 0; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; } .md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--line-strong); margin: 1.2em 0; }
.md img, .embed-img { max-width: 100%; border-radius: 8px; }
.md mark { background: color-mix(in srgb, var(--series-4) 40%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.wikilink { color: var(--accent-ink); } .wikilink.unresolved { opacity: .7; text-decoration: underline dashed; cursor: pointer; }
a.tag, .tag { background: var(--accent-soft); color: var(--accent-ink); border-radius: 99px; padding: 0 8px; font-size: .92em; text-decoration: none; }
.md .props { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: 0 0 1em; background: var(--surface-2); font-size: 13px; }
.md .props summary { cursor: pointer; color: var(--muted); font-weight: 600; } .md .prop { display: flex; gap: 10px; padding: 2px 0; } .md .prop b { min-width: 80px; color: var(--text-2); }
.embed-note { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 6px 14px; margin: .6em 0; }
.embed-title { font-weight: 650; font-size: 13px; margin-bottom: 4px; }
.cite { font-size: .8em; vertical-align: super; font-weight: 700; text-decoration: none; padding: 0 1px; }
.hover-pop { position: fixed; z-index: 80; width: 380px; max-width: calc(100vw - 16px); max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 16px; box-shadow: 0 10px 34px rgba(0,0,0,.2); font-size: 14px; line-height: 1.55; }
.hover-pop .hp-title { font-weight: 700; margin-bottom: 4px; }
.hover-pop h1, .hover-pop h2, .hover-pop h3 { font-size: 1.05em; margin: .5em 0 .2em; } .hover-pop p { margin: 0 0 .5em; }
.diff { font: 12px/1.5 var(--mono); border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: var(--surface); }
.dl { display: flex; white-space: pre-wrap; overflow-wrap: anywhere; } .dl .sg { width: 22px; text-align: center; color: var(--muted); flex: none; } .dl .tx { flex: 1; padding-right: 8px; }
.dl.add { background: color-mix(in srgb, var(--good) 16%, transparent); } .dl.del { background: color-mix(in srgb, var(--bad) 16%, transparent); } .dl.gap { color: var(--muted); padding-left: 22px; }
.wdiff { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 6px; }
.wdiff del { background: color-mix(in srgb, var(--bad) 22%, transparent); text-decoration: line-through; } .wdiff ins { background: color-mix(in srgb, var(--good) 24%, transparent); text-decoration: none; }

/* right pane */
.note-side { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; height: 100vh; }
.pane-tabs { margin: 8px; display: flex; flex: none; }
.pane-tabs button { flex: 1 1 0; min-width: 0; padding: 5px 2px; font-size: 12.5px; }
#dr-tabs { margin: 0 46px 12px 0; }
.ai-btn .sp { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ai-head svg, #cp-ai svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ed-cm .cm-hilite, .md mark { background: color-mix(in srgb, var(--series-4) 40%, transparent); border-radius: 3px; }
.pane-body { flex: 1; overflow-y: auto; padding: 4px 14px 30px; min-height: 0; }
.pane-sec { margin-bottom: 16px; } .pane-sec h3 { display: flex; align-items: center; gap: 6px; }
.bl { padding: 6px 0; border-bottom: 1px solid var(--line); } .bl:last-child { border-bottom: 0; }
.bl-line { font-size: 12.5px; color: var(--text-2); margin-top: 3px; overflow-wrap: anywhere; border-left: 2px solid var(--line-strong); padding-left: 8px; }
.outg { display: flex; flex-wrap: wrap; gap: 6px; }
.outline { display: flex; flex-direction: column; } .ol-item { text-align: left; border: 0; background: transparent; padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.ol-item:hover { background: var(--surface-2); color: var(--text); }
.hist-item { display: flex; padding: 8px 4px !important; }
.rel { display: block; padding: 8px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; } .rel:hover { background: var(--surface-2); text-decoration: none; }
.rel .barline { height: 5px; margin: 4px 0 2px; } .rel-linked { margin-top: 12px; } .rel-linked summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* search, tags */
.sr-snip { font-size: 13px; color: var(--text-2); margin-top: 3px; overflow-wrap: anywhere; } .sr-snip mark { background: color-mix(in srgb, var(--series-4) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.tag-tree { display: flex; flex-direction: column; } .tag-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 40px; } .tag-row:hover { background: var(--surface-2); text-decoration: none; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-x { border: 0; background: transparent; cursor: pointer; color: inherit; font-size: 14px; padding: 0 2px; }

/* AI */
.ai-tray { border-bottom: 1px solid var(--line); background: var(--surface-2); padding: 10px 18px; max-height: 42vh; overflow-y: auto; flex: none; }
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.acard.block { flex-wrap: wrap; align-items: flex-start; } .acard .abody { flex: 1 1 260px; }
.acard.block .abtns { flex-wrap: wrap; }
.ai-md { font-size: 14px; } .ai-md p:last-child { margin-bottom: 0; }
.tag-sug { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); border-radius: 99px; padding: 2px 4px 2px 12px; background: var(--surface); flex-wrap: wrap; }
.tag-sug .tg { font-weight: 600; color: var(--accent-ink); } .tag-sug .reason { max-width: 220px; } .tag-sug.done { opacity: .75; }
.tag-sug .btn.small { min-height: 28px; padding: 2px 9px; }
.task-lines { margin-top: 6px; } .task-line { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-family: var(--mono); font-size: 13px; }
.msg-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.msg .srcs .src { margin-top: 8px; } .msg .status.err { color: var(--bad); }
.msg.ai .body.md { font-size: 14.5px; }
.cap-prev { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; background: var(--surface-2); max-height: 360px; overflow: auto; }
.ask-input textarea { font-size: 15px; }

/* graph */
.graph-box { position: relative; height: calc(100vh - 250px); min-height: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.graph-box canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.graph-tip { position: absolute; left: 12px; top: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 3px 9px; font-size: 12px; pointer-events: none; }
.legend i.ghost { background: transparent; border: 1.5px dashed var(--muted); }
.graph-filters select { max-width: 200px; }
body.on-graph main { padding-bottom: 24px; }

@media (max-width: 1100px) { .note-page { grid-template-columns: minmax(0, 1fr) 260px; } .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .m-only { display: block; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-main-wrap, body.on-note #app #main { padding: 0 !important; }
  body.on-note .tabbar, body.on-note #integ-nav { display: none !important; }
  .note-page { display: block; height: 100dvh; } .note-col { height: 100dvh; } .note-side { display: none; }
  .mode-seg { display: none; } .mode-m { display: inline-flex; align-items: center; } .back-btn { display: grid !important; }
  .note-bar { padding: calc(6px + env(safe-area-inset-top)) 8px 6px; gap: 6px; }
  .note-bar .icon-btn { width: 40px; height: 40px; }
  .ai-btn .ai-lbl { display: none; }
  .note-head { padding: 10px 14px 0; } .note-title { min-height: 0 !important; }
  .ed-cm .cm-content { padding: 8px 14px 120px; } .ed-prev { padding: 8px 14px 100px; }
  .ai-tray { padding: 8px 12px; max-height: 50vh; } .note-foot { padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); }
  .mode-split .ed-wrap { flex-direction: column; } .mode-split .ed-prev { border-left: 0; border-top: 1px solid var(--line); }
  .tree .tr-more { opacity: .7; width: 36px; height: 36px; } .tree .tr-row { min-height: 40px; font-size: 15px; }
  .modal-box { top: 6vh; max-height: 84vh; }
  .graph-box { height: calc(100vh - 330px); min-height: 280px; }
  .qs-in, .ed-cm .cm-content { font-size: 16px; }
  .note-title { font-size: 22px; }
  .pane-tabs button { min-height: 36px !important; }
  .hover-pop { display: none; }
}
@media print { .nav, .tabbar, .note-bar, .note-side { display: none !important; } }
