.app-body { background: var(--bg); }
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

/* sidebar */
.side { background: var(--navy-900); color: #c9cdf0; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; margin: 2px 8px 28px; color: #fff; }
.side-brand .mark { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; flex: none; }
.side-brand .mark svg { width: 18px; height: 18px; }
.side-brand .wm { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.side-brand .wm i { font-style: normal; color: var(--mint); }
.side-brand small { display: block; font-size: 11px; color: #9aa0d6; margin-top: 1px; }
.side-label { font-size: 10.5px; color: #8a90cc; letter-spacing: .16em; margin: 0 10px 8px; font-weight: 600; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; color: #c9cdf0; position: relative; }
.side-nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.side-nav a:hover { background: #ffffff0f; color: #fff; }
.side-nav a.active { background: var(--navy-700); color: #fff; font-weight: 700; }
.side-nav a.active svg { stroke: var(--mint); opacity: 1; }
.side-nav a.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; background: var(--mint); border-radius: 0 2px 2px 0; }
.side-nav .badge { margin-left: auto; background: var(--signal); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; line-height: 1.5; }
.side-foot { margin-top: auto; font-size: 11.5px; color: #9aa0d6; line-height: 1.75; padding: 14px 10px 4px; border-top: 1px solid #ffffff1a; }
.side-foot b { color: #fff; font-weight: 600; }

/* top bar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 32px; background: #fff; border-bottom: 1px solid var(--line); }
.side-toggle { display: none; width: 34px; height: 34px; border-radius: 5px; }
.side-toggle svg { width: 20px; height: 20px; margin: auto; stroke: var(--ink); stroke-width: 1.7; fill: none; }
.gsearch { position: relative; flex: 1; max-width: 620px; display: flex; align-items: center; gap: 8px; background: var(--paper-2); border: 1px solid transparent; border-radius: var(--pill); padding: 0 16px; }
.gsearch:focus-within { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px #070d9214; }
.gsearch svg { width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 1.8; flex: none; }
.gsearch input { flex: 1; border: 0; padding: 10px 0; outline: none; background: transparent; min-width: 0; font-size: 14px; }
.gsearch kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); border: 1px solid var(--rule-2); border-radius: 4px; padding: 1px 6px; }
.gresults { position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: 0 18px 40px #15181d1f; padding: 6px; max-height: 70vh; overflow: auto; }
.gresults h4 { margin: 10px 8px 4px; font-size: 10.5px; color: var(--faint); letter-spacing: .14em; font-weight: 700; }
.gresults a { display: flex; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 4px; font-size: 14px; }
.gresults a:hover { background: var(--paper-2); }
.gresults a small { color: var(--faint); white-space: nowrap; }

/* page */
.view { padding: 28px 32px 56px; outline: none; max-width: 1440px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 0; line-height: 1.3; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; gap: 14px; }
.kpi { padding: 18px 20px; background: var(--navy-900); color: #fff; border-radius: var(--r-lg); }
.kpi:nth-child(n+2) { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.kpi small { font-size: 13px; opacity: .8; }
.kpi strong { display: block; font-weight: 700; font-size: 30px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; line-height: 1.15; }
.kpi span { font-size: 12.5px; opacity: .6; }
.kpi:first-child strong { color: var(--mint); }
.kpi:nth-child(n+2) strong { color: var(--brand); }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; min-width: 0; }
.panel h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--ink); }
.panel h2 a { font-size: 13px; color: var(--ink-2); font-weight: 500; letter-spacing: 0; }
.panel h2 a::after { content: ' ›'; color: var(--green); }
.panel h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.stack { display: grid; gap: 20px; align-content: start; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; flex: 1 1 240px; padding: 9px 12px; }
.filters select.input { flex: 0 0 auto; }
.filters .break { flex-basis: 100%; height: 0; }
.seg { display: inline-flex; background: var(--paper-2); padding: 3px; border-radius: var(--pill); gap: 2px; }
.seg button { padding: 6px 13px; font-size: 13px; font-weight: 500; color: var(--muted); border-radius: var(--pill); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles button { font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: var(--pill); border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink-2); }
.toggles button:hover { border-color: var(--ink); }
.toggles button[aria-pressed="true"] { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.check input { accent-color: var(--ink); }
.result-meta { font-size: 13px; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }

/* lists */
.list { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.list.flat { background: transparent; border: 0; border-radius: 0; }
.item { display: grid; grid-template-columns: 84px minmax(0, 1fr) 128px; gap: 18px; padding: 16px 20px; border-top: 1px solid var(--rule); align-items: start; }
.item.no-thumb { grid-template-columns: 84px minmax(0, 1fr); }
.list.flat .item { padding-left: 0; padding-right: 0; }
.item:first-child { border-top: 0; }
.item time { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 3px; line-height: 1.5; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.item .title { font-weight: 700; font-size: 16.5px; line-height: 1.5; letter-spacing: -0.015em; }
.item .title a:hover { color: var(--brand); }
.item .lead { color: var(--muted); font-size: 13.5px; margin-top: 5px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .thumb { width: 128px; border-radius: 12px; }
.item .thumb .ph .ini { transform: scale(.62); }
.item .thumb .ph small { display: none; }
.co { font-weight: 700; color: var(--ink); font-size: 13px; }
.co:hover { color: var(--brand); }
.co.secondary { color: var(--muted); font-weight: 600; }
.new-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 6px; vertical-align: 1px; }
.more { display: flex; justify-content: center; padding: 18px; }
.empty { padding: 44px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.loading { padding: 44px; text-align: center; color: var(--faint); font-size: 14px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); }
.table-wrap.flat { background: transparent; border: 0; border-radius: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
.tbl th, .tbl td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; background: var(--paper-2); border-bottom-color: var(--line); position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #f7f8fc; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a.link { font-weight: 600; color: var(--ink); }
.tbl a.link:hover { color: var(--brand); }
.tbl .sub { display: block; color: var(--faint); font-size: 12px; margin-top: 3px; }
.star { font-size: 16px; color: var(--rule-2); line-height: 1; }
.star[aria-pressed="true"] { color: var(--green); }

/* charts */
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 112px minmax(0, 1fr) 44px; gap: 12px; align-items: center; font-size: 13px; }
.bar > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar a:hover { color: var(--accent); }
.bar .track { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--brand); border-radius: 4px; }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.cols { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.cols .c { flex: 1; display: flex; flex-direction: column-reverse; min-width: 0; position: relative; height: 100%; }
.cols .c i { display: block; width: 100%; }
.cols .c:hover { background: #15181d08; }
.cols .c:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 5px 8px; border-radius: 4px; white-space: pre; z-index: 2; line-height: 1.5; }
.cols-x { display: flex; gap: 3px; font-size: 10.5px; color: var(--faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.cols-x span { flex: 1; min-width: 0; white-space: nowrap; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.mini-list li:first-child { border-top: 0; padding-top: 2px; }
.mini-list .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .t a:hover { color: var(--accent); }
.mini-list time { font-size: 12px; color: var(--faint); }

/* profile */
.back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.back:hover { color: var(--ink); }
.profile-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; padding: 26px 28px; background: var(--navy-900); color: #fff; border-radius: var(--r-lg); }
.profile-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.03em; line-height: 1.25; }
.profile-head h1 small { font-size: 15px; font-weight: 500; color: #ffffffa6; letter-spacing: 0; margin-left: 8px; }
.profile-head p { margin: 6px 0 0; color: #ffffffb3; font-size: 14px; }
.profile-head .faint { color: #ffffff80 !important; }
.profile-head .btn.secondary { background: transparent; color: #fff; border-color: #ffffff59; }
.profile-head .btn.secondary:hover { border-color: #fff; }
.watch-btn[aria-pressed="true"] { background: var(--green) !important; border-color: var(--green) !important; color: #fff !important; }
.section-title { font-family: var(--serif); font-size: 19px; letter-spacing: -0.02em; margin: 8px 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

/* watch */
.watch-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.watch-box h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 700; }
.watch-box h3:first-child { margin-top: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--pill); padding: 3px 4px 3px 9px; font-size: 13px; }
.tag a:hover { color: var(--accent); }
.tag button { width: 20px; height: 20px; border-radius: 50%; color: var(--faint); }
.tag button:hover { background: var(--paper-2); color: var(--ink); }
.add-row { display: flex; gap: 6px; margin-top: 8px; }
.add-row .input { padding: 7px 10px; font-size: 13px; }
.note { font-size: 12.5px; color: var(--faint); margin-top: 14px; line-height: 1.7; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .watch-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.side-open .side { transform: none; box-shadow: 24px 0 60px #0006; }
  .side-toggle { display: grid; }
  .topbar { padding: 10px 16px; }
  .topbar .btn.ghost, .gsearch kbd { display: none; }
  .view { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 24px; }
  .profile-head h1 { font-size: 27px; }
  .item, .item.no-thumb { grid-template-columns: minmax(0, 1fr) 92px; gap: 4px 14px; padding: 14px 16px; }
  .item time { grid-column: 1 / -1; padding: 0; }
  .item .thumb { width: 92px; grid-row: 2; grid-column: 2; }
  .item.no-thumb > div { grid-column: 1 / -1; }
  .item .title { font-size: 15.5px; }
  .bar { grid-template-columns: 92px minmax(0, 1fr) 40px; }
  .kpi strong { font-size: 27px; }
  .kpi { padding: 14px 16px; }
}
