@font-face {
  font-family: "Brief Sans";
  src: local("Avenir Next"), local("Helvetica Neue");
  font-display: swap;
}

:root {
  --ink: #0a0a0a;
  --muted: #666;
  --faint: #8a8a8a;
  --line: #e8e8e8;
  --surface: #fff;
  --wash: #fafafa;
  --sidebar-width: 340px;
  --topbar-height: 64px;
  color: var(--ink);
  font-family: "Brief Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: grid;
  width: var(--sidebar-width);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  background: var(--wash);
  border-right: 1px solid var(--line);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}

.brand-row, .topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
}
.brand-row { padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 15px; font-weight: 650; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 20px; height: 20px; font-size: 18px; transform: scaleX(.94); }

.sidebar-tools { padding: 20px 18px 12px; }
.date-picker { position: relative; }
.search-field { width: 100%; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 11px; background: var(--surface); border: 1px solid #dedede; border-radius: 7px; text-align: left; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; }
.search-field:focus-visible, .search-field[aria-expanded="true"] { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.search-icon { color: var(--faint); font-size: 17px; }
.search-field #date-search-label { flex: 1; color: var(--muted); font-size: 12px; }
.calendar-mark { color: var(--faint); font-size: 14px; }
.calendar-popover { position: absolute; top: 45px; right: 0; left: 0; z-index: 25; padding: 12px; border: 1px solid #d8d8d8; border-radius: 9px; background: #fff; box-shadow: 0 18px 44px rgb(0 0 0 / 14%); transform-origin: top; animation: calendar-enter .18s cubic-bezier(.22, 1, .36, 1); }
.calendar-popover[hidden] { display: none; }
.calendar-header { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; margin-bottom: 10px; }
.calendar-header strong { text-align: center; font-size: 12px; font-weight: 620; }
.calendar-header button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.calendar-header button:hover:not(:disabled) { background: #f0f0f0; }
.calendar-header button:disabled { color: #ccc; cursor: default; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calendar-weekdays { margin-bottom: 4px; color: #aaa; font-size: 9px; text-align: center; }
.calendar-weekdays span { padding: 4px 0; }
.calendar-day, .calendar-spacer { aspect-ratio: 1; }
.calendar-day { display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #c4c4c4; font-size: 11px; }
.calendar-day.has-content { color: var(--ink); font-weight: 580; cursor: pointer; }
.calendar-day.has-content:hover { background: #ededed; }
.calendar-day.is-selected { background: var(--ink); color: #fff; }
.calendar-day:disabled { cursor: not-allowed; }
.calendar-clear { width: 100%; margin-top: 10px; padding: 9px 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.calendar-clear:hover:not(:disabled) { color: var(--ink); }
.calendar-clear:disabled { color: #ccc; cursor: default; }
.filter-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-top: 12px; padding: 3px; background: #ececec; border-radius: 7px; }
.filter-tab { height: 30px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.filter-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }

.archive-meta { display: flex; justify-content: space-between; padding: 9px 22px 10px; color: var(--faint); font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
.archive-meta button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.archive-meta button:hover { color: var(--ink); }
.archive-meta button span:last-child { display: inline-block; font-size: 12px; transition: transform .25s ease; }
.archive-meta button.is-refreshing span:last-child { animation: spin .7s linear infinite; }
.brief-list { min-height: 0; overflow-y: auto; padding: 0 10px 16px; scrollbar-width: thin; scrollbar-color: #ccc transparent; }
.month-group h2 { margin: 15px 12px 7px; color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brief-row { position: relative; width: 100%; min-height: 70px; display: grid; grid-template-columns: 8px 1fr 16px; align-items: start; gap: 10px; padding: 11px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.brief-row:hover { background: #f0f0f0; }
.brief-row:active { transform: scale(.992); }
.brief-row.is-active { background: var(--ink); color: #fff; }
.status-dot { width: 6px; height: 6px; margin-top: 6px; border-radius: 999px; background: #3b82f6; box-shadow: 0 0 0 3px rgb(59 130 246 / 12%); }
.status-dot.is-read { background: #b5b5b5; box-shadow: none; }
.brief-row.is-active .status-dot { background: #fff; box-shadow: 0 0 0 3px rgb(255 255 255 / 14%); }
.brief-row-copy { min-width: 0; }
.brief-row-copy strong { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; }
.brief-row-copy small { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brief-row.is-active small { color: #aaa; }
.row-arrow { align-self: center; color: #aaa; opacity: 0; transform: translateX(-3px); transition: opacity .16s ease, transform .16s ease; }
.brief-row:hover .row-arrow, .brief-row.is-active .row-arrow { opacity: 1; transform: translateX(0); }

.sidebar-footer { height: 50px; display: flex; align-items: center; gap: 8px; padding: 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #1ca54c; box-shadow: 0 0 0 3px rgb(28 165 76 / 12%); }
.empty-list { display: grid; gap: 5px; padding: 42px 14px; color: var(--muted); font-size: 12px; text-align: center; }
.empty-list strong { color: var(--ink); font-size: 13px; }

.workspace { min-height: 100dvh; margin-left: var(--sidebar-width); transition: margin-left .28s cubic-bezier(.22, 1, .36, 1); }
.topbar { position: sticky; top: 0; z-index: 10; justify-content: space-between; padding: 0 28px; background: rgb(255 255 255 / 86%); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px) saturate(160%); }
.topbar-leading { display: flex; align-items: center; gap: 13px; }
.breadcrumb { display: flex; gap: 9px; align-items: center; color: var(--faint); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 550; }
.slash { color: #d2d2d2; }
.top-actions { display: flex; gap: 8px; }
.quiet-button, .primary-button, .icon-button { border-radius: 7px; cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.quiet-button { height: 34px; padding: 0 13px; border: 1px solid #ddd; background: var(--surface); font-size: 12px; }
.quiet-button:hover { border-color: #999; }
.primary-button { height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 12px; }
.primary-button:hover { background: #292929; }
.quiet-button:active, .primary-button:active { transform: scale(.97); }
.icon-button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: #fff; }
.reading-progress { position: fixed; top: var(--topbar-height); right: 0; left: var(--sidebar-width); z-index: 11; height: 1px; background: transparent; transition: left .28s cubic-bezier(.22, 1, .36, 1); }
.reading-progress span { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--ink); }

.reader-stage { width: min(780px, calc(100% - 72px)); margin: 0 auto; padding: 68px 0 80px; }
.reader-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--faint); font-size: 10px; font-weight: 650; letter-spacing: .13em; }
.read-indicator { display: inline-flex; align-items: center; gap: 6px; color: #2668d8; font-size: 10px; }
.read-indicator::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.read-indicator.is-read { color: var(--faint); }

.brief-content { animation: article-enter .48s cubic-bezier(.22, 1, .36, 1) both; }
.brief-content.is-loading { opacity: .5; }
.brief-content h1 { max-width: 760px; margin: 0 0 34px; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -.055em; text-wrap: balance; }
.brief-content h2 { margin: 68px 0 20px; padding-top: 2px; font-size: 27px; line-height: 1.25; letter-spacing: -.035em; text-wrap: balance; }
.brief-content h3 { margin: 44px 0 16px; font-size: 19px; line-height: 1.35; letter-spacing: -.02em; }
.brief-content h4 { margin: 32px 0 12px; font-size: 15px; }
.brief-content p, .brief-content li { color: #292929; font-size: 16px; line-height: 1.82; letter-spacing: -.008em; }
.brief-content p { margin: 0 0 22px; }
.brief-content strong { color: var(--ink); font-weight: 650; }
.brief-content a { color: var(--ink); text-decoration-color: #aaa; text-underline-offset: 3px; }
.brief-content a:hover { text-decoration-color: var(--ink); }
.external { display: inline-block; margin-left: 3px; font-size: .72em; text-decoration: none; }
.brief-content .citation { display: inline; padding: 2px 5px; border-radius: 4px; background: #f2f2f2; color: #555; font-size: 11px; text-decoration: none; word-break: break-all; }
.brief-content .citation.is-pending { color: #888; cursor: help; }
.brief-content ul, .brief-content ol { margin: 0 0 26px; padding-left: 24px; }
.brief-content li { margin: 7px 0; padding-left: 5px; }
.brief-content blockquote { margin: 30px 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--ink); color: var(--ink); font-size: 21px; font-weight: 540; line-height: 1.55; letter-spacing: -.02em; }
.brief-content hr { height: 1px; margin: 54px 0; border: 0; background: var(--line); }
.brief-content pre { position: relative; overflow: auto; margin: 28px 0; padding: 24px; border: 1px solid #242424; border-radius: 9px; background: #0d0d0d; color: #ededed; font: 13px/1.7 "SFMono-Regular", Consolas, monospace; box-shadow: 0 16px 40px rgb(0 0 0 / 9%); }
.brief-content code { padding: 2px 5px; border-radius: 4px; background: #f2f2f2; font: .88em/1.5 "SFMono-Regular", Consolas, monospace; }
.brief-content pre code { padding: 0; background: transparent; font: inherit; }
.table-wrap { overflow-x: auto; margin: 28px 0 34px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.brief-content table { width: 100%; border-collapse: collapse; font-size: 13px; }
.brief-content th, .brief-content td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.brief-content th { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.brief-content tbody tr:last-child td { border-bottom: 0; }

.article-footer { display: flex; justify-content: space-between; margin-top: 88px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.article-footer button { padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.loading-state { display: grid; gap: 20px; padding-top: 10px; }
.loading-line { width: 100%; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #eee 20%, #fafafa 50%, #eee 80%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
.loading-line.short { width: 58%; height: 48px; }
.error-state { padding: 80px 0; text-align: center; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; padding: 11px 14px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; box-shadow: 0 16px 40px rgb(0 0 0 / 20%); }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.scrim { display: none; }
.mobile-only { display: none; }

@keyframes article-enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes calendar-enter { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 901px) {
  .app-shell.is-reading-mode .sidebar { transform: translateX(-100%); }
  .app-shell.is-reading-mode .workspace { margin-left: 0; }
  .app-shell.is-reading-mode .reading-progress { left: 0; }
  .app-shell.is-reading-mode .reader-stage { width: min(820px, calc(100% - 72px)); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 320px; }
  .mobile-only { display: inline-grid; place-items: center; }
  .sidebar { transform: translateX(-100%); box-shadow: 18px 0 60px rgb(0 0 0 / 16%); }
  .sidebar.is-open { transform: translateX(0); }
  .brand-row { justify-content: space-between; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar-leading { margin-right: auto; gap: 11px; }
  .reading-progress { left: 0; }
  .scrim { position: fixed; inset: 0; z-index: 15; display: block; background: rgb(0 0 0 / 22%); opacity: 0; pointer-events: none; transition: opacity .24s ease; }
  .scrim.is-visible { opacity: 1; pointer-events: auto; }
}

@media (max-width: 600px) {
  :root { --topbar-height: 58px; }
  .topbar { gap: 6px; }
  .breadcrumb span:not(strong), .breadcrumb .slash, .quiet-button { display: none; }
  .primary-button { padding: 0 10px; }
  .reader-stage { width: calc(100% - 36px); padding-top: 42px; }
  .reader-meta { margin-bottom: 21px; }
  .brief-content h1 { font-size: 36px; }
  .brief-content h2 { margin-top: 52px; font-size: 24px; }
  .brief-content p, .brief-content li { font-size: 15px; line-height: 1.78; }
  .brief-content pre { margin-right: -8px; margin-left: -8px; padding: 18px; border-radius: 7px; }
  .article-footer { align-items: flex-start; gap: 18px; }
}

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

@media print {
  @page { size: A4; margin: 18mm 17mm 20mm; }
  :root { --ink: #000; }
  .sidebar, .topbar, .reading-progress, .reader-meta, .article-footer, .toast, .scrim { display: none !important; }
  .workspace { margin: 0; }
  .reader-stage { width: auto; margin: 0; padding: 0; }
  .brief-content { animation: none; }
  .brief-content h1 { margin-bottom: 24pt; font-size: 28pt; }
  .brief-content h2 { break-after: avoid; margin-top: 28pt; font-size: 18pt; }
  .brief-content h3 { break-after: avoid; }
  .brief-content p, .brief-content li { color: #111; font-size: 10.5pt; line-height: 1.65; }
  .brief-content pre, .table-wrap, .brief-content blockquote { break-inside: avoid; }
  .brief-content pre { border-color: #ddd; background: #f7f7f7; color: #111; box-shadow: none; white-space: pre-wrap; }
  .brief-content a { color: #000; text-decoration: underline; }
  .brief-content a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 7pt; font-weight: 400; word-break: break-all; }
  .brief-content .citation::after { content: none; }
}
