:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-strong: #f1eee6;
  --line: rgba(17, 17, 17, 0.14);
  --line-strong: rgba(17, 17, 17, 0.36);
  --text: #111111;
  --muted: #5d5a53;
  --faint: #9b9488;
  --brand: #c9a16e;
  --brand-soft: rgba(201, 161, 110, 0.14);
  --green: #477b5c;
  --green-soft: rgba(71, 123, 92, 0.1);
  --amber: #c9a16e;
  --amber-soft: rgba(201, 161, 110, 0.14);
  --coral: #a4483c;
  --coral-soft: rgba(164, 72, 60, 0.1);
  --violet: #6d5b88;
  --shadow: none;
  --radius: 0;
  font-family:
    "Avenir Next", Futura, "Futura PT", Helvetica, Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0a;
  --bg-soft: #11110f;
  --panel: #11110f;
  --panel-strong: #1b1915;
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.38);
  --text: #f5f1e8;
  --muted: #b8b0a2;
  --faint: #706a60;
  --brand: #c9a16e;
  --brand-soft: rgba(201, 161, 110, 0.16);
  --green: #9bbf9d;
  --green-soft: rgba(155, 191, 157, 0.12);
  --amber: #c9a16e;
  --amber-soft: rgba(201, 161, 110, 0.16);
  --coral: #d99183;
  --coral-soft: rgba(217, 145, 131, 0.13);
  --violet: #b6a1d6;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.38;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 34px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 42px;
}

.nav-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: auto;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  padding: 0 0 26px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.brand span {
  color: var(--text);
}

.brand span::after {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin-top: 16px;
  background: var(--brand);
}

.nav {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 13px;
  color: var(--muted);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.035em;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.nav a:hover {
  color: var(--text);
  background: rgba(201, 161, 110, 0.07);
  border-color: var(--line-strong);
}

.nav a.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(201, 161, 110, 0.2), rgba(201, 161, 110, 0.08));
  border-color: var(--line-strong);
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 600;
}

.nav-dot {
  width: 18px;
  height: 1px;
  border-radius: 0;
  background: currentColor;
  opacity: 0.56;
}

.nav a.active .nav-dot {
  width: 20px;
  height: 2px;
  background: var(--brand);
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  height: 34px;
  border-radius: 0;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.theme-switch button.active {
  color: var(--text);
  background: var(--brand-soft);
}

.login-link {
  color: var(--faint);
  font-size: 12px;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main {
  min-width: 0;
  padding: 42px 46px 86px;
}

.mobile-bar {
  display: none;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
}

.page-header {
  display: grid;
  gap: 24px;
  border: 0;
  border-top: 1px solid var(--brand);
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 30px 0 26px;
  margin-bottom: 34px;
}

.page-title-block {
  display: grid;
  gap: 6px;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  padding-bottom: 6px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.filter-stack {
  flex: 1 1 460px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  background: transparent;
}

.segmented a,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  min-height: 38px;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.segmented a:last-child,
.segmented button:last-child {
  border-right: 0;
}

.segmented a.active,
.segmented button.active {
  color: var(--text);
  background: var(--brand-soft);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.search {
  flex: 1 1 340px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  max-width: 430px;
}

.field,
textarea {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  padding: 0 14px;
  outline: none;
  font-weight: 300;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.field:focus,
textarea:focus {
  border-color: var(--brand);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  line-height: 1;
  color: var(--text);
  background: transparent;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.button:hover {
  color: var(--brand);
  border-color: var(--text);
  box-shadow: inset 0 -2px 0 var(--text);
}

.button.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 1180px) {
  .toolbar .search {
    flex-basis: 100%;
    max-width: 100%;
  }
}

.timeline {
  position: relative;
  display: grid;
  gap: 38px;
}

.day-group {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 28px;
}

.day-label {
  position: sticky;
  top: 20px;
  height: max-content;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.day-items {
  position: relative;
  display: grid;
  gap: 0;
}

.day-items::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -18px;
  width: 1px;
  background: var(--brand);
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.timeline-row::before {
  content: "";
  position: absolute;
  top: 28px;
  left: -21px;
  width: 7px;
  height: 7px;
  border-radius: 0;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--bg);
}

.time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding-top: 22px;
}

.card {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 20px 0 22px;
}

.card.read .item-title {
  color: var(--faint);
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.source {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source strong {
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
}

.badges,
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--muted);
  background: transparent;
}

.badge.selected {
  color: var(--amber);
  border-color: var(--amber);
  background: transparent;
  box-shadow: none;
}

.badge.score {
  color: var(--brand);
  border-color: var(--brand);
  background: transparent;
}

.tag {
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}

.item-title {
  display: block;
  max-width: min(100%, 1120px);
  margin-bottom: 12px;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.24;
}

.item-title:hover {
  color: var(--brand);
}

.summary {
  max-width: min(100%, 1040px);
  color: var(--muted);
  line-height: 1.62;
  margin-bottom: 14px;
}

.recommendation {
  margin-top: 14px;
  border-top: 1px solid var(--brand);
  padding: 12px 0 0;
  color: var(--text);
  background: transparent;
  border-radius: 0;
  line-height: 1.6;
}

.empty {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--muted);
  padding: 44px 32px;
  text-align: center;
  background: transparent;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.daily-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.archive {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 0;
  border: 0;
  border-top: 1px solid var(--brand);
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.archive a {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  padding: 14px 0;
  line-height: 1.35;
}

.archive a.active,
.archive a:hover {
  color: var(--text);
  background: transparent;
}

.archive a.active {
  box-shadow: inset 3px 0 0 var(--brand);
  padding-left: 12px;
}

.daily-paper {
  border: 0;
  border-top: 1px solid var(--brand);
  border-radius: 0;
  background: var(--panel);
  padding: 34px 0 0;
}

.daily-top {
  display: grid;
  gap: 12px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line-strong);
}

.daily-top h1 {
  font-size: 52px;
}

.daily-top h2 {
  font-size: 34px;
  line-height: 1.18;
}

.section {
  display: grid;
  gap: 18px;
  margin-top: 36px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.section-head h2 {
  font-size: 24px;
  line-height: 1.2;
}

.section-count {
  color: var(--faint);
}

.daily-item {
  display: grid;
  gap: 10px;
  border-left: 2px solid var(--brand);
  background: transparent;
  border-radius: 0;
  padding: 4px 0 18px 18px;
}

.daily-item h3 {
  font-size: 22px;
  line-height: 1.25;
}

@media (max-width: 1120px) {
  .daily-layout {
    grid-template-columns: 1fr;
  }

  .archive {
    position: static;
  }
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px;
  background: transparent;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 20px;
}

.panel h2,
.panel h3 {
  margin-bottom: 10px;
}

.codebox {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 12px;
  margin-top: 12px;
}

.codebox code {
  overflow-wrap: anywhere;
  color: var(--brand);
}

.form {
  display: grid;
  gap: 14px;
  max-width: 720px;
}

.form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.notice {
  min-height: 24px;
  color: var(--green);
}

.notice.error {
  color: var(--coral);
}

.source-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 16px;
}

.history-stats {
  margin-bottom: 18px;
}

.history-card {
  display: grid;
  gap: 8px;
}

.history-wall .empty {
  grid-column: 1 / -1;
}

.source-number {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--brand);
  border-radius: 0;
  color: var(--amber);
  background: transparent;
  padding: 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.changelog {
  display: grid;
  gap: 18px;
}

.change-day {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
}

.change-list {
  display: grid;
  gap: 12px;
}

.change-entry {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  padding: 16px;
}

.copy-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.copy {
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  padding: 5px 9px;
}

.admin-page .page-header {
  margin-bottom: 26px;
}

.admin-login {
  max-width: 620px;
}

.admin-stats {
  margin-bottom: 14px;
}

.admin-stat h2 {
  font-size: 34px;
}

.admin-wide {
  margin-top: 14px;
}

.section-head.compact {
  margin-bottom: 16px;
}

.admin-flow {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.admin-flow > div {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.admin-flow strong {
  color: var(--brand);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.admin-list,
.admin-review-list {
  display: grid;
  gap: 14px;
}

.admin-source,
.admin-submission,
.admin-review-card {
  display: grid;
  gap: 14px;
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.admin-card-head h2 {
  font-size: 24px;
  line-height: 1.2;
}

.upstream-feed-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.upstream-feed-list a {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  padding: 12px;
  min-height: 86px;
}

.upstream-feed-list strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.upstream-feed-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-sync-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
}

.admin-sync-list > div {
  display: grid;
  gap: 5px;
  border-right: 1px solid var(--line);
  padding: 10px;
  min-width: 0;
}

.admin-sync-list > div:last-child {
  border-right: 0;
}

.admin-sync-list strong,
.admin-sync-list span {
  overflow-wrap: anywhere;
}

.admin-sync-list strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
}

.admin-sync-list span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.admin-sync-error {
  color: var(--coral) !important;
}

.admin-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 58px;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-size: 26px;
  line-height: 1;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.admin-form-grid .field {
  min-height: 40px;
}

.admin-span-2 {
  grid-column: span 2;
}

.admin-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.admin-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  padding: 0 12px;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.admin-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.admin-rule-grid > div {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 14px 12px 14px 0;
}

@media (max-width: 860px) {
  .layout {
    display: block;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    height: 60px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, #000 8%);
    padding: 0 12px;
  }

  .mobile-brand {
    justify-self: center;
    font-weight: 700;
    color: var(--text);
  }

  .menu-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 0;
    color: var(--text);
    background: transparent;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: none;
    border: 0;
    background: rgba(0, 0, 0, 0.46);
  }

  body.nav-open .nav-backdrop {
    display: block;
  }

  .main {
    padding: 22px 12px 56px;
  }

  .page-header,
  .toolbar,
  .search,
  .daily-layout,
  .grid,
  .source-wall,
  .change-day,
  .admin-form-grid,
  .admin-rule-grid,
  .upstream-feed-list,
  .admin-sync-list {
    grid-template-columns: 1fr;
  }

  .admin-sync-list > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-sync-list > div:last-child {
    border-bottom: 0;
  }

  .admin-span-2 {
    grid-column: auto;
  }

  .admin-card-head,
  .admin-card-foot {
    display: grid;
  }

  .segmented {
    width: 100%;
    border-radius: 0;
  }

  .segmented a,
  .segmented button {
    flex: 1 1 auto;
  }

  .day-group {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .day-label {
    position: static;
    writing-mode: horizontal-tb;
    font-size: 26px;
    line-height: 1;
  }

  .day-items {
    padding-left: 30px;
  }

  .day-items::before {
    left: 10px;
  }

  .timeline-row {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
  }

  .timeline-row::before {
    left: -23px;
  }

  .time {
    font-size: 13px;
  }

  .card {
    padding: 16px 0 18px;
  }

  .item-title {
    font-size: 20px;
  }

  h1 {
    font-size: 36px;
  }

  .item-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-paper {
    padding: 24px 0 0;
  }

  .daily-top h1 {
    font-size: 38px;
  }

  .daily-top h2 {
    font-size: 26px;
  }

  .archive {
    position: static;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
