:root {
  --bg: #f7f5ef;
  --panel: #ffffffde;
  --text: #20292a;
  --muted: #657278;
  --line: #d7ddde;
  --accent: #236f5a;
  --accent-soft: #e8f4ef;
  --warm: #e98645;
  --warm-soft: #fff2e8;
  --shadow: 0 16px 34px rgba(24, 39, 33, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  background: linear-gradient(130deg, #ecf5ef 0%, var(--bg) 35%, #fff9ef 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 12% 8%, #bee8d5 0, transparent 25%), radial-gradient(circle at 85% 10%, #ffd7bc 0, transparent 22%);
  opacity: 0.55;
  pointer-events: none;
}

.app-shell { width: min(1180px, 92vw); margin: 20px auto; position: relative; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(8px);
}

.login-panel { max-width: 460px; margin: 10vh auto 0; }
.login-panel h1, .topbar h2 { margin: 0; }

.form-grid, .source-form, .pwd-form, .weight-form { display: grid; gap: 10px; margin-top: 12px; }
.weight-form { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; }
.login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input, select, button { font: inherit; }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.topbar { display: flex; justify-content: space-between; align-items: center; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

.main-nav { margin-top: 12px; display: flex; gap: 10px; }

.nav-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b9dece;
}

.menu-view { margin-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.refresh-wrap {
  display: flex;
  align-items: end;
  gap: 12px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
}

.filter-label {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
  line-height: 48px;
  white-space: nowrap;
}

.filter-select {
  height: 48px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  padding: 0 14px;
}

.stream-stack { margin-top: 12px; display: grid; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stream-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stream-switch-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  min-height: 42px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

.stream-switch-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b9dece;
}
.digest-card.stream-hidden { display: none; }

.feed-stream { display: grid; gap: 8px; }
.brief-box {
  border: 1px solid #cde4d8;
  border-radius: 10px;
  background: linear-gradient(180deg, #f6fcf9, #eef8f2);
  padding: 10px 12px;
}

.brief-title {
  margin: 0;
  font-size: 12px;
  color: #2f7f66;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brief-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.feed-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
}

.feed-row { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; }
.feed-title { margin: 0; font-size: 14px; line-height: 1.4; }
.feed-one-line { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.feed-meta { margin-top: 6px; color: var(--muted); font-size: 12px; }

.feed-detail {
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.feed-detail p { margin: 5px 0; font-size: 13px; line-height: 1.55; }

.settings-card + .settings-card { margin-top: 12px; }
.config-row { margin-top: 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: center; }
.collapse-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
}

.collapse-content {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
}

.category-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafdfb;
}
.check-main { display: flex; align-items: center; gap: 6px; }
.category-delete-btn {
  border: 1px solid #efc1c1;
  background: #fff7f7;
  color: #b14b4b;
  border-radius: 8px;
  padding: 4px 10px;
  min-height: 32px;
  cursor: pointer;
}

.fav-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.inline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.btn-primary, .btn-secondary, .btn-ghost {
  border-radius: 10px;
  border: none;
  cursor: pointer;
  min-height: 42px;
  padding: 9px 12px;
  font-weight: 600;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--warm-soft); color: var(--warm); border: 1px solid #ffc8a2; min-height: 48px; padding: 0 20px; }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-ghost, .btn-secondary, .btn-primary { touch-action: manipulation; }

.source-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.source-list li { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #fff; font-size: 13px; }
.source-quick-actions { display: flex; justify-content: flex-start; margin-top: 10px; }

.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--accent); min-height: 18px; margin: 8px 0 0; font-size: 13px; }
.hidden { display: none; }

.collapse-btn[aria-expanded="true"] {
  border-color: #b9dece;
  background: #f4fbf7;
}

@media (max-width: 1100px) {
  .weight-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  body { font-size: 15px; }
  .app-shell { width: 94vw; margin: 12px auto; }
  .panel { padding: 12px; border-radius: 12px; }
  .stream-stack { grid-template-columns: 1fr; }
  .config-row, .weight-form, .category-form { grid-template-columns: 1fr; }
  .inline-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; gap: 10px; flex-direction: column; }
  .main-nav { width: 100%; gap: 8px; }
  .nav-btn { flex: 1; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .refresh-wrap { width: 100%; flex-direction: column; align-items: stretch; }
  .filter-group { min-width: 0; width: 100%; }
  .filter-label { line-height: normal; }
  .filter-select { height: 44px; }
  .feed-row { flex-direction: column; gap: 8px; }
  .fav-actions { width: 100%; }
  .fav-actions .btn-ghost, .fav-actions .btn-secondary, .fav-actions .btn-primary { width: 100%; }
  .source-list li { font-size: 14px; line-height: 1.45; }
  .feed-title { font-size: 15px; }
  .feed-one-line { font-size: 14px; }
  .feed-meta { font-size: 12px; }
  .collapse-btn { min-height: 46px; }
  .digest-card.stream-hidden {
    display: none;
  }
}
