:root {
  --bg: #f2ead8;
  --surface: #fffaf0;
  --surface-soft: #f6efdf;
  --ink: #26362f;
  --muted: #6d756d;
  --muted-2: #8a8d80;
  --line: #d9cba9;
  --line-strong: #c5b58f;
  --navy: #244d43;
  --navy-2: #316856;
  --red: #a64e47;
  --red-soft: #f3ded8;
  --teal: #4f7c66;
  --teal-soft: #e0ede0;
  --amber: #b87a3e;
  --amber-soft: #f7e5c5;
  --blue: #4b7380;
  --blue-soft: #e5eef0;
  --shadow: 0 10px 24px rgba(66, 55, 35, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image: url("/assets/paper-texture.png");
  background-size: 420px 420px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.icon-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 18px;
  overflow: hidden;
  color: #f0ead7;
  background-color: var(--navy);
  background-image: url("/assets/paper-texture.png");
  background-size: 420px 420px;
  background-blend-mode: soft-light;
  box-shadow: 8px 0 24px rgba(48, 57, 47, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  color: #fff;
  background: rgba(255, 250, 236, 0.94);
  border: 1px solid rgba(255, 244, 211, 0.7);
  border-radius: 50%;
}

.brand-mark img {
  width: 58px;
  height: 66px;
  object-fit: cover;
  object-position: center 24%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-copy strong {
  font-size: 16px;
  font-weight: 700;
}

.brand-copy small {
  color: #b9c9b7;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
}

.primary-nav,
.secondary-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  padding: 0 11px;
  color: #cfdac9;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 246, 220, 0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(255, 244, 217, 0.14);
  box-shadow: inset 3px 0 0 #e6b569;
}

.nav-item span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  min-width: 23px;
  padding: 2px 6px;
  color: #f2e5bf;
  background: rgba(255, 247, 220, 0.1);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.sidebar-divider {
  height: 1px;
  margin: 18px 10px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 13px 10px 2px;
  color: #bdcbb9;
  font-size: 12px;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: #5d7b8e;
  border-radius: 50%;
}

.status-dot.running {
  background: #efb75f;
  box-shadow: 0 0 0 4px rgba(239, 183, 95, 0.14);
}

.status-dot.ok {
  background: #56b8a8;
}

.status-dot.error {
  background: #d76669;
}

.main-content {
  width: 100%;
  max-width: 1480px;
  min-width: 0;
  margin: 0 auto;
  padding: 26px 38px 56px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-height: 182px;
  margin-bottom: 20px;
  padding: 28px 30px 30px;
  overflow: hidden;
  color: #fffaf0;
  background-image: url("/assets/courtyard-banner.jpg");
  background-position: center 58%;
  background-size: cover;
  border: 1px solid #a9b9a4;
  border-radius: 8px;
  box-shadow: 0 7px 0 rgba(75, 91, 70, 0.14);
}

.topbar::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(31, 57, 48, 0.24);
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 5px;
  color: #ffe3a8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 650px;
  color: #fffdf6;
  font-size: 34px;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(25, 45, 38, 0.48);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.last-sync {
  color: #eef3e7;
  font-size: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}

.button:hover {
  border-color: #aaa69d;
}

.button.primary {
  color: #fff;
  background: #a95148;
  border-color: #8e423d;
  box-shadow: 0 3px 0 #743832;
}

.button.primary:hover {
  background: #95463f;
}

.button.secondary {
  background: #fff8e9;
}

.button.ghost {
  background: transparent;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 21px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.metric-icon.red {
  color: var(--red);
  background: var(--red-soft);
}

.metric-icon.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.metric-icon.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.metric-icon.navy {
  color: var(--navy-2);
  background: var(--blue-soft);
}

.metric div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.metric strong {
  font-size: 23px;
  line-height: 1;
}

.metric span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 210px 170px;
  gap: 10px;
  margin-bottom: 14px;
}

.control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.control:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 94, 134, 0.1);
}

.control svg {
  flex: 0 0 auto;
  margin-left: 12px;
  color: var(--muted-2);
}

.control input,
.control select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.control select {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
}

.select-wrap {
  position: absolute;
  right: 10px;
  color: var(--muted-2);
  pointer-events: none;
}

.select-wrap svg {
  width: 15px;
  height: 15px;
  margin: 0;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 2px 9px;
}

.list-heading h2 {
  margin: 0;
  font-size: 14px;
}

.list-heading span {
  color: var(--muted);
  font-size: 12px;
}

.article-list {
  display: grid;
  gap: 10px;
}

.article-row {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 18px 17px 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(31, 39, 47, 0.025);
}

.article-row::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  content: "";
  background: var(--line-strong);
}

.article-row.priority-high::before {
  background: var(--red);
}

.article-row.priority-medium::before {
  background: var(--amber);
}

.article-row.is-read {
  opacity: 0.76;
}

.score-block {
  display: flex;
  align-items: center;
  align-self: start;
  flex-direction: column;
  gap: 1px;
  padding-top: 2px;
}

.score-value {
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.priority-high .score-value {
  color: var(--red);
}

.priority-medium .score-value {
  color: var(--amber);
}

.priority-low .score-value {
  color: var(--muted-2);
}

.score-label {
  color: var(--muted-2);
  font-size: 10px;
}

.article-body {
  min-width: 0;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.source-badge,
.category-label,
.deadline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 650;
}

.source-badge {
  color: var(--navy-2);
  background: var(--blue-soft);
}

.category-label {
  color: #575c61;
  background: #eeece7;
}

.deadline-badge {
  color: #8c3f0d;
  background: var(--amber-soft);
}

.article-body h2 {
  margin: 0 0 7px;
  font-size: 17px;
  line-height: 1.45;
}

.article-body h2 a {
  text-decoration: none;
}

.article-body h2 a:hover {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-summary {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #555b61;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.reason-chip {
  padding: 3px 7px;
  color: #5e646a;
  background: var(--surface-soft);
  border: 1px solid #ebe8e1;
  border-radius: 5px;
  font-size: 11px;
}

.article-actions {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-button.active {
  color: var(--red);
  background: var(--red-soft);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.loading-list,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 40px 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  color: var(--muted-2);
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel + .panel {
  margin-top: 14px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.panel-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #4e5459;
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 94, 134, 0.1);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.form-actions.full {
  grid-column: 1 / -1;
  margin-top: 0;
}

.growth-metrics {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.growth-metric {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.growth-metric.featured {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.growth-metric span {
  color: var(--muted);
  font-size: 12px;
}

.growth-metric.featured span {
  color: #bdd0dc;
}

.growth-metric strong {
  font-size: 26px;
  line-height: 1;
}

.growth-metric small {
  font-size: 12px;
  font-weight: 500;
}

.record-entry summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

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

.goal-card {
  display: flex;
  min-height: 104px;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.goal-card span {
  color: var(--red);
  font-size: 11px;
  font-weight: 750;
}

.goal-card strong {
  font-size: 16px;
}

.goal-card small {
  margin-top: auto;
  color: var(--muted);
  font-size: 11px;
}

.wechat-import textarea {
  min-height: 150px;
}

.wechat-actions {
  justify-content: flex-start;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.import-summary span {
  padding: 5px 9px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}

.import-errors {
  margin-bottom: 14px;
  padding: 10px 12px;
  color: #7b282b;
  background: var(--red-soft);
  border: 1px solid #ecc9ca;
  border-radius: 7px;
  font-size: 12px;
}

.import-errors p {
  margin: 0;
  overflow-wrap: anywhere;
}

.import-errors p + p {
  margin-top: 8px;
}

.import-errors span {
  color: #8d5b5d;
}

.record-entry summary::-webkit-details-marker {
  display: none;
}

.record-entry summary > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.record-entry[open] summary {
  margin-bottom: 20px;
}

.record-entry[open] summary > svg {
  transform: rotate(180deg);
}

.growth-timeline {
  display: grid;
}

.record-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 36px;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.record-row:first-child {
  border-top: 0;
}

.record-date {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.record-date strong {
  color: var(--navy-2);
  font-size: 13px;
}

.record-date span {
  color: var(--muted-2);
  font-size: 11px;
}

.record-main {
  min-width: 0;
}

.record-title-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.record-title-line h3 {
  margin: 0;
  font-size: 15px;
}

.record-type {
  flex: 0 0 auto;
  padding: 3px 7px;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.record-tags span {
  padding: 3px 7px;
  color: #5e646a;
  background: var(--surface-soft);
  border: 1px solid #ebe8e1;
  border-radius: 5px;
  font-size: 11px;
}

.record-main p {
  margin: 9px 0 0;
  color: #555b61;
  font-size: 13px;
  line-height: 1.6;
}

.record-main small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.source-list {
  display: grid;
}

.source-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 1.6fr) auto;
  align-items: center;
  gap: 15px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.source-row:first-child {
  border-top: 0;
}

.source-name {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.source-name strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.source-status::before {
  width: 7px;
  height: 7px;
  content: "";
  background: var(--muted-2);
  border-radius: 50%;
}

.source-status.ok::before {
  background: var(--teal);
}

.source-status.error::before {
  background: var(--red);
}

.source-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 21px;
  background: #c5c8ca;
  border-radius: 999px;
  transition: background 0.18s ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--teal);
}

.switch input:checked + .switch-track::after {
  transform: translateX(15px);
}

.interval-select {
  min-height: 36px;
  padding: 0 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 15px;
  color: #fff;
  background: #26343e;
  border-radius: 7px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.sync-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  color: #6a471c;
  background: var(--amber-soft);
  border: 1px solid #efd2a9;
  border-radius: 7px;
  font-size: 12px;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(106, 71, 28, 0.22);
  border-top-color: #6a471c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .main-content {
    padding-right: 28px;
    padding-left: 28px;
  }

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

  .growth-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .goal-strip {
    grid-template-columns: 1fr;
  }

  .source-row {
    grid-template-columns: minmax(190px, 0.85fr) minmax(170px, 1.2fr) auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: auto;
    height: 66px;
    padding: 7px 10px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .brand,
  .sidebar-divider,
  .sidebar-status,
  .secondary-nav {
    display: none;
  }

  .primary-nav {
    display: inline-flex;
    min-width: max-content;
    gap: 2px;
  }

  .secondary-nav {
    display: inline-flex;
    min-width: max-content;
    gap: 2px;
  }

  .sidebar {
    overflow-x: auto;
    white-space: nowrap;
  }

  .nav-item {
    display: flex;
    width: 72px;
    min-width: 72px;
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 3px 2px;
    border-radius: 6px;
    text-align: center;
  }

  .nav-item.active {
    box-shadow: inset 0 2px 0 var(--red);
  }

  .nav-item svg {
    width: 17px;
    height: 17px;
  }

  .nav-item span:nth-child(2) {
    font-size: 10px;
  }

  .nav-count {
    display: none;
  }

  .main-content {
    padding: 24px 18px 96px;
  }

  .topbar {
    align-items: center;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .last-sync {
    display: none;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar .search-control {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 25px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar-actions .button span {
    display: none;
  }

  .topbar-actions .button {
    width: 40px;
    padding: 0;
  }

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

  .metric {
    min-height: 68px;
    padding: 11px;
  }

  .metric-icon {
    flex-basis: 33px;
    width: 33px;
    height: 33px;
  }

  .metric strong {
    font-size: 20px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar .search-control {
    grid-column: auto;
  }

  .article-row {
    grid-template-columns: 45px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 13px 14px 0;
  }

  .score-value {
    font-size: 20px;
  }

  .article-body h2 {
    font-size: 15px;
  }

  .article-actions {
    grid-column: 2;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .source-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .panel {
    padding: 18px 14px;
  }

  .panel-header {
    flex-direction: column;
  }

  .source-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .source-url,
  .source-status {
    display: none;
  }

  .toast {
    right: 18px;
    bottom: 82px;
  }

  .record-row {
    grid-template-columns: 1fr 36px;
    gap: 10px;
  }

  .record-date {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
}

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

/* Original pastoral-academy visual language. */
.sidebar-mascot {
  position: absolute;
  right: -26px;
  bottom: -34px;
  width: 190px;
  height: auto;
  opacity: 0.13;
  pointer-events: none;
  filter: sepia(0.18) saturate(0.8);
  animation: mascot-float 6s ease-in-out infinite;
}

@keyframes mascot-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-7px) rotate(1deg);
  }
}

.metrics {
  gap: 14px;
}

.metric,
.growth-metric,
.goal-card,
.panel,
.article-row {
  background-color: rgba(255, 250, 240, 0.96);
  background-image: url("/assets/paper-texture.png");
  background-size: 420px 420px;
  background-blend-mode: multiply;
}

.metric {
  min-height: 82px;
  border-color: #d9c9a5;
  border-radius: 7px;
  box-shadow: 0 4px 0 rgba(100, 83, 52, 0.06);
}

.metric-icon {
  border: 1px solid rgba(95, 91, 67, 0.1);
  border-radius: 50%;
}

.toolbar {
  padding: 7px;
  background: rgba(242, 233, 211, 0.83);
  border: 1px solid #d8c9a7;
  border-radius: 8px;
  box-shadow: 0 4px 0 rgba(100, 83, 52, 0.05);
}

.control {
  min-height: 40px;
  background: rgba(255, 252, 244, 0.93);
  border-color: #d8c9a7;
  border-radius: 6px;
}

.control:focus-within,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #5f856b;
  box-shadow: 0 0 0 3px rgba(79, 124, 102, 0.14);
}

.article-row {
  border-color: #d8c9a7;
  border-radius: 7px;
  box-shadow: 0 4px 0 rgba(100, 83, 52, 0.055);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.article-row:hover {
  box-shadow: 0 7px 0 rgba(100, 83, 52, 0.075);
  transform: translateY(-1px);
}

.article-row::before {
  width: 5px;
  background: #b7ad91;
}

.article-row.priority-high::before {
  background: #a64e47;
}

.article-row.priority-medium::before {
  background: #c28a43;
}

.score-block {
  width: 46px;
  height: 50px;
  justify-self: center;
  justify-content: center;
  padding: 0;
  background: #f2ead5;
  border: 1px solid #d4c199;
  border-radius: 50% 50% 44% 44%;
  box-shadow: inset 0 -3px 0 rgba(111, 86, 48, 0.06);
}

.score-value {
  font-size: 20px;
}

.source-badge {
  color: #315f52;
  background: #e3ede0;
}

.category-label {
  color: #6c5b45;
  background: #f2e7cf;
}

.deadline-badge {
  color: #8a4a26;
  background: #f8e1ba;
}

.reason-chip {
  color: #5d685f;
  background: #f3eddf;
  border-color: #e1d5bb;
}

.icon-button:hover {
  color: #315f52;
  background: #edf3e7;
  border-color: #cfddc8;
}

.icon-button.active {
  color: #9e4641;
  background: #f4dfd9;
}

.panel {
  border-color: #d8c9a7;
  border-radius: 7px;
  box-shadow: 0 4px 0 rgba(100, 83, 52, 0.05);
}

.growth-metric.featured {
  background-color: #315f52;
  background-image: url("/assets/paper-texture.png");
  background-blend-mode: soft-light;
  border-color: #244d43;
}

.goal-card {
  border-color: #d8c9a7;
  box-shadow: 0 4px 0 rgba(100, 83, 52, 0.05);
}

.goal-card span {
  color: #a64e47;
}

.field input,
.field select,
.field textarea,
.interval-select {
  background-color: #fffaf0;
  border-color: #cbbb94;
}

.record-row {
  border-color: #dfd3b7;
}

.record-date strong {
  color: #3e6f5b;
}

.record-type {
  color: #8e4540;
  background: #f3dfd9;
}

.record-tags span {
  background: #f2ecde;
  border-color: #e1d6bf;
}

.empty-state,
.loading-list {
  min-height: 330px;
  background: rgba(255, 250, 240, 0.7);
  background-image: url("/assets/paper-texture.png");
  background-size: 420px 420px;
  border-color: #cdbd97;
}

.empty-state::before {
  display: block;
  width: 112px;
  height: 132px;
  margin: 0 auto 10px;
  content: "";
  background: url("/assets/radish-guide.png") center / contain no-repeat;
}

.empty-state svg {
  display: none;
}

.empty-state strong {
  color: #315f52;
}

.toast {
  color: #fffaf0;
  background: #315f52;
  border: 1px solid #5d8069;
  box-shadow: 0 7px 0 rgba(42, 70, 59, 0.16);
}

.sync-progress {
  color: #7a5126;
  background-color: #f8e5c5;
  background-image: url("/assets/paper-texture.png");
  background-size: 420px 420px;
  border-color: #dfbc7d;
}

.import-summary span {
  color: #376754;
  background: #e1ede0;
}

.source-status.ok::before,
.status-dot.ok {
  background: #5b8c70;
}

.status-dot.running {
  background: #d99b45;
}

.status-dot.error {
  background: #b4514b;
}

@media (max-width: 820px) {
  .sidebar-mascot {
    display: none;
  }

  .topbar {
    min-height: 150px;
    padding: 22px 20px 24px;
    background-position: 62% 58%;
  }

  h1 {
    font-size: 28px;
  }

  .toolbar {
    padding: 6px;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 138px;
    padding: 19px 17px 21px;
  }

  .eyebrow {
    font-size: 9px;
  }

  h1 {
    font-size: 25px;
  }

  .score-block {
    width: 41px;
    height: 45px;
  }

  .score-value {
    font-size: 18px;
  }
}

/* Original 16-bit adventure theme. No game assets or layouts are copied. */
body {
  background-size: 512px 512px;
  image-rendering: pixelated;
}

.brand-mark,
.brand-mark img,
.sidebar-mascot,
.topbar,
.empty-state::before {
  image-rendering: pixelated;
}

.brand-mark {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  background: #fff8e6;
  border: 3px solid #d9a64d;
  border-radius: 0;
  box-shadow: 3px 3px 0 #173a30;
}

.brand-mark img {
  width: 42px;
  height: 52px;
  object-fit: contain;
  object-position: center;
}

.sidebar {
  background-color: #21483d;
  background-image: url("/assets/paper-texture.png");
  background-size: 512px 512px;
  background-blend-mode: multiply;
}

.sidebar-mascot {
  right: 8px;
  bottom: 6px;
  width: 128px;
  opacity: 0.18;
  filter: none;
}

.nav-item {
  min-height: 42px;
  border: 2px solid transparent;
  border-radius: 0;
}

.nav-item:hover {
  background: rgba(255, 240, 190, 0.1);
  border-color: rgba(255, 227, 150, 0.22);
}

.nav-item.active {
  color: #203d33;
  background: #e9bd61;
  border-color: #fff1b8;
  box-shadow: 4px 4px 0 #18372e;
}

.nav-count {
  color: #203d33;
  background: #f6e7ba;
  border-radius: 0;
}

.sidebar-divider {
  height: 3px;
  background: #4b7663;
}

.topbar {
  min-height: 188px;
  padding: 28px 30px;
  background-image: url("/assets/courtyard-banner.jpg");
  background-size: cover;
  background-position: center 58%;
  border: 4px solid #2e5b49;
  border-radius: 0;
  box-shadow: 7px 7px 0 rgba(50, 73, 59, 0.24);
}

.topbar::after {
  background: rgba(29, 57, 47, 0.18);
}

h1 {
  text-shadow: 3px 3px 0 rgba(26, 53, 44, 0.62);
}

.eyebrow {
  color: #ffe59b;
  text-shadow: 2px 2px 0 rgba(26, 53, 44, 0.55);
}

.last-sync {
  color: #fff7dc;
  text-shadow: 1px 1px 0 rgba(26, 53, 44, 0.65);
}

.button {
  border-width: 2px;
  border-radius: 0;
  box-shadow: 4px 4px 0 rgba(42, 55, 46, 0.22);
}

.button:hover {
  box-shadow: 5px 5px 0 rgba(42, 55, 46, 0.25);
  transform: translate(-1px, -1px);
}

.button.primary {
  background: #b94f45;
  border-color: #742f31;
  box-shadow: 4px 4px 0 #703331;
}

.button.secondary {
  background: #fff7df;
  border-color: #b89b62;
}

.metric,
.growth-metric,
.goal-card,
.panel,
.article-row,
.control,
.field input,
.field select,
.field textarea,
.interval-select,
.empty-state,
.loading-list {
  border-radius: 0;
}

.metric,
.growth-metric,
.goal-card,
.panel {
  border-width: 3px;
  border-color: #b9a06d;
  box-shadow: 5px 5px 0 rgba(79, 66, 40, 0.13);
}

.metric-icon {
  border-width: 2px;
  border-radius: 0;
}

.toolbar {
  padding: 7px;
  background: #e8d8b6;
  border: 3px solid #b9a06d;
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(79, 66, 40, 0.1);
}

.control {
  border-width: 2px;
  border-color: #b9a06d;
}

.article-row {
  border-width: 3px;
  border-color: #aa986f;
  box-shadow: 5px 5px 0 rgba(79, 66, 40, 0.13);
}

.article-row:hover {
  box-shadow: 7px 7px 0 rgba(79, 66, 40, 0.16);
  transform: translate(-1px, -1px);
}

.article-row::before {
  width: 8px;
}

.score-block {
  width: 48px;
  height: 48px;
  background: #f2dfa6;
  border: 3px solid #917d4c;
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(83, 68, 39, 0.18);
}

.source-badge,
.category-label,
.deadline-badge,
.reason-chip,
.record-type,
.record-tags span {
  border-radius: 0;
}

.icon-button {
  border-width: 2px;
  border-color: transparent;
  border-radius: 0;
}

.icon-button:hover,
.icon-button.active {
  border-color: #9f8b5d;
}

.panel {
  background-color: #fff8e6;
}

.growth-metric.featured {
  background-color: #285746;
  border-color: #183d32;
  box-shadow: 5px 5px 0 rgba(35, 67, 54, 0.18);
}

.field input,
.field select,
.field textarea,
.interval-select {
  border-width: 2px;
  border-color: #b7a170;
}

.empty-state,
.loading-list {
  border-width: 3px;
  border-style: solid;
  border-color: #b8a273;
}

.empty-state::before {
  width: 104px;
  height: 138px;
}

.toast,
.sync-progress,
.import-errors,
.import-summary span {
  border-radius: 0;
}

.toast {
  border-width: 3px;
  box-shadow: 5px 5px 0 rgba(29, 55, 46, 0.3);
}

@media (max-width: 820px) {
  .topbar {
    min-height: 158px;
    border-width: 3px;
    box-shadow: 5px 5px 0 rgba(50, 73, 59, 0.22);
  }

  .nav-item.active {
    box-shadow: inset 0 -4px 0 #7b4b2c;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 142px;
    padding: 18px 17px 20px;
  }

  .score-block {
    width: 42px;
    height: 42px;
  }
}

.auth-gate {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 55, 46, 0.82);
}

.auth-card {
  display: flex;
  width: min(390px, 100%);
  flex-direction: column;
  align-items: stretch;
  padding: 26px;
  background: #fff8e6;
  border: 4px solid #2d5d4b;
  box-shadow: 8px 8px 0 rgba(21, 48, 39, 0.42);
}

.auth-card img {
  width: 96px;
  height: 120px;
  align-self: center;
  object-fit: contain;
  image-rendering: pixelated;
}

.auth-card h2 {
  margin: 8px 0 4px;
  color: #285746;
  text-align: center;
}

.auth-card p {
  margin: 0 0 18px;
  color: #6d756d;
  font-size: 13px;
  text-align: center;
}

.auth-card input {
  min-height: 46px;
  padding: 0 12px;
  color: #26362f;
  background: #fffdf5;
  border: 3px solid #b9a06d;
  border-radius: 0;
  outline: 0;
}

.auth-card input:focus {
  border-color: #4f7c66;
  box-shadow: 0 0 0 3px rgba(79, 124, 102, 0.16);
}

.auth-card .button {
  margin-top: 14px;
}

.auth-error {
  min-height: 18px;
  margin-top: 10px;
  color: #a64e47;
  font-size: 12px;
  text-align: center;
}
