/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #f5f0e8;
  color: #3a3428;
  line-height: 1.6;
  min-height: 100vh;
}

/* === Layout === */
.screen {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}
.screen.hidden { display: none; }
.screen.active { display: block; }

/* === Login === */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
}
.login-box h1 {
  font-size: 2em;
  margin-bottom: 4px;
  color: #5c4a2a;
}
.login-box .subtitle {
  color: #8a7a5a;
  margin-bottom: 24px;
  font-size: 0.95em;
}
.login-box form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box input {
  padding: 10px 14px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 1em;
  background: #fffdf7;
}
.login-box input:focus {
  outline: none;
  border-color: #8a7a5a;
}
.login-box .hint {
  margin-top: 16px;
  font-size: 0.85em;
  color: #aaa;
}

/* === Buttons === */
.btn {
  padding: 8px 16px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #ede7d9;
  color: #3a3428;
  cursor: pointer;
  font-size: 0.95em;
  transition: background 0.15s;
}
.btn:hover { background: #ddd5c3; }
.btn-primary {
  background: #6b8f4a;
  color: #fff;
  border-color: #5a7a3a;
}
.btn-primary:hover { background: #5a7a3a; }
.btn-small { padding: 5px 12px; font-size: 0.85em; }
.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #d5d0c5;
  color: #999;
  border-color: #ccc;
}
.btn-advance {
  padding: 10px 20px;
  font-size: 1em;
  font-weight: 600;
}
.precompute-status {
  margin-top: 10px;
  font-size: 0.85em;
  color: #6b5e4f;
}
.precompute-item {
  padding: 4px 0;
  border-bottom: 1px dashed #e0d8c8;
  animation: fadeIn 0.4s ease-in;
}
.precompute-done::before {
  content: "\2714 ";
  color: #5a8a3c;
}
.precompute-all-done {
  font-weight: bold;
  color: #5a8a3c;
  margin-top: 4px;
  border-bottom: none;
}
.precompute-all-done::before {
  content: "\2605 ";
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Error === */
.error-msg {
  color: #c0392b;
  font-size: 0.9em;
  min-height: 1.4em;
}
.hidden { display: none !important; }

/* === Top Bar === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #c8b98a;
}
.top-bar h2 { font-size: 1.4em; color: #5c4a2a; }
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
#username-display {
  font-size: 0.9em;
  color: #8a7a5a;
}

/* === New Game Panel === */
.new-game-panel {
  background: #ede7d9;
  border: 1px solid #c8b98a;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}
.new-game-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.new-game-panel h3 { margin-bottom: 8px; color: #5c4a2a; }
.new-game-panel p { margin-bottom: 12px; font-size: 0.95em; }

.county-type-choices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-county-type {
  flex: 1;
  min-width: 180px;
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.btn-county-type strong { font-size: 0.98em; }
.btn-county-type span { font-size: 0.8em; color: #666; }

.btn-choice-selected {
  background: #d9d0bb;
  border-color: #8a7a5a;
  box-shadow: inset 0 0 0 1px #8a7a5a;
}

.new-game-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.new-game-actions .hint {
  margin: 0;
  color: #8a7a5a;
  font-size: 0.85em;
}

/* === Game List === */
#game-list-container h3 { margin-bottom: 12px; color: #5c4a2a; }
.game-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fffdf7;
}
.game-card-info { font-size: 0.95em; }
.game-card-info span { color: #8a7a5a; margin-left: 12px; }

/* === Game Header === */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #c8b98a;
}
.game-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-info {
  display: flex;
  gap: 20px;
  font-size: 1.05em;
  font-weight: bold;
  color: #5c4a2a;
}

/* === Tabs === */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #c8b98a;
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.95em;
  color: #8a7a5a;
  transition: all 0.15s;
}
.tab-btn:hover { color: #5c4a2a; }
.tab-btn.active {
  color: #5c4a2a;
  border-bottom-color: #6b8f4a;
  font-weight: bold;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Dashboard Two-Column Layout === */
.dashboard-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
  align-items: start;
}
.dashboard-main {
  min-width: 0; /* 防止内容撑破 grid */
}
.dashboard-sidebar {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 知县档案侧栏卡片 */
.sidebar-archive-card {
  background: #fffdf7;
  border: 1px solid #c8b98a;
  border-radius: 6px;
  padding: 12px 14px;
}
.sidebar-archive-title {
  font-size: 0.85em;
  font-weight: bold;
  color: #8a7a5a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #ede7d9;
}
.sidebar-archive-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.sidebar-archive-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.82em;
  color: #5c4a2a;
  padding: 2px 0;
}
.sidebar-archive-stat-label { color: #8a7a5a; }
.sidebar-archive-stat-value { font-weight: bold; color: #3d2e10; }
.sidebar-archive-quote {
  font-size: 0.8em;
  color: #8a7a5a;
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.4;
  border-left: 2px solid #c8b98a;
  padding-left: 8px;
}

/* 侧栏内 环境 / 粮食盈余：字号略紧凑 */
.dashboard-sidebar .section-title {
  font-size: 0.88em;
}
.dashboard-sidebar .env-row {
  flex-direction: column;
  gap: 4px;
}
.dashboard-sidebar .env-item {
  font-size: 0.82em;
}

@media (max-width: 960px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    position: static;
  }
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-card {
  background: #fff;
  border: 1px solid #ddd5bd;
  border-radius: 7px;
  padding: 12px 13px 10px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  cursor: default;
}
.stat-card:hover { box-shadow: 0 2px 10px rgba(60,40,10,0.10); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--sc-stripe, #c8b98a);
  border-radius: 7px 7px 0 0;
}
.stat-card.tier-red    { --sc-stripe: #b03030; }
.stat-card.tier-amber  { --sc-stripe: #c97a10; }
.stat-card.tier-olive  { --sc-stripe: #7a9a30; }
.stat-card.tier-jade   { --sc-stripe: #3d8050; }
.stat-card .stat-label {
  font-size: 0.76em;
  color: #8a7a5a;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 2em;
  font-weight: 700;
  color: #3a3428;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.stat-tier-label {
  font-size: 0.72em;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
}
.tier-red   .stat-tier-label { background: #f5dada; color: #8b2020; }
.tier-amber .stat-tier-label { background: #f8e8c0; color: #7a4a08; }
.tier-olive .stat-tier-label { background: #e5eece; color: #4a6018; }
.tier-jade  .stat-tier-label { background: #c8e8d4; color: #1d5c35; }
.stat-delta { font-size: 0.72em; color: #b0a48c; }
.stat-delta.up   { color: #3d7a52; }
.stat-delta.down { color: #c0392b; }
.stat-bar-wrap {
  height: 3px;
  background: #ede5d0;
  border-radius: 2px;
  margin-top: 7px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--sc-stripe, #c8b98a);
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1);
}

/* === Info Row (old — kept for any residual use) === */
.info-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; padding: 12px; background: #ede7d9; border-radius: 6px; font-size: 0.9em; }
.info-item { color: #5c4a2a; }
.info-item strong { margin-right: 4px; }
.info-item-expandable:hover { color: #8b6914; }

/* === Hero Row (expandable metric cards) === */
.hero-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.hero-card-wrap {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(60,40,10,0.08);
}
.hero-card-inner {
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  position: relative;
  transition: filter 0.15s;
  color: #fff;
}
.hero-card-inner:hover { filter: brightness(1.06); }
.hero-grain          { background: linear-gradient(135deg, #2d6040, #4a9a68); }
.hero-grain-danger   { background: linear-gradient(135deg, #8b1010, #c0392b); }
.hero-quota-ok       { background: linear-gradient(135deg, #2a5a80, #4a88b8); }
.hero-quota-warn     { background: linear-gradient(135deg, #7a4a08, #c97a10); }
.hero-quota-danger   { background: linear-gradient(135deg, #8b1010, #c0392b); }
.hero-quota-critical { background: linear-gradient(135deg, #5a0000, #8b0000); }
.hero-label { font-size: 0.75em; letter-spacing: 0.10em; opacity: 0.8; font-weight: 500; }
.hero-num   { font-size: 2.4em; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.hero-unit  { font-size: 0.65em; font-weight: 400; opacity: 0.75; margin-left: 2px; }
.hero-sub   { font-size: 0.79em; opacity: 0.75; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-sub-tag {
  background: rgba(255,255,255,0.2);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.88em;
}
.hero-sub-danger { background: rgba(255,100,80,0.3); }
.hero-bar-wrap  { height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.hero-bar-fill  { height: 100%; background: rgba(255,255,255,0.65); border-radius: 2px; }
.hero-chevron {
  position: absolute;
  bottom: 9px; right: 13px;
  font-size: 0.72em;
  opacity: 0.5;
  transition: transform 0.22s;
  pointer-events: none;
}
.hero-card-inner.hero-expanded .hero-chevron { transform: rotate(180deg); }
/* detail panel */
.hero-detail {
  padding: 12px 17px 10px;
  color: rgba(255,255,255,0.9);
}
.hero-grain          ~ .hero-detail { background: rgba(20,55,35,0.97); }
.hero-grain-danger   ~ .hero-detail { background: rgba(70,8,8,0.97); }
.hero-quota-ok       ~ .hero-detail { background: rgba(18,48,72,0.97); }
.hero-quota-warn     ~ .hero-detail { background: rgba(65,36,5,0.97);  }
.hero-quota-danger   ~ .hero-detail { background: rgba(70,8,8,0.97); }
.hero-quota-critical ~ .hero-detail { background: rgba(50,0,0,0.98);  }
.hd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.83em;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.hd-row:last-child { border-bottom: none; }
.hd-row-warn .hd-value { color: #ffcc80; }
.hd-label { opacity: 0.88; }
.hd-value { font-weight: 600; color: #fff; }
.hd-divider { border: none; border-top: 1px solid rgba(255,255,255,0.15); margin: 4px 0; }
.hd-mini-bar-wrap  { display: inline-block; width: 60px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; vertical-align: middle; margin-right: 5px; overflow: hidden; }
.hd-mini-bar-fill  { display: block; height: 100%; background: rgba(255,255,255,0.6); border-radius: 2px; }
/* quota detail rows inside hero */
.hd-quota-row { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.10); }
.hd-quota-row:last-child { border-bottom: none; }
.hd-quota-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-size: 0.83em; }
.hd-bar-track { height: 5px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.hd-bar-fill  { height: 100%; border-radius: 3px; transition: width 0.7s cubic-bezier(0.22,1,0.36,1); }
.hd-bar-ok     { background: rgba(180,255,200,0.7); }
.hd-bar-warn   { background: rgba(255,220,120,0.7); }
.hd-bar-danger { background: rgba(255,160,140,0.7); }
.hd-bar-proj   { background: rgba(180,210,255,0.5); }

/* === Info Row Compact (infra pips + fiscal) === */
.info-row-compact {
  background: #fff;
  border: 1px solid #ddd5bd;
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(60,40,10,0.07);
}
.infra-pips-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.infra-item { display: flex; flex-direction: column; gap: 3px; }
.infra-item-label { font-size: 0.75em; color: #7a6e5a; }
.infra-pips-wrap  { display: flex; gap: 4px; align-items: center; }
.pip {
  width: 10px; height: 10px; border-radius: 2px;
  background: #e0d5bc;
}
.pip-filled { background: #3d7a52; }
.infra-item-text { font-size: 0.72em; color: #b0a48c; margin-left: 3px; }
/* compact fiscal */
.compact-fiscal {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  font-size: 0.84em;
  border-top: 1px dashed #ddd5bd;
  padding-top: 9px;
}
.cf-item { color: #7a6e5a; }
.cf-val   { color: #4a3f30; font-weight: 500; }
.cf-good  { color: #3d7a52; font-weight: 500; }
.cf-warn  { color: #c0392b; font-weight: 500; }
.cf-muted { color: #b0a48c; }
.cf-expandable { cursor: pointer; }
.cf-expandable:hover { color: #4a3f30; }
.cf-chevron { font-size: 0.85em; opacity: 0.6; }

/* === Invest compact rows (replacing invest-item in dashboard) === */
.invest-compact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #ddd5bd;
  font-size: 0.87em;
  color: #4a3f30;
}
.invest-compact-row:last-child { border-bottom: none; }
.invest-eta {
  font-size: 0.8em; color: #8a7a5a;
  background: #ede5d0; padding: 1px 7px; border-radius: 9px;
}

/* === Rumors Board (enhanced) === */
#rumors-board {
  background: #fff;
  border: 1px solid #c8b98a;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(60,40,10,0.07);
  position: relative;
  overflow: hidden;
}
#rumors-board::after {
  content: '告';
  position: absolute;
  top: 10px; right: 14px;
  font-family: "Noto Serif SC", "PingFang SC", serif;
  font-size: 2em;
  font-weight: 700;
  color: #a81c1c;
  opacity: 0.07;
  pointer-events: none;
  line-height: 1;
}
.rumors-list { display: flex; flex-direction: column; }
.rumor-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px dashed #ddd5bd;
}
.rumor-item:last-child { border-bottom: none; padding-bottom: 0; }
.rumor-cat {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.72em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  margin-top: 2px;
  letter-spacing: 0.03em;
}
.rumor-cat-folk     { background: #e8e0d4; color: #5a4a30; }
.rumor-cat-neighbor { background: #d8e8f4; color: #2a5a7a; }
.rumor-cat-public   { background: #f5dada; color: #8b2020; }
.rumor-text  { font-size: 0.9em; color: #4a3f30; line-height: 1.65; flex: 1; }
.rumor-source { font-size: 0.78em; color: #b0a48c; margin-top: 2px; display: block; }
#rumors-board .section-title { margin-bottom: 10px; }

/* === Sidebar: directive, env bars, markets === */
.sidebar-directive {
  background: #fdf8ed;
  border: 1px solid #f5e0b0;
  border-left: 3px solid #c97a10;
  border-radius: 6px;
  padding: 11px 13px;
  font-size: 0.86em;
}
.sidebar-directive-label {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #c97a10;
  margin-bottom: 6px;
}
.sidebar-directive-row { margin-bottom: 6px; }
.sidebar-directive-row:last-child { margin-bottom: 0; }
.sidebar-directive-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.sidebar-directive-tag {
  font-size: 0.76em; font-weight: 600;
  background: #f5e0b0; color: #7a4a08;
  padding: 1px 6px; border-radius: 7px;
}
.sidebar-directive-age  { font-size: 0.78em; color: #b0a48c; }
.sidebar-directive-text { color: #4a3f30; line-height: 1.55; }
/* env sidebar bars */
.env-sidebar-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  font-size: 0.83em;
  padding: 4px 0;
  border-bottom: 1px dashed #ddd5bd;
}
.env-sidebar-row:last-child { border-bottom: none; }
.env-sidebar-label { color: #7a6e5a; flex-shrink: 0; }
.env-sidebar-right { display: flex; align-items: center; gap: 6px; }
.env-sidebar-bar   { width: 52px; height: 4px; background: #ede5d0; border-radius: 2px; overflow: hidden; }
.env-sidebar-fill  { height: 100%; border-radius: 2px; }
.env-fill-good { background: #3d7a52; }
.env-fill-warn { background: #c97a10; }
.env-fill-risk { background: #c0392b; }
.env-sidebar-val { font-size: 0.8em; color: #4a3f30; font-weight: 500; min-width: 28px; text-align: right; }
/* markets sidebar */
.mkt-sidebar-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.84em;
  padding: 5px 0;
  border-bottom: 1px dashed #ddd5bd;
}
.mkt-sidebar-row:last-child { border-bottom: none; }
.mkt-sidebar-name { color: #4a3f30; font-weight: 500; }
.mkt-sidebar-gmv  { color: #8a7a5a; }
.mkt-sidebar-gmv span { color: #8b6914; font-weight: 600; }
.admin-cost-detail {
  width: 100%;
  margin-top: 6px;
  padding: 8px 12px;
  background: #f5f0e4;
  border-radius: 4px;
  border: 1px solid #d4c9a8;
}
.admin-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 0.85em;
  color: #5c4a2a;
}
.admin-detail-total {
  border-top: 1px solid #c9b896;
  margin-top: 4px;
  padding-top: 4px;
}

/* === Environment === */
#environment-info {
  margin-bottom: 16px;
}
.env-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 12px;
  background: #f0ece2;
  border-radius: 4px;
  font-size: 0.9em;
}
.env-item { color: #5c4a2a; }
.quota-item { width: 100%; }

/* === Remit Ratio Adjustment Widget === */
.remit-ratio-widget {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fdf6e3;
  border: 1px solid #d4a843;
  border-radius: 4px;
}
.remit-ratio-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.remit-ratio-note {
  font-size: 0.85em;
  color: #7a6030;
}
.remit-ratio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.remit-ratio-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
}
.remit-ratio-preview {
  font-size: 0.85em;
  color: #5c4a2a;
  flex: 1;
}
.btn-warning {
  background: #e67e22;
  color: #fff;
  border: none;
}
.btn-warning:hover:not(:disabled) {
  background: #cf6d17;
}

/* === Disaster Alert === */
.disaster-alert {
  border: 2px solid #c0392b;
  background: #fdf0ef;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #8b1a1a;
}
.disaster-alert strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05em;
}

/* === Investments === */
#investments-list {
  background: #fff;
  border: 1px solid #ddd5bd;
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(60,40,10,0.07);
}
.invest-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #d5ceb8;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 0.9em;
  background: #fffdf7;
}

/* === Markets === */
#markets-info {
  margin-bottom: 16px;
}
.market-row {
  display: flex;
  gap: 24px;
  padding: 8px 12px;
  font-size: 0.9em;
}

/* === Player Info === */
#player-info {
  margin-bottom: 16px;
}
.player-card {
  background: #ede7d9;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.9em;
}
.player-card .player-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.player-flavor {
  margin-bottom: 8px;
  font-size: 0.88em;
  color: #6b5d45;
  font-style: italic;
  line-height: 1.5;
}
.player-flavor-belief { font-weight: 500; }
.player-flavor-style { margin-left: 6px; color: #8a7a5a; }

/* === Section Titles === */
.section-title {
  font-size: 1em;
  color: #5c4a2a;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d5ceb8;
}

/* === Villages Table === */
.village-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.village-card {
  background: #fff;
  border: 1px solid #ddd5bd;
  border-radius: 8px;
  padding: 13px 14px;
  box-shadow: 0 1px 3px rgba(60,40,10,0.06);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.village-card:hover { box-shadow: 0 2px 8px rgba(60,40,10,0.11); transform: translateY(-1px); }
.village-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}
.village-card-name {
  font-weight: 600;
  font-size: 0.95em;
  color: #3a3428;
}
.village-card-pop {
  font-size: 0.8em;
  color: #8a7a5a;
}
.village-pop-bar-wrap {
  height: 4px;
  background: #ede5d0;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.village-pop-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: #3d7a52;
  transition: width 0.5s ease;
}
.village-pop-bar-fill.warn   { background: #c97a10; }
.village-pop-bar-fill.danger { background: #c0392b; }
.village-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.village-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.village-stat-label {
  font-size: 0.68em;
  color: #b0a48c;
  letter-spacing: 0.04em;
}
.village-stat-value {
  font-size: 0.9em;
  font-weight: 600;
  color: #3a3428;
  padding: 1px 6px;
  border-radius: 7px;
}
.vstat-red    .village-stat-value { background: #f5dada; color: #8b2020; }
.vstat-amber  .village-stat-value { background: #f8e8c0; color: #7a4a08; }
.vstat-olive  .village-stat-value { background: #e5eece; color: #4a6018; }
.vstat-jade   .village-stat-value { background: #c8e8d4; color: #1d5c35; }

/* Village table cell tier colors */
.data-table td.vstat-red    { background: #fdf0f0; color: #8b2020; font-weight: 600; }
.data-table td.vstat-amber  { background: #fdf6e3; color: #7a4a08; font-weight: 600; }
.data-table td.vstat-olive  { background: #f4f8ec; color: #4a6018; font-weight: 600; }
.data-table td.vstat-jade   { background: #edf8f1; color: #1d5c35; font-weight: 600; }
.data-table td.td-tier-red  { background: #fdf0f0; color: #8b2020; }
.data-table td.td-tier-amber{ background: #fdf6e3; color: #7a4a08; }
.data-table td.td-tier-olive{ background: #f4f8ec; color: #4a6018; }
.data-table td.td-tier-jade { background: #edf8f1; color: #1d5c35; }
.village-tr { cursor: pointer; }
.village-tr:hover td { background-color: #f5f0e4 !important; }
.vt-name { font-size: 0.9em; }
.vt-center { text-align: center; }
.vt-none { color: rgba(255,255,255,0.3); font-size: 0.85em; }
.occ-ok     { font-size: 0.8em; color: #4a6018; }
.occ-warn   { font-size: 0.8em; color: #7a4a08; font-weight: 600; }
.occ-danger { font-size: 0.8em; color: #8b2020; font-weight: 600; }
.village-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.78em;
  color: #8a7a5a;
  border-top: 1px dashed #ddd5bd;
  padding-top: 7px;
  margin-top: 2px;
}
.village-footer-item span { color: #4a3f30; font-weight: 500; }
.village-has-school {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 6px;
  background: #d4eec8;
  color: #3a6820;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #d5ceb8;
}
.data-table th {
  background: #ede7d9;
  font-weight: bold;
  color: #5c4a2a;
  font-size: 0.9em;
}
.data-table td { font-size: 0.9em; }
.data-table tr:hover td { background: #f8f4ec; }
.village-name-link {
  border: none;
  background: transparent;
  color: #5c4a2a;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.village-name-link:hover {
  color: #6b8f4a;
}

/* === Tax Control === */
.action-section {
  margin-bottom: 24px;
}
.action-section h3 {
  font-size: 1.05em;
  color: #5c4a2a;
  margin-bottom: 10px;
}
.tax-two-col {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.tax-col {
  flex: 1;
  min-width: 220px;
}
.tax-col-label {
  font-size: 0.9em;
  color: #5c4a2a;
  margin-bottom: 6px;
  font-weight: bold;
}
.tax-season-hint {
  font-weight: normal;
  color: #9a8060;
  font-size: 0.88em;
}
.tax-col.tax-disabled .tax-control {
  opacity: 0.5;
  pointer-events: none;
}
.tax-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ede7d9;
  border-radius: 6px;
}
#tax-slider {
  flex: 1;
  max-width: 200px;
  accent-color: #6b8f4a;
}
#commercial-tax-slider {
  flex: 1;
  max-width: 200px;
  accent-color: #6b8f4a;
}
#tax-display {
  font-weight: bold;
  font-size: 1.1em;
  min-width: 40px;
  text-align: center;
}
.relief-control {
  justify-content: flex-start;
  flex-wrap: wrap;
}
#relief-claimed-loss {
  width: 180px;
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #fffdf7;
  color: #5c4a2a;
}
#relief-advice {
  margin-top: 6px;
  margin-bottom: 8px;
  color: #6b5c3a;
}
#emergency-status {
  margin-top: 4px;
  margin-bottom: 8px;
  color: #5c4a2a;
}
#emergency-neighbor-select {
  min-width: 180px;
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #fffdf7;
  color: #5c4a2a;
}
#emergency-borrow-amount,
#emergency-gentry-amount,
#emergency-force-amount {
  width: 180px;
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #fffdf7;
  color: #5c4a2a;
}

/* === Medical Control === */
.medical-control {
  padding: 12px;
  background: #ede7d9;
  border-radius: 6px;
}
.medical-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.medical-slider-row input[type="range"] {
  flex: 1;
  max-width: 200px;
  accent-color: #6b8f4a;
}
#medical-display {
  font-weight: bold;
  font-size: 0.95em;
  min-width: 180px;
}
.medical-levels-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8em;
  color: #8a7a5a;
}

/* === Investment Cards === */
.invest-group { margin-bottom: 20px; }
.invest-group-title {
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #8a7a5a;
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid #ddd5bd;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.invest-group-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 12px;
  background: #a81c1c;
  border-radius: 2px;
}
.invest-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.invest-card {
  border: 1px solid #ddd5bd;
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  box-shadow: 0 1px 3px rgba(60,40,10,0.06);
  position: relative;
}
.invest-card:hover:not(.disabled) {
  border-color: #6b8f4a;
  box-shadow: 0 2px 8px rgba(60,40,10,0.12);
  transform: translateY(-1px);
}
.invest-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f5f2eb;
}
.invest-card .card-name {
  font-weight: 600;
  font-size: 0.95em;
  margin-bottom: 5px;
  color: #3a3428;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.invest-card .card-level-pips {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  margin-left: 2px;
}
.invest-card .card-level-pips .cpip {
  width: 8px; height: 8px;
  border-radius: 2px;
  background: #e0d5bc;
}
.invest-card .card-level-pips .cpip.on { background: #3d7a52; }
.invest-card .card-cost {
  font-size: 0.82em;
  color: #a81c1c;
  font-weight: 600;
  margin-bottom: 5px;
}
.invest-card .card-desc {
  font-size: 0.82em;
  color: #7a6e5a;
  line-height: 1.5;
}
.invest-card .card-reason {
  display: inline-block;
  font-size: 0.76em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  background: #f5dada;
  color: #8b2020;
  margin-top: 6px;
}
/* tax section */
.tax-section-card {
  background: #fff;
  border: 1px solid #ddd5bd;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(60,40,10,0.06);
}
.tax-section-title {
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #8a7a5a;
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid #ddd5bd;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tax-section-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 12px;
  background: #a81c1c;
  border-radius: 2px;
}
.tag-custom {
  display: inline-block;
  font-size: 0.7em;
  font-weight: normal;
  padding: 1px 5px;
  border-radius: 3px;
  background: #d4eec8;
  color: #3a6820;
  margin-left: 4px;
  vertical-align: middle;
}
.tag-tier2 {
  display: inline-block;
  font-size: 0.7em;
  font-weight: normal;
  padding: 1px 5px;
  border-radius: 3px;
  background: #e8d5f0;
  color: #6b3a8a;
  margin-left: 4px;
  vertical-align: middle;
}
.tag-tier2-status {
  display: inline-block;
  font-size: 0.7em;
  font-weight: normal;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f5e6c8;
  color: #8a5a0a;
  margin-left: 4px;
  vertical-align: middle;
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none !important; }
.modal-content {
  background: #fffdf7;
  border-radius: 8px;
  padding: 24px;
  min-width: 300px;
  border: 2px solid #c8b98a;
}
.dismissal-modal-content {
  width: min(400px, 90vw);
  text-align: center;
  border-color: #8a2020;
}
.dismissal-icon { font-size: 2em; margin-bottom: 8px; }
.dismissal-title { color: #8a2020; margin: 0 0 12px; }
.dismissal-body { font-size: 0.95em; line-height: 1.7; margin-bottom: 8px; }
.dismissal-month { color: #8a2020; font-weight: bold; }
.dismissal-note  { margin-bottom: 16px; }
.newbie-tutorial-content {
  width: min(480px, 90vw);
}
.newbie-tutorial-speaker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.newbie-tutorial-avatar {
  font-size: 1.3em;
}
.newbie-tutorial-name {
  font-weight: bold;
  color: #5a3a10;
  font-size: 0.92em;
}
.newbie-tutorial-bubble {
  min-height: 80px;
  margin-bottom: 16px;
  font-size: 0.93em;
  line-height: 1.75;
}
.newbie-tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.newbie-tutorial-step {
  font-size: 0.82em;
  color: #999;
}
.knowledge-modal-content {
  width: min(920px, 92vw);
  max-width: 920px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.knowledge-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.knowledge-modal-header h4 {
  margin: 0;
}
.knowledge-modal-body {
  overflow: auto;
  padding-right: 4px;
  line-height: 1.75;
  color: #4b3e2f;
}
.knowledge-intro {
  margin: 0 0 16px;
  color: #7a6b56;
}
.knowledge-section {
  border-top: 1px solid #ded3bf;
  padding-top: 14px;
  margin-top: 14px;
}
.knowledge-section h5 {
  margin: 0 0 10px;
  color: #5c4a2a;
  font-size: 1.02em;
}
.knowledge-subtitle {
  margin: 12px 0 8px;
  color: #6d5332;
  font-size: 0.96em;
}
.knowledge-section p,
.knowledge-section blockquote,
.knowledge-section ul,
.knowledge-section table {
  margin: 0 0 10px;
}
.knowledge-section ul {
  padding-left: 20px;
}
.knowledge-section li {
  margin-bottom: 4px;
}
.knowledge-section blockquote {
  padding: 8px 12px;
  background: #efe5d3;
  border-left: 3px solid #b89968;
  color: #6a573a;
}
.knowledge-table-wrap {
  overflow-x: auto;
}
.knowledge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  background: #fffdf8;
}
.knowledge-table th,
.knowledge-table td {
  border: 1px solid #d9ccb3;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.knowledge-table th {
  background: #efe5d3;
  color: #5c4a2a;
}
.feedback-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 180;
  min-width: 84px;
  padding: 10px 16px;
  border: 1px solid #8b6a2f;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9ecd0 0%, #ead3a0 100%);
  box-shadow: 0 10px 24px rgba(79, 53, 20, 0.22);
}
.feedback-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(79, 53, 20, 0.28);
}
.feedback-modal-content {
  max-width: 520px;
}
.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.feedback-modal-header h4 {
  margin: 0;
}
.feedback-modal-meta {
  margin-bottom: 10px;
}
.feedback-input {
  width: 100%;
  min-height: 144px;
  padding: 10px 12px;
  border: 1px solid #c8b98a;
  border-radius: 6px;
  font-size: 0.95em;
  line-height: 1.6;
  resize: vertical;
  background: #fffdf8;
}
.feedback-input:focus {
  outline: none;
  border-color: #8b6a2f;
  box-shadow: 0 0 0 3px rgba(139, 106, 47, 0.14);
}
.modal-content h4 { margin-bottom: 12px; color: #5c4a2a; }
.modal-content select {
  width: 100%;
  padding: 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 1em;
  background: #fff;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.village-detail-content {
  width: min(860px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
}
.village-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #d9ceb7;
  padding-bottom: 8px;
}
.village-detail-header h4 {
  margin: 0;
}
.village-detail-body {
  overflow: auto;
  padding-right: 2px;
}
.village-detail-section {
  background: #f7f2e8;
  border: 1px solid #dfd3bc;
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
}
.village-detail-section h5 {
  margin: 0 0 8px;
  color: #5c4a2a;
  font-size: 0.95em;
}
.village-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}
.village-kv-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed #dccfb6;
  padding: 3px 0;
  font-size: 0.9em;
  color: #4f4434;
}
.village-kv-grid > div strong {
  color: #5b4e3b;
  font-weight: 600;
}

/* === Report === */
#report-content {
  margin-bottom: 16px;
}
.report-events {
  margin-bottom: 16px;
}
.report-event {
  padding: 8px 12px;
  border-left: 3px solid #c8b98a;
  margin-bottom: 6px;
  font-size: 0.93em;
  background: #fffdf7;
}
.report-event-urgent {
  border-left-color: #c0392b;
  background: #fef9e7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}
.report-nego-btn {
  flex-shrink: 0;
  margin-left: 12px;
}
.report-section {
  margin-bottom: 16px;
}
.report-section h4 {
  font-size: 0.95em;
  color: #5c4a2a;
  margin-bottom: 8px;
}
.report-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  background: #ede7d9;
  border-radius: 4px;
  font-size: 0.9em;
}
.report-detail-item strong { margin-right: 4px; }

.report-debug-note {
  margin-top: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid #b58900;
  background: #fff8df;
  color: #5c4a2a;
  font-size: 0.85em;
}

.report-debug-table th,
.report-debug-table td {
  font-size: 0.84em;
}

/* === Summary === */
.summary-box {
  max-width: 980px;
  margin: 40px auto;
}
.summary-box h2 {
  text-align: center;
  font-size: 1.6em;
  color: #5c4a2a;
  margin-bottom: 24px;
}
#summary-stats {
  margin-bottom: 20px;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.summary-stat {
  background: #ede7d9;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}
.summary-stat .label { font-size: 0.85em; color: #8a7a5a; }
.summary-stat .value { font-size: 1.3em; font-weight: bold; color: #5c4a2a; }
#summary-villages { margin-bottom: 24px; }
.summary-box .btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px;
  font-size: 1.1em;
}

/* === Summary v2 === */
#summary-v2 {
  margin-bottom: 20px;
}
.summary2-hero {
  background: linear-gradient(145deg, #f7f2e8 0%, #efe5d2 100%);
  border: 1px solid #d6c7a2;
  border-left: 6px solid #8b1e2d;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
  animation: summaryIn 0.4s ease-out;
}
.summary2-hero-dismissed {
  background: linear-gradient(145deg, #2a0808 0%, #1e0505 100%);
  border-color: #8b0000;
  border-left-color: #cc0000;
  color: #f0d0c0;
}
.summary2-hero-dismissed .summary2-title { color: #c09080; }
.summary2-hero-dismissed h2 { color: #f5d0c0; }
.summary2-hero-dismissed .summary2-narrative { color: #e8c8b8; }
.summary2-hero-dismissed .summary2-baseline { color: #a08070; }
.summary2-dismissed-banner {
  background: #6b0000;
  color: #ffe0d0;
  font-weight: 700;
  font-size: 0.92em;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.summary2-grade-dismissed,
.summary2-outcome-dismissed {
  background: #4a0808;
  border-color: #8b0000;
  color: #ff9090;
  font-weight: 700;
}
.summary2-title {
  display: inline-block;
  font-size: 0.8em;
  letter-spacing: 0.08em;
  color: #7b6240;
  margin-bottom: 4px;
}
.summary2-hero h2 {
  margin: 0 0 8px;
  color: #4e2f1c;
  font-size: 1.5em;
}
.summary2-score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.9em;
}
.summary2-grade,
.summary2-outcome,
.summary2-score {
  background: #fdf9f1;
  border: 1px solid #d6c7a2;
  border-radius: 999px;
  padding: 2px 10px;
}
.summary2-score {
  color: #8b1e2d;
  font-weight: bold;
}
.summary2-narrative {
  margin: 6px 0 10px;
  color: #5c4a2a;
}
.summary2-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.summary2-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82em;
  background: #ece4d3;
  color: #5c4a2a;
}
.summary2-chip-badge {
  background: #8b1e2d;
  color: #fff7ea;
}
.summary2-baseline {
  font-size: 0.8em;
  color: #7b6240;
}
.summary2-section {
  margin-bottom: 18px;
}
.summary2-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.summary2-kpi-card {
  background: #fffdf8;
  border: 1px solid #d9ceb7;
  border-radius: 6px;
  padding: 10px 12px;
}
.summary2-kpi-label {
  font-size: 0.82em;
  color: #7a6a50;
  margin-bottom: 4px;
}
.summary2-kpi-final {
  font-size: 1.3em;
  color: #4e2f1c;
  font-weight: bold;
}
.summary2-kpi-sub {
  font-size: 0.8em;
  color: #8a7a5a;
}
.summary2-kpi-delta {
  font-size: 0.85em;
  margin-top: 4px;
}
.summary2-year-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.summary2-year-card {
  background: #fffdf8;
  border: 1px solid #d9ceb7;
  border-radius: 6px;
  padding: 10px 12px;
}
.summary2-year-header {
  font-weight: bold;
  color: #5c4a2a;
  margin-bottom: 6px;
}
.summary2-year-metrics {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85em;
  color: #6b5d45;
  margin-bottom: 6px;
}
.summary2-year-summary {
  font-size: 0.87em;
  color: #5c4a2a;
  margin-bottom: 6px;
}
.summary2-year-events {
  padding-left: 18px;
  color: #6b5d45;
  font-size: 0.82em;
}
.summary2-year-events li {
  margin-bottom: 2px;
}
.summary2-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.summary2-panel {
  background: #fffdf8;
  border: 1px solid #d9ceb7;
  border-radius: 6px;
  padding: 10px 12px;
}
.summary2-panel h4 {
  margin-bottom: 6px;
  color: #5c4a2a;
}
.summary2-list {
  padding-left: 18px;
  color: #5c4a2a;
  font-size: 0.88em;
}
.summary2-list li {
  margin-bottom: 4px;
}
.summary2-review-list {
  background: #fffdf8;
  border: 1px solid #d9ceb7;
  border-radius: 6px;
  padding: 10px 12px;
}
.summary2-review-item {
  font-size: 0.9em;
  color: #5c4a2a;
  margin-bottom: 6px;
}
.summary2-review-item:last-child {
  margin-bottom: 0;
}
.summary2-review-role {
  font-weight: bold;
}
.summary2-village-table th,
.summary2-village-table td {
  font-size: 0.85em;
}
.summary2-neighbor-report-btn {
  display: inline-block !important;
  width: auto !important;
  padding: 4px 10px !important;
  font-size: 0.82em !important;
  white-space: nowrap;
}
@keyframes summaryIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Toast === */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.9em;
  animation: toast-in 0.3s ease-out, toast-out 0.3s ease-in 2.7s forwards;
  pointer-events: auto;
  max-width: 360px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.toast-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.toast-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.toast-info { background: #d6eaf8; color: #1a3a5c; border: 1px solid #b8daff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* === 师爷提示对话框 === */
.advisor-dialog-content {
  max-width: 420px;
  text-align: center;
  padding: 28px 24px 20px;
}
.advisor-dialog-icon {
  font-size: 2em;
  margin-bottom: 12px;
}
.advisor-dialog-text {
  font-size: 0.95em;
  color: #3d2b1a;
  line-height: 1.7;
  margin-bottom: 20px;
}
.advisor-dialog-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === 宗族举贤提示条 === */
.clan-youth-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: #f0f7ea;
  border: 1px solid #6b8f4a;
  border-radius: 6px;
  font-size: 0.9em;
  color: #3d5a27;
}
.clan-youth-notice.hidden { display: none !important; }
.clan-youth-notice-icon { font-size: 1.1em; flex-shrink: 0; }
.clan-youth-notice-text { flex: 1; }
.btn-clan-youth-goto {
  background: #6b8f4a;
  color: #fff;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-clan-youth-goto:hover { background: #527a35; }

/* === Negotiation Banner === */
.negotiation-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #fef9e7;
  border: 2px solid #d4a017;
  border-radius: 6px;
  animation: banner-pulse 2s ease-in-out infinite;
}
.negotiation-banner.hidden { display: none !important; }
.nego-banner-text {
  font-size: 0.95em;
  color: #5c4a2a;
}
@keyframes banner-pulse {
  0%, 100% { border-color: #d4a017; }
  50% { border-color: #c0392b; }
}

/* === Negotiation Modal === */
.nego-modal-content {
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.nego-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #d5ceb8;
}
.nego-header h4 {
  margin: 0;
  color: #5c4a2a;
}
.nego-subtitle {
  font-size: 0.85em;
  color: #8a7a5a;
}
.nego-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 250px;
  max-height: 400px;
  background: #f8f4ec;
}
.nego-msg {
  margin-bottom: 12px;
  max-width: 85%;
}
.nego-msg-player {
  margin-left: auto;
  text-align: right;
}
.nego-msg-agent {
  margin-right: auto;
}
.nego-msg-advisor {
  margin-right: auto;
  max-width: 90%;
}
.nego-msg-label {
  display: block;
  font-size: 0.75em;
  color: #8a7a5a;
  margin-bottom: 2px;
}
.nego-msg-content {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.93em;
  line-height: 1.5;
  text-align: left;
}
.nego-msg-player .nego-msg-content {
  background: #6b8f4a;
  color: #fff;
  border-bottom-right-radius: 2px;
}
.nego-msg-agent .nego-msg-content {
  background: #fffdf7;
  border: 1px solid #d5ceb8;
}
.nego-msg-advisor .nego-msg-content {
  background: #fdf6e0;
  border: 1px solid #c9a84c;
  color: #4a3410;
  font-style: italic;
  border-bottom-left-radius: 2px;
}
.nego-msg-advisor .nego-msg-label {
  color: #8b6400;
}
  color: #3a3428;
  border-bottom-left-radius: 2px;
}
.nego-msg-ts {
  display: block;
  font-size: 0.72em;
  color: #aaa;
  margin-top: 3px;
}
.nego-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid #d5ceb8;
}
.nego-speaker {
  flex: 0 0 120px;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.92em;
  background: #fffdf7;
  color: #3a3428;
}
.nego-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.95em;
  background: #fffdf7;
}
.nego-input:focus {
  outline: none;
  border-color: #6b8f4a;
}
.nego-resolved {
  padding: 16px 20px;
  text-align: center;
}
.nego-outcome {
  padding: 16px;
  background: #ede7d9;
  border-radius: 6px;
  font-size: 0.95em;
  color: #5c4a2a;
}
.nego-outcome strong { display: block; margin-bottom: 4px; }
.nego-summary {
  margin-top: 10px;
  padding: 10px 14px;
  background: #f8f4ec;
  border: 1px solid #d5ceb8;
  border-radius: 4px;
  font-size: 0.88em;
  text-align: left;
}
.ns-conclusion {
  font-weight: 600;
  color: #3a2e14;
  margin-bottom: 7px;
}
.ns-section {
  margin-bottom: 5px;
  color: #5c4a2a;
  line-height: 1.6;
}
.ns-label {
  font-weight: 600;
  margin-right: 4px;
}
.ns-item {
  display: inline-block;
  background: rgba(107,143,74,0.12);
  border: 1px solid rgba(107,143,74,0.3);
  border-radius: 3px;
  padding: 1px 6px;
  margin: 2px 3px 0 0;
  font-size: 0.95em;
}
.ns-item-npc {
  background: rgba(180,130,60,0.12);
  border-color: rgba(180,130,60,0.3);
}
.ns-key-moment {
  margin-top: 7px;
  color: #6b5d45;
  font-style: italic;
  border-top: 1px solid #e0d8c4;
  padding-top: 6px;
}
.nego-promise-hint {
  margin: 0 20px 8px;
  padding: 8px 12px;
  background: #fdf3d0;
  border-left: 3px solid #d4a017;
  border-radius: 4px;
  font-size: 0.85em;
  color: #6b4c0a;
}

/* === Irrigation Negotiate Section === */
#irrigation-negotiate-section {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #eaf4e0;
  border: 1px solid #b8d4a0;
  border-radius: 6px;
}
.irrigation-village-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-irrigation-nego {
  background: #6b8f4a;
  color: #fff;
  border-color: #5a7a3a;
}
.btn-irrigation-nego:hover { background: #5a7a3a; }

/* === Event Log (县志) === */
.events-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.events-controls select {
  padding: 6px 10px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #fffdf7;
  font-size: 0.9em;
}
.event-log-item {
  padding: 10px 14px;
  border: 1px solid #d5ceb8;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fffdf7;
}
.event-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.event-log-category {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.75em;
  color: #fff;
  font-weight: bold;
}
.event-log-season {
  font-size: 0.8em;
  color: #8a7a5a;
}
.event-log-desc {
  font-size: 0.9em;
  color: #3a3428;
  line-height: 1.5;
}
.event-log-settlement-details {
  margin-top: 8px;
  border-top: 1px dashed #d6ceb9;
  padding-top: 6px;
}
.event-log-settlement-details summary {
  cursor: pointer;
  font-size: 0.85em;
  color: #6b5d45;
  user-select: none;
}
.event-log-settlement-json {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  font-size: 0.8em;
  line-height: 1.4;
  white-space: pre;
  background: #f6f1e7;
  border: 1px solid #e0d7c3;
  border-radius: 4px;
  padding: 8px 10px;
  color: #4a4031;
}

/* === Promises === */
#promises-info {
  margin-bottom: 16px;
}
.promise-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.promise-item {
  padding: 10px 14px;
  border: 1px solid #d5ceb8;
  border-left: 3px solid #8e44ad;
  border-radius: 4px;
  background: #fffdf7;
  font-size: 0.9em;
}
.promise-item.promise-urgent {
  border-left-color: #c0392b;
  background: #fef9e7;
}
.promise-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.promise-type {
  font-weight: bold;
  color: #8e44ad;
}
.promise-deadline {
  font-size: 0.85em;
  color: #8a7a5a;
}
.promise-desc {
  color: #3a3428;
  margin-bottom: 2px;
}
.promise-agent {
  font-size: 0.8em;
  color: #8a7a5a;
}

/* === 社交 (Relationships) === */
#relationships-list {
  padding-bottom: 16px;
}
.social-section-hd {
  font-weight: bold;
  color: #5a3a10;
  font-size: 0.88em;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #d5ceb8;
  padding-bottom: 5px;
  margin-top: 14px;
  margin-bottom: 10px;
}
.social-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.relationship-card {
  padding: 12px 14px;
  border: 1px solid #d5ceb8;
  border-radius: 6px;
  background: #fffdf7;
  font-size: 0.9em;
}
.relationship-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 4px;
}
.relationship-name {
  font-weight: bold;
  color: #5c4a2a;
}
.relationship-role {
  font-size: 0.82em;
  color: #8a7a5a;
  text-align: right;
}
.rel-card-middle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.rel-action-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.affinity-bar {
  height: 8px;
  background: #ede7d9;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
}
.affinity-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.affinity-value {
  font-size: 0.85em;
  font-weight: bold;
  margin-bottom: 6px;
}
.affinity-low { color: #c0392b; }
.affinity-mid { color: #d4a017; }
.affinity-high { color: #27ae60; }
.memory-list {
  font-size: 0.8em;
  color: #8a7a5a;
  margin-top: 6px;
}
.memory-list-item {
  padding: 2px 0;
  border-top: 1px dashed #ede7d9;
}
.memory-list-item:first-child {
  border-top: none;
}

/* === Agent Link === */
.agent-link {
  color: #2e86c1;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9em;
}
.agent-link:hover {
  color: #1a5276;
}

/* === Agent Profile Modal === */
.agent-profile-content {
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.agent-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #d5ceb8;
}
.agent-profile-header h4 {
  margin: 0;
  color: #5c4a2a;
}
.agent-profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  max-height: 70vh;
}
.profile-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ede7d9;
}
.profile-section:last-child {
  border-bottom: none;
}
.profile-section h3 {
  font-size: 1.2em;
  color: #5c4a2a;
  margin-bottom: 4px;
}
.profile-section h4 {
  font-size: 0.95em;
  color: #5c4a2a;
  margin-bottom: 8px;
}
.profile-role {
  font-size: 0.9em;
  color: #8a7a5a;
  margin-bottom: 8px;
}
.profile-bio {
  font-size: 0.9em;
  line-height: 1.6;
  color: #3a3428;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.profile-stat {
  background: #f0ece2;
  border-radius: 4px;
  padding: 8px 10px;
  text-align: center;
}
.profile-stat-label {
  display: block;
  font-size: 0.8em;
  color: #8a7a5a;
  margin-bottom: 2px;
}
.profile-stat-value {
  display: block;
  font-size: 1.1em;
  font-weight: bold;
  color: #5c4a2a;
}
.profile-goals {
  list-style: disc;
  padding-left: 20px;
  font-size: 0.9em;
  color: #3a3428;
}
.profile-goals li {
  margin-bottom: 4px;
}
.profile-backstory {
  font-size: 0.9em;
  line-height: 1.6;
  color: #3a3428;
}
.profile-memory {
  font-size: 0.85em;
  color: #5c4a2a;
}
.profile-memory-item {
  padding: 4px 0;
  border-bottom: 1px dashed #ede7d9;
}
.profile-memory-item:last-child {
  border-bottom: none;
}
.profile-rels { font-size: 0.88em; }
.profile-rel-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed #ede7d9;
}
.profile-rel-item:last-child { border-bottom: none; }
.profile-rel-name { font-weight: 600; color: #3a3428; }
.profile-rel-role { color: #8a7a5a; }
.profile-rel-desc { color: #5c4a2a; flex: 1; }
.profile-chat-footer { text-align: center; border-bottom: none; }
.relationship-card { cursor: pointer; }
.relationship-card:hover { border-color: #a87a3a; background: #fffbf0; }
.social-sub-hd {
  font-size: 0.82em;
  color: #7a5a28;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  background: #f5efe0;
  border-radius: 3px;
  margin: 8px 0 6px 0;
}

/* === 社会身份标签 === */
.agent-identity-line {
  font-size: 0.78em;
  color: #8a7a5a;
  padding: 2px 0 4px 0;
  line-height: 1.4;
}
.hometown-badge {
  display: inline-block;
  font-size: 0.72em;
  background: #e8f4e8;
  color: #276627;
  border: 1px solid #b5d6b5;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

/* === 宗族概览 === */
.player-identity-line {
  font-size: 0.82em;
  color: #6a5a3a;
  background: #fdf8ee;
  border: 1px solid #e0d5b0;
  border-radius: 4px;
  padding: 5px 10px;
  margin-bottom: 10px;
}
#village-clan-section {
  margin-top: 20px;
}
.social-subtab-bar {
  display: flex;
  gap: 6px;
  padding: 8px 0 12px;
  border-bottom: 1px solid #d4c5a0;
  margin-bottom: 14px;
}
.social-subtab-btn {
  padding: 5px 14px;
  border: 1px solid #b8a070;
  border-radius: 4px;
  background: #f5ede0;
  color: #5a3a10;
  cursor: pointer;
  font-size: 0.88em;
}
.social-subtab-btn.active {
  background: #8b5e1a;
  color: #fff;
  border-color: #8b5e1a;
}

/* ── 承诺 Tab badge ── */
.promise-tab-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  border-radius: 8px;
  line-height: 16px;
  vertical-align: middle;
}

/* ── 承诺过滤器 ── */
.promise-filter-bar {
  display: flex;
  gap: 6px;
  padding: 10px 0 8px;
  flex-wrap: wrap;
}
.promise-filter-btn {
  padding: 3px 12px;
  border: 1px solid #c9a84c;
  border-radius: 12px;
  background: #fff;
  color: #6b5d45;
  font-size: 13px;
  cursor: pointer;
}
.promise-filter-btn.active {
  background: #8b5e1a;
  color: #fff;
  border-color: #8b5e1a;
}

/* ── 承诺卡片 ── */
.promise-card {
  display: flex;
  align-items: stretch;
  border: 1px solid #e0d5b0;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fdf9f0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}
.promise-card:hover { border-color: #a87a3a; background: #fffbf0; }
.promise-card-overdue { border-color: #c0392b; background: #fff5f5; }
.promise-card-bar { width: 5px; flex-shrink: 0; }
.promise-card-body { flex: 1; padding: 10px 12px; }
.promise-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.promise-type-tag {
  font-size: 12px;
  padding: 1px 7px;
  background: #e8dfc0;
  border-radius: 4px;
  color: #5a4a2a;
}
.promise-status-tag {
  font-size: 12px;
  font-weight: bold;
}
.promise-status-pending  { color: #c0a030; }
.promise-status-fulfilled { color: #27ae60; }
.promise-status-broken   { color: #c0392b; }
.promise-card-desc { font-size: 14px; color: #3a2e1a; margin-bottom: 6px; }
.promise-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #8a7a5a;
}
.promise-agent-focus-hd {
  font-size: 13px;
  color: #6b5d45;
  font-weight: bold;
  padding: 6px 0 10px;
  border-bottom: 1px solid #e0d5b0;
  margin-bottom: 10px;
}

/* ── 人物卡片内承诺 badge ── */
.promise-agent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 5px 8px;
  background: #fdf6e0;
  border: 1px solid #c9a84c;
  border-radius: 4px;
  font-size: 13px;
  color: #6b5d45;
}
.promise-agent-badge-icon { color: #c0a030; font-size: 14px; }
.btn-promise-view {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 12px;
}

/* ── 通用 modal-overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.modal-overlay.hidden { display: none !important; }
.modal-box {
  background: #fdf9f0;
  border: 1px solid #c9a84c;
  border-radius: 8px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.modal-box-sm { max-width: 420px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e0d5b0;
}
.modal-title { font-size: 15px; font-weight: bold; color: #5a3a0a; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #8a7a5a;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: #c0392b; }
.modal-body { padding: 14px 16px; }

/* ── 承诺详情 modal ── */
.promise-detail-status {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 12px;
}
.promise-detail-row {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #3a2e1a;
  margin-bottom: 8px;
  line-height: 1.5;
}
.pdl {
  min-width: 72px;
  color: #8a7a5a;
  flex-shrink: 0;
}

.clan-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.clan-card {
  background: #fdf9f0;
  border: 1px solid #d5c89a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85em;
}
.clan-card-tension {
  border-color: #d4a017;
  background: #fefbee;
}
.clan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.clan-name {
  font-weight: 700;
  color: #5a3e1b;
  font-size: 0.95em;
}
.clan-label {
  font-size: 0.8em;
  font-weight: 600;
}
.clan-affinity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.82em;
  color: #6a5a3a;
}
.clan-bar { flex: 1; height: 6px; }
.clan-detail-row {
  font-size: 0.78em;
  color: #7a6a4a;
  margin-bottom: 3px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.clan-detail-label {
  color: #8a7a5a;
  min-width: 56px;
  flex-shrink: 0;
}
.clan-none-hint {
  color: #aaa;
  font-style: italic;
}
.clan-official-tag {
  display: inline-block;
  background: #f0ece0;
  border: 1px solid #d4c9a8;
  border-radius: 3px;
  padding: 1px 5px;
  margin: 1px 2px 1px 0;
  font-size: 0.95em;
  color: #5a4a2a;
}
.clan-influence-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.82em;
  color: #6a5a3a;
}
.clan-influence-fill {
  background: #8b7355 !important;
}
.clan-warning {
  margin-top: 6px;
  font-size: 0.8em;
  color: #b44a00;
  background: #fff3e0;
  border-left: 3px solid #e67e22;
  padding: 3px 7px;
  border-radius: 2px;
}

/* === Village Deltas === */
.delta-positive { color: #27ae60; font-size: 0.8em; }
.delta-negative { color: #c0392b; font-size: 0.8em; }
.hint-text { color: #8a7a5a; font-size: 0.85em; }
.delta-neutral { color: #8a7a5a; font-size: 0.8em; }

/* === Staff (幕僚) Tab === */
.staff-section {
  margin-bottom: 20px;
}
.staff-section h3 {
  font-size: 1.1em;
  color: #5c4a2a;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d5ceb8;
}
.staff-card {
  padding: 14px 16px;
  border: 1px solid #d5ceb8;
  border-radius: 6px;
  background: #fffdf7;
}
.staff-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.staff-name {
  font-weight: bold;
  color: #5c4a2a;
  font-size: 1.05em;
}
.staff-role {
  font-size: 0.85em;
  color: #8a7a5a;
}
.staff-bio {
  font-size: 0.9em;
  color: #6b5d45;
  margin-bottom: 8px;
  line-height: 1.5;
}
.staff-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9em;
}
.staff-question-badge {
  background: #e8dcc8;
  padding: 2px 10px;
  border-radius: 10px;
  color: #5c4a2a;
  font-weight: 500;
}

.liufang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.liufang-card {
  padding: 10px 12px;
  border: 1px solid #d5ceb8;
  border-radius: 6px;
  background: #fffdf7;
}
.liufang-name {
  font-weight: bold;
  color: #5c4a2a;
  margin-bottom: 4px;
}
.liufang-desc {
  font-size: 0.82em;
  color: #8a7a5a;
  line-height: 1.4;
}

/* === Neighbors (邻县) === */
.neighbors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.neighbor-card {
  border: 1px solid #d5ceb8;
  border-radius: 6px;
  padding: 14px 16px;
  background: #fffdf7;
  cursor: pointer;
  transition: all 0.15s;
}
.neighbor-card:hover {
  border-color: #6b8f4a;
  background: #f5f8f0;
}
.neighbor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.neighbor-county-name {
  font-weight: bold;
  font-size: 1.05em;
  color: #5c4a2a;
}
.neighbor-type-tag {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 3px;
  background: #ede7d9;
  color: #8a7a5a;
}
.neighbor-governor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.neighbor-governor-name {
  font-size: 0.9em;
  color: #5c4a2a;
}
.neighbor-style-tag {
  display: inline-block;
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 3px;
  color: #fff;
  font-weight: bold;
}
.neighbor-archetype-tag {
  display: inline-block;
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 3px;
  color: #fff;
  font-weight: bold;
  margin-right: 4px;
  letter-spacing: 0.03em;
}
.neighbor-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85em;
  color: #5c4a2a;
  margin-bottom: 6px;
}
.neighbor-grain {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85em;
  color: #5c4a2a;
  margin-bottom: 6px;
  padding: 4px 0;
  border-top: 1px dashed #ede7d9;
}
.neighbor-analysis {
  font-size: 0.8em;
  color: #8a7a5a;
  font-style: italic;
  line-height: 1.4;
  border-top: 1px dashed #ede7d9;
  padding-top: 6px;
  margin-top: 4px;
}
.neighbor-analysis-label {
  font-style: normal;
  color: #c0702a;
  font-weight: 600;
  margin-right: 2px;
}
.neighbor-card-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.neighbor-events-btn {
  font-size: 0.78em;
  padding: 2px 8px;
  background: #f5f0e8;
  border: 1px solid #c8b89a;
  border-radius: 4px;
  color: #6b5d45;
  cursor: pointer;
}
.neighbor-events-btn:hover {
  background: #ede7d9;
  color: #3d2b1f;
}

/* === Prefecture Overview Card (本府概览) === */
.prefecture-overview-card {
  border: 2px solid #8a7a5a;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fdf9f0 0%, #f5efe0 100%);
}
.pref-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.pref-name {
  font-weight: bold;
  font-size: 1.15em;
  color: #3d2e10;
}
.pref-official {
  font-size: 0.9em;
  color: #5c4a2a;
}
.pref-affinity-tag {
  display: inline-block;
  font-size: 0.8em;
  padding: 2px 10px;
  border-radius: 3px;
  color: #fff;
  font-weight: bold;
}
.pref-inspect-badge {
  display: inline-block;
  font-size: 0.78em;
  padding: 2px 8px;
  border-radius: 3px;
  background: #c0702a;
  color: #fff;
  font-weight: bold;
  animation: pulse-warn 1.5s infinite;
}
@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.pref-quota-bar-wrap {
  height: 6px;
  background: #ede7d9;
  border-radius: 3px;
  margin-bottom: 4px;
  overflow: hidden;
}
.pref-quota-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s;
}
.pref-quota-text {
  font-size: 0.85em;
  color: #5c4a2a;
  margin-bottom: 8px;
}
.pref-directive {
  font-size: 0.88em;
  color: #3d2e10;
  background: #ede7d9;
  border-left: 3px solid #8a7a5a;
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 8px;
}
.pref-directive-type {
  font-weight: bold;
  color: #2e86c1;
}
.pref-gazette-btn {
  font-size: 0.85em;
  padding: 4px 14px;
  background: #8a7a5a;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.pref-gazette-btn:hover {
  background: #6b5d45;
}
.prefecture-gazette-content {
  width: 660px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* === Neighbor Detail Modal === */
.neighbor-detail-content {
  width: 600px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.neighbor-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #d5ceb8;
}
.neighbor-detail-header h4 {
  margin: 0;
  color: #5c4a2a;
  font-size: 1.1em;
}
.neighbor-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  max-height: 70vh;
}
.nd-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ede7d9;
}
.nd-section:last-child {
  border-bottom: none;
}
.nd-section h4 {
  font-size: 0.95em;
  color: #5c4a2a;
  margin-bottom: 8px;
}
.nd-governor-card {
  padding: 10px 14px;
  background: #f0ece2;
  border-radius: 6px;
  font-size: 0.9em;
  line-height: 1.6;
}
.nd-governor-card p {
  margin-top: 6px;
  color: #3a3428;
}
.nd-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.nd-stat {
  background: #f0ece2;
  border-radius: 4px;
  padding: 6px 8px;
  text-align: center;
}
.nd-stat-label {
  display: block;
  font-size: 0.75em;
  color: #8a7a5a;
}
.nd-stat-value {
  display: block;
  font-size: 0.95em;
  font-weight: bold;
  color: #5c4a2a;
}
.nd-market {
  font-size: 0.9em;
  color: #5c4a2a;
  padding: 4px 0;
}
.nd-reasoning {
  font-size: 0.9em;
  color: #3a3428;
  line-height: 1.6;
  padding: 10px 14px;
  background: #f8f4ec;
  border-radius: 6px;
  white-space: pre-wrap;
}
.nd-admin-details summary {
  cursor: pointer;
  font-size: 0.88em;
  color: #5c4a2a;
  user-select: none;
}
.nd-admin-list {
  margin-top: 8px;
  border: 1px solid #e0d7c3;
  border-radius: 4px;
  background: #f8f4ec;
  padding: 6px 10px;
}
.nd-admin-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86em;
  color: #4a4031;
  padding: 4px 0;
  border-bottom: 1px dashed #e7ddc8;
}
.nd-admin-row:last-child {
  border-bottom: none;
}
.nd-admin-total {
  margin-top: 2px;
}

/* === 统一县详情双标签卡片 (County Detail Card) === */
.cdc-modal-content {
  display: flex;
  flex-direction: column;
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  padding: 0;
  overflow: hidden;
}
.cdc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 10px;
  border-bottom: 1px solid #d5ceb8;
  flex-shrink: 0;
}
.cdc-header h4 {
  margin: 0;
  color: #5c4a2a;
  font-size: 1.1em;
}
/* Tab nav */
.cdc-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #d5ceb8;
  flex-shrink: 0;
  background: #faf6ee;
}
.cdc-tab-btn {
  padding: 8px 24px;
  border: none;
  background: transparent;
  color: #8a7a5a;
  font-size: 0.92em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.cdc-tab-btn:hover { color: #5c4a2a; }
.cdc-tab-btn.active {
  color: #5c4a2a;
  font-weight: bold;
  border-bottom-color: #6b8f4a;
}
/* Tab content */
.cdc-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.cdc-tab-content.hidden { display: none; }
/* Sections */
.cdc-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ede7d9;
}
.cdc-section:last-child { border-bottom: none; }
.cdc-section-title {
  font-size: 0.9em;
  font-weight: bold;
  color: #5c4a2a;
  margin-bottom: 8px;
  text-transform: none;
}
.cdc-report-month {
  font-weight: normal;
  font-size: 0.88em;
  color: #8a7a5a;
  margin-left: 6px;
}
/* Governor */
.cdc-governor-section { background: #f5f0e6; border-radius: 6px; padding: 10px 14px; }
.cdc-governor-section.cdc-section { margin-bottom: 14px; }
.cdc-governor-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.cdc-gov-name { font-weight: bold; color: #3a3428; font-size: 0.95em; }
.cdc-arch-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8em;
  color: #fff;
  font-weight: bold;
}
.cdc-style-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8em;
  color: #fff;
}
.cdc-gov-bio {
  font-size: 0.85em;
  color: #6b5d45;
  line-height: 1.5;
  margin-top: 4px;
}
/* Indicators grid */
.cdc-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}
.cdc-stat {
  background: #f0ece2;
  border-radius: 4px;
  padding: 6px 8px;
  text-align: center;
}
.cdc-stat-label {
  display: block;
  font-size: 0.75em;
  color: #8a7a5a;
  margin-bottom: 3px;
}
.cdc-stat-value {
  display: block;
  font-size: 0.9em;
  font-weight: bold;
  color: #5c4a2a;
}
.cdc-tier-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.8em;
  color: #fff;
  font-weight: bold;
  vertical-align: middle;
}
/* Infra grid */
.cdc-infra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.cdc-infra-item {
  background: #f5f0e6;
  border-radius: 4px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.cdc-infra-label { font-size: 0.75em; color: #8a7a5a; }
.cdc-infra-val { font-size: 0.88em; font-weight: bold; color: #4a3a2a; }
.cdc-granary-yes { color: #2e7d32; }
.cdc-granary-no  { color: #c62828; }
.cdc-investments {
  font-size: 0.85em;
  color: #5c4a2a;
  margin-top: 6px;
}
.cdc-investments-label { font-weight: bold; }
/* Villages / data tables */
.cdc-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.cdc-data-table th, .cdc-data-table td {
  padding: 5px 8px;
  border: 1px solid #e0d8c8;
  text-align: left;
}
.cdc-data-table thead th { background: #f0ece2; color: #5c4a2a; font-weight: bold; }
.cdc-data-table tbody tr:hover { background: #faf6ee; }
/* Judicial section inside county-detail modal */
.cdc-judicial-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cdc-judicial-subtitle { font-size: 0.85em; color: #8a7a5a; margin: 6px 0 4px; }
/* Markets */
.cdc-market-row {
  font-size: 0.9em;
  color: #5c4a2a;
  padding: 4px 0;
  border-bottom: 1px dashed #e7ddc8;
}
.cdc-market-row:last-child { border-bottom: none; }
/* Admin cost */
.cdc-admin-details summary {
  cursor: pointer;
  font-size: 0.88em;
  color: #5c4a2a;
  user-select: none;
}
.cdc-admin-list {
  margin-top: 8px;
  border: 1px solid #e0d7c3;
  border-radius: 4px;
  background: #f8f4ec;
  padding: 6px 10px;
}
.cdc-admin-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86em;
  color: #4a4031;
  padding: 4px 0;
  border-bottom: 1px dashed #e7ddc8;
}
.cdc-admin-row:last-child { border-bottom: none; }
.cdc-admin-total { margin-top: 2px; }
/* Analysis */
.cdc-analysis-text {
  font-size: 0.88em;
  color: #3a3428;
  line-height: 1.6;
  padding: 10px 14px;
  background: #f8f4ec;
  border-radius: 6px;
  white-space: pre-wrap;
}
/* Report history table */
.cdc-report-table-wrap { overflow-x: auto; }
.cdc-report-table { min-width: 500px; }
.cdc-report-month-cell { white-space: nowrap; font-size: 0.82em; color: #6b5d45; }
/* Quota */
.cdc-quota-text { font-size: 0.9em; color: #4a3a2a; margin: 0; }
/* Action buttons */
.cdc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e0d7c3;
}
/* Gazette tab */
.cdc-gazette-list { display: flex; flex-direction: column; gap: 10px; }
.cdc-gazette-report-entry {
  background: #f8f4ec;
  border-radius: 6px;
  padding: 10px 14px;
  border: 1px solid #e8dfc8;
}
.cdc-gazette-inds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}
.cdc-gazette-ind {
  font-size: 0.82em;
  color: #5c4a2a;
  display: flex;
  align-items: center;
  gap: 2px;
}
.cdc-gazette-report-text {
  font-size: 0.85em;
  color: #4a3a2a;
  line-height: 1.5;
  margin-top: 4px;
}
.cdc-gazette-notes { color: #8a4a2a; font-style: italic; }

/* === Officialdom (官场) === */
.officialdom-section {
  margin-bottom: 24px;
}
.officialdom-section .section-title {
  font-size: 1.1em;
  color: #5c4a2a;
  border-bottom: 2px solid #c9b99a;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

/* Monarch */
.monarch-section { text-align: center; }
.monarch-card {
  background: linear-gradient(135deg, #fff8e7, #f5ecd7);
  border: 2px solid #d4a840;
  border-radius: 10px;
  padding: 20px;
  max-width: 420px;
  margin: 0 auto;
}
.monarch-badge {
  display: inline-block;
  background: #8b4513;
  color: #fff;
  padding: 2px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  margin-bottom: 8px;
}
.monarch-name { font-size: 1.5em; color: #5c4a2a; margin: 4px 0; }
.monarch-title { color: #8b7355; font-size: 0.95em; margin-bottom: 8px; }
.monarch-style { color: #6b5b3e; font-size: 0.9em; margin-bottom: 12px; }
.monarch-stats { text-align: left; }
.attr-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.attr-label { width: 72px; font-size: 0.85em; color: #6b5b3e; text-align: right; }
.attr-bar { flex: 1; height: 8px; background: #e8dcc8; border-radius: 4px; overflow: hidden; }
.attr-fill { height: 100%; background: #8b4513; border-radius: 4px; transition: width 0.3s; }
.attr-val { width: 36px; font-size: 0.8em; color: #8b7355; text-align: right; }

/* Official cards */
.official-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.official-card {
  background: #fff;
  border: 1px solid #d4c9a8;
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 140px;
  position: relative;
}
.official-card .card-title { font-size: 0.8em; color: #8b7355; }
.official-card .card-name { font-size: 1em; font-weight: 600; color: #3a3428; margin: 2px 0; }
.rank-badge {
  display: inline-block;
  background: #e8dcc8;
  color: #5c4a2a;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.75em;
  margin-right: 4px;
}
.faction-tag {
  display: inline-block;
  font-size: 0.75em;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f0ebe0;
  color: #6b5b3e;
}

/* Faction colors */
.faction-0 { border-left: 3px solid #c04040; }
.faction-1 { border-left: 3px solid #3070b0; }
.faction-2 { border-left: 3px solid #409040; }
.faction-3 { border-left: 3px solid #9060a0; }
.official-card.faction-0 .faction-tag { background: #fde8e8; color: #a03030; }
.official-card.faction-1 .faction-tag { background: #e0ecf8; color: #2060a0; }
.official-card.faction-2 .faction-tag { background: #e0f0e0; color: #307030; }
.official-card.faction-3 .faction-tag { background: #f0e8f4; color: #705080; }

/* Ministries grid */
.ministries-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.ministry-group {
  background: #faf6ee;
  border: 1px solid #e0d8c0;
  border-radius: 8px;
  padding: 10px;
}
.ministry-name {
  font-size: 0.95em;
  color: #5c4a2a;
  margin-bottom: 8px;
  text-align: center;
}
.ministry-group .official-card { min-width: auto; width: 100%; margin-bottom: 6px; }
.shilang-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid #e0d8c0;
}
.shilang-group .official-card { min-width: auto; flex: 1; margin-bottom: 0; }

/* Compact official card (for 侍郎/监察御史 etc.) */
.official-card-compact {
  padding: 6px 10px;
  min-width: 100px;
}
.official-card-compact .card-title { font-size: 0.75em; }
.official-card-compact .card-name { font-size: 0.9em; }

/* Censorate tree */
.censorate-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.censors-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Commissioners row */
.commissioners-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Chain arrow */
.chain-arrow { color: #8b7355; font-size: 1.2em; text-align: center; }

/* Player card */
.player-card {
  background: #eef3ff !important;
  border-color: #6080c0 !important;
  text-align: center;
}
.player-card .card-title { color: #4060a0; font-weight: 600; }

/* Province count in section title */
.province-count { font-size: 0.8em; color: #8b7355; font-weight: normal; }

/* Province collapsible blocks */
.province-block {
  border: 1px solid #e0d8c0;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.province-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #faf6ee;
  cursor: pointer;
  user-select: none;
}
.province-header:hover { background: #f5eed8; }
.province-toggle {
  font-size: 0.8em;
  color: #8b7355;
  transition: transform 0.2s;
  display: inline-block;
}
.province-expanded .province-toggle { transform: rotate(90deg); }
.province-name { color: #5c4a2a; font-size: 1em; }
.province-meta { font-size: 0.85em; color: #8b7355; margin-left: auto; }
.player-province-badge {
  display: inline-block;
  background: #4060a0;
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.75em;
  margin-left: 6px;
}
.province-body {
  display: none;
  padding: 12px 14px;
}
.province-expanded .province-body { display: block; }

/* Province sub-levels */
.prov-level { margin-bottom: 4px; }
.prov-governor { text-align: center; }
.commissioners-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.prefects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.prefects-grid .official-card-compact {
  min-width: 110px;
  flex: 0 0 auto;
}

/* Factions */
.faction-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.faction-card {
  background: #fff;
  border: 1px solid #d4c9a8;
  border-radius: 8px;
  padding: 12px;
  min-width: 220px;
  flex: 1;
}
.faction-card.faction-0 { border-top: 3px solid #c04040; }
.faction-card.faction-1 { border-top: 3px solid #3070b0; }
.faction-card.faction-2 { border-top: 3px solid #409040; }
.faction-card.faction-3 { border-top: 3px solid #9060a0; }
.faction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.faction-favor { font-size: 0.85em; color: #8b7355; }
.faction-favor-bar {
  height: 6px; background: #e8dcc8; border-radius: 3px;
  overflow: hidden; margin-bottom: 6px;
}
.favor-fill { height: 100%; background: #d4a840; border-radius: 3px; }
.faction-meta { font-size: 0.85em; color: #6b5b3e; margin-bottom: 4px; }
.faction-desc { font-size: 0.85em; color: #8b7355; line-height: 1.4; }

/* === Responsive === */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .invest-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary2-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .summary2-year-wrap { grid-template-columns: 1fr; }
  .summary2-panel-grid { grid-template-columns: 1fr; }
  .background-choices { flex-direction: column; }
  .county-type-choices { flex-direction: column; }
  .new-game-actions { flex-direction: column; align-items: flex-start; }
  .liufang-grid { grid-template-columns: repeat(2, 1fr); }
  .ministries-grid { grid-template-columns: repeat(2, 1fr); }
  .pref-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .pref-mini-cards { grid-template-columns: 1fr; }
  .pref-todo-item { flex-direction: column; align-items: flex-start; }
  .pref-detail-grid { grid-template-columns: repeat(2, 1fr); }
  .pref-counties-table { font-size: 0.8em; }
}

/* ==================== Prefecture (知府) Styles ==================== */

/* Role selector */
.role-choices {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.btn-role {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 18px;
  min-width: 130px;
}
.btn-role.btn-role-disabled {
  background: #e6e0d6;
  border-color: #c8bba7;
  color: #7e7365;
  cursor: not-allowed;
  opacity: 1;
}
.btn-role.btn-role-disabled:hover {
  transform: none;
  box-shadow: none;
}
.btn-role.btn-role-disabled strong,
.btn-role.btn-role-disabled span {
  color: #7e7365;
}
.btn-role strong { font-size: 1em; }
.btn-role span { font-size: 0.8em; color: #8a7a5a; margin-top: 2px; }

/* Game card role badge */
.game-card-role-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: #5a3e8a;
  color: #fff;
  font-size: 0.75em;
  margin-right: 6px;
  vertical-align: middle;
}
.game-card-role-county { background: #4a7a3a; }

/* Prefecture header */
.pref-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: #5a3e8a;
  color: #fff;
  font-size: 0.85em;
  margin-right: 10px;
}

/* Calendar strip */
/* Calendar + advance button row */
.pref-cal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd5c3;
  margin-bottom: 12px;
}
#pref-calendar-strip { flex: 1; min-width: 0; }
.pref-cal-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  align-items: center;
}

.pref-calendar {
  display: flex;
  gap: 4px;
  padding: 4px 0;
  overflow-x: auto;
}
.pref-cal-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  padding: 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 0.8em;
  color: #8a7a5a;
}
.pref-cal-month.pref-cal-current {
  background: #f0e8d0;
  border-color: #c8b98a;
  color: #3a3428;
  font-weight: 600;
}
.pref-cal-name { font-size: 0.9em; }
.pref-cal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 3px;
}
.pref-cal-report { background: #6b8f4a; }
.pref-cal-label {
  font-size: 0.75em;
  color: #7a5a2a;
  margin-top: 2px;
}

/* Section titles */
.pref-section-title {
  font-size: 0.85em;
  font-weight: 700;
  color: #5c4a2a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e0d5c0;
}

/* Quota progress bar */
#pref-quota-progress {
  background: #fffdf7;
  border: 1px solid #ddd5c3;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.pref-quota-bar-wrap {
  background: #e8e0d0;
  border-radius: 4px;
  height: 10px;
  margin: 6px 0;
  overflow: hidden;
}
.pref-quota-bar {
  height: 100%;
  background: #6b8f4a;
  border-radius: 4px;
  transition: width 0.3s;
}
.pref-quota-text { font-size: 0.85em; color: #6a5a3a; }

/* Key metrics */
#pref-key-metrics {
  background: #fffdf7;
  border: 1px solid #ddd5c3;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.pref-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.pref-metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  background: #f5f0e8;
  border-radius: 4px;
}
.pref-metric-label { font-size: 0.75em; color: #8a7a5a; }
.pref-metric-val { font-size: 1.1em; font-weight: 700; color: #3a3428; margin-top: 2px; }
.pref-alert {
  padding: 6px 10px;
  border-radius: 4px;
  background: #fff3cd;
  border: 1px solid #f9a825;
  margin-top: 6px;
  font-size: 0.85em;
}
.pref-alert-info { background: #e3f2fd; border-color: #1565c0; }

#pref-todo-list {
  background: #fffdf7;
  border: 1px solid #ddd5c3;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.pref-todo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pref-todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2d8c4;
  border-left-width: 4px;
  border-radius: 6px;
  background: #fcf8ef;
}
.pref-todo-item.severity-high { border-left-color: #c62828; }
.pref-todo-item.severity-medium { border-left-color: #ef6c00; }
.pref-todo-item.severity-low { border-left-color: #1565c0; }
.pref-todo-main {
  min-width: 0;
  flex: 1;
}
.pref-todo-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.94em;
  font-weight: 700;
  color: #3f3422;
}
.pref-todo-icon {
  font-size: 1.05em;
  line-height: 1;
}
.pref-todo-detail {
  margin-top: 4px;
  font-size: 0.82em;
  color: #6a5a3a;
  line-height: 1.5;
}
.pref-todo-action {
  flex-shrink: 0;
}
.pref-todo-status {
  flex-shrink: 0;
  font-size: 0.8em;
  color: #8a7a5a;
}
.pref-empty-state {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7f1e4;
  color: #7a6a50;
  font-size: 0.86em;
}

/* Mini county cards */
.pref-mini-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.pref-mini-card {
  background: #fffdf7;
  border: 1px solid #ddd5c3;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.pref-mini-card:hover { background: #f5f0e8; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.pref-mini-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.pref-mini-county-name { font-weight: 700; font-size: 0.95em; }
.pref-mini-gov { font-size: 0.82em; color: #6a5a3a; margin-bottom: 6px; }
.pref-style-tag {
  display: inline-block;
  padding: 1px 5px;
  background: #e8e0d0;
  border-radius: 3px;
  font-size: 0.75em;
  color: #6a5a3a;
}
.pref-mini-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}
.pref-mini-tier-item { font-size: 0.75em; color: #5a4a3a; }
.pref-mini-footer { font-size: 0.72em; color: #aaa; margin-top: 4px; }

/* Tier & arch badges */
.pref-tier-badge {
  display: inline-block;
  border-radius: 3px;
  color: #fff;
  font-weight: 700;
  vertical-align: middle;
}
.pref-arch-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  color: #fff;
  font-size: 0.75em;
  font-weight: 600;
}

/* Full county table */
.pref-counties-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.pref-counties-table th {
  padding: 6px 8px;
  background: #f0e8d0;
  border-bottom: 2px solid #c8b98a;
  text-align: left;
  white-space: nowrap;
}
.pref-counties-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e8e0d0;
  vertical-align: middle;
}
.pref-county-row:hover td { background: #faf7f0; }
.pref-report-time { margin-top: 6px; }
/* Judicial health badges — counties table and county detail */
.jud-stats-cell { white-space: nowrap; }
.jud-resolved { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 0.82em; background: #d4edda; color: #155724; margin-right: 2px; }
.jud-deferred { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 0.82em; background: #fff3cd; color: #856404; margin-right: 2px; }
.jud-pending  { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 0.82em; background: #f8d7da; color: #721c24; margin-right: 2px; }

/* County detail modal */
.pref-county-modal-content {
  max-width: 680px;
  max-height: 80vh;
  overflow-y: auto;
}
.pref-county-modal-body { padding: 8px 0; }
.pref-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0d5c0;
}
.pref-modal-governor { margin-bottom: 12px; }
.pref-gov-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.pref-gov-header h3 { margin: 0; font-size: 1.1em; }
.pref-gov-name { font-size: 0.9em; color: #5a4a3a; margin-bottom: 4px; }
.pref-gov-bio { font-size: 0.82em; color: #8a7a5a; line-height: 1.5; margin-bottom: 6px; }
.pref-gov-quota { font-size: 0.85em; color: #4a3a2a; }
.pref-modal-section { margin-bottom: 14px; }
.pref-infra-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.pref-infra-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fdf8f0;
  border: 1px solid #d4c4a0;
  border-radius: 5px;
  padding: 5px 4px;
  font-size: 0.82em;
}
.pref-infra-stat-label { color: #8a7a5a; margin-bottom: 2px; }
.pref-infra-stat-val { font-weight: 600; color: #3a2a1a; }
.pref-granary-yes { color: #2e7d32; }
.pref-granary-no  { color: #b71c1c; }
.pref-infra-building-label { font-size: 0.83em; color: #5a4a3a; margin-top: 8px; margin-bottom: 3px; }
.pref-infra-building-list {
  margin: 0;
  padding-left: 16px;
  font-size: 0.82em;
  color: #6b5d45;
  line-height: 1.6;
}
.pref-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.pref-detail-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
}
.pref-detail-label { color: #8a7a5a; min-width: 48px; }
.pref-report-actions, .pref-report-notes {
  font-size: 0.82em;
  color: #5a4a3a;
  margin-top: 6px;
  line-height: 1.5;
}
.pref-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8em;
}
.pref-history-table th, .pref-history-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #e8e0d0;
  text-align: center;
}
.pref-history-table th { background: #f5f0e8; }
.pref-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e0d5c0;
}
.pref-inspect-result {
  margin-top: 12px;
  padding: 10px;
  background: #f0f8e8;
  border: 1px solid #6b8f4a;
  border-radius: 4px;
}
.pref-inspect-header {
  font-weight: 700;
  color: #3a6a2a;
  margin-bottom: 8px;
  font-size: 0.9em;
}
.pref-inspect-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pref-inspect-item {
  display: flex;
  flex-direction: column;
  font-size: 0.82em;
}
.pref-inspect-item span { color: #6a7a5a; }
.pref-inspect-item strong { color: #2a4a2a; font-size: 1.05em; }
.pref-inspect-county-block { margin-bottom: 10px; }
.pref-inspect-county-block:not(:last-child) { padding-bottom: 10px; border-bottom: 1px dashed #c8b98a; }
.pref-inspect-road-notice {
  font-size: 0.82em;
  color: #5a7a3a;
  background: #f0f7e8;
  border: 1px solid #b8d4a0;
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 8px;
}

/* Quota modal */
.pref-quota-modal-content { max-width: 560px; }
.pref-quota-header { margin-bottom: 10px; font-size: 0.9em; color: #4a3a2a; }
.pref-quota-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin-bottom: 8px;
}
.pref-quota-table th {
  padding: 5px 8px;
  background: #f0e8d0;
  border-bottom: 2px solid #c8b98a;
  text-align: left;
}
.pref-quota-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #e8e0d0;
}
.pref-quota-input {
  width: 100px;
  padding: 4px 6px;
  border: 1px solid #c8b98a;
  border-radius: 3px;
  font-size: 0.9em;
}
.pref-quota-total { font-size: 0.85em; color: #5a4a3a; padding: 6px 0; }


/* Prefecture report */
.pref-report-header {
  font-size: 1.05em;
  font-weight: 700;
  color: #3a3428;
  margin-bottom: 10px;
}
.pref-report-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #e8e0d0;
  font-size: 0.9em;
}
.pref-report-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #e8f5e9;
  border-left: 3px solid #6b8f4a;
  border-radius: 0 4px 4px 0;
  font-size: 0.85em;
  color: #2a4a2a;
}
.pref-note-exam { background: #e3f2fd; border-color: #1565c0; color: #0a3a6a; }
.pref-note-review { background: #fff3e0; border-color: #fb8c00; color: #5a3a0a; }
.pref-note-build { background: #e8f5e9; border-color: #2e7d32; color: #1a4a1a; }
.pref-exam-detail-link { color: inherit; font-weight: 600; }

/* ── 基础建设 Tab ── */
.pref-infra-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.pref-infra-card {
  background: #fdf8f0;
  border: 1px solid #d4c4a0;
  border-radius: 6px;
  padding: 12px;
}
.pref-infra-card.maxed { border-color: #2e7d32; background: #f1f8f1; }
.pref-infra-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.pref-infra-icon { font-size: 1.3em; }
.pref-infra-label { font-weight: 700; flex: 1; }
.pref-infra-level { font-size: 0.8em; color: #8a7a5a; }
.pref-infra-pips {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.pref-infra-pip {
  width: 20px;
  height: 6px;
  border-radius: 3px;
  background: #d4c4a0;
}
.pref-infra-pip.filled { background: #6b8f4a; }
.pref-infra-cost { font-size: 0.82em; color: #6a5a3a; margin-bottom: 6px; }
.pref-infra-btn { margin-top: 4px; }
.pref-infra-status { font-size: 0.82em; padding: 4px 0; }
.pref-infra-status.building { color: #1565c0; }
.pref-infra-status.maxed-label { color: #2e7d32; font-weight: 600; }
.pref-judicial-meta {
  margin: 6px 0 12px;
  font-size: 0.84em;
  color: #6a5a3a;
}

/* ── 科举人才 Tab ── */
.pref-talent-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  padding: 10px;
  background: #fdf8f0;
  border: 1px solid #d4c4a0;
  border-radius: 6px;
}
.pref-talent-stat { text-align: center; }
.pref-talent-stat span { display: block; font-size: 0.78em; color: #8a7a5a; }
.pref-talent-stat strong { font-size: 1.2em; color: #3a3428; }
.pref-talent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  margin-top: 6px;
}
.pref-talent-table th, .pref-talent-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #e8dfc8;
  text-align: left;
}
.pref-talent-table th { background: #f5f0e8; font-weight: 600; }
.pref-exam-record {
  border: 1px solid #c8d4f0;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f0f4fc;
}
.pref-exam-record-header { font-weight: 700; margin-bottom: 6px; color: #1a3a6a; }
.pref-exam-counties { margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.pref-exam-county-tag {
  font-size: 0.78em;
  background: #dce8f8;
  border-radius: 10px;
  padding: 2px 8px;
  color: #1a3a6a;
}
.pref-exam-top-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}
.pref-exam-top-table th, .pref-exam-top-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #c8d4f0;
  text-align: left;
}
.pref-exam-top-table th { background: #dce8f8; }

/* Precompute status — slim bar below game header */
.precompute-status-inline {
  font-size: 0.8em;
  color: #7a6a50;
}
.header-precompute {
  margin: -8px 0 6px;
  padding: 0 2px;
  min-height: 0;
}

/* Quota area — progress bar + optional 正月 button */
#pref-quota-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
#pref-quota-progress { flex: 1; margin-bottom: 0; }

/* Advance result modal */
.advance-result-content {
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
}
.advance-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0d0b0;
}
.advance-modal-header h4 {
  font-size: 1.1em;
  color: #5c3a10;
  margin: 0;
}
.advance-result-body {
  font-size: 0.92em;
  line-height: 1.7;
  max-height: 55vh;
  overflow-y: auto;
}
.advance-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #e0d0b0;
}

/* 府学 才池 / 府试 折叠区 */
.pref-school-extra {
  margin-top: 10px;
  border-top: 1px solid #e0d5c0;
  padding-top: 8px;
}
.pref-school-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  margin-top: 4px;
  background: #f5efe0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82em;
  color: #5c4a2a;
  user-select: none;
}
.pref-school-toggle:hover { background: #ede5d0; }
.pref-school-toggle-exam { background: #eef3e8; }
.pref-school-toggle-exam:hover { background: #e4edda; }
.pref-school-arrow {
  font-size: 0.7em;
  color: #8a7a5a;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.pref-school-body {
  padding: 6px 4px 2px;
  font-size: 0.82em;
}

/* Monthly log entries (县志 / 府志) */
.monthly-log-entry {
  border: 1px solid #ddd0b0;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fffef8;
  overflow: hidden;
}
.monthly-log-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  background: #f5efe0;
  user-select: none;
}
.monthly-log-toggle:hover { background: #ede5d0; }
.monthly-log-title {
  font-size: 0.88em;
  font-weight: 600;
  color: #5c4a2a;
}
.monthly-log-arrow {
  font-size: 0.75em;
  color: #8a7a5a;
  transition: transform 0.2s;
}
.monthly-log-entry.expanded .monthly-log-arrow {
  transform: rotate(90deg);
}
.monthly-log-body {
  display: none;
  padding: 10px 14px;
  font-size: 0.88em;
  border-top: 1px solid #e8dcc8;
}
.monthly-log-entry.expanded .monthly-log-body {
  display: block;
}

/* ==================== 司法卷宗弹窗 ==================== */
.judicial-modal-content {
  max-width: 680px;
  width: 95%;
  max-height: 88vh;
  overflow-y: auto;
  background: #fdf8ee;
  border: 2px solid #8b6914;
  border-radius: 6px;
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.judicial-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #c8b98a;
  padding-bottom: 10px;
}
.judicial-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.judicial-modal-header h4 {
  margin: 0;
  font-size: 1.05em;
  color: #4a3210;
}
.judicial-counter {
  font-size: 0.85em;
  color: #8b6914;
  font-weight: 600;
}
.judicial-badge {
  display: inline-block;
  font-size: 0.78em;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.judicial-badge.difficulty-easy   { background: #d4edda; color: #155724; }
.judicial-badge.difficulty-medium { background: #fff3cd; color: #856404; }
.judicial-badge.difficulty-hard   { background: #f8d7da; color: #721c24; }

/* 卷宗正文区 */
.judicial-modal-body { flex: 1; }
.judicial-case-wrap { display: flex; flex-direction: column; gap: 10px; }
.judicial-case-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85em;
  color: #6b5230;
}
.judicial-meta-item { }
.judicial-dossier {
  background: #fef9f0;
  border: 1px solid #d4b97a;
  border-radius: 4px;
  padding: 12px 14px;
}
.judicial-dossier-label {
  font-size: 0.8em;
  color: #8b6914;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.judicial-dossier-text {
  margin: 0;
  line-height: 1.75;
  color: #3a2a10;
  font-size: 0.93em;
}
.judicial-attachments {
  font-size: 0.82em;
  color: #6b5230;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.judicial-attach-label { font-weight: 600; }
.judicial-attach-item {
  background: #ede5d0;
  border-radius: 3px;
  padding: 1px 7px;
}
.judicial-suspicion {
  border-left: 3px solid #c0392b;
  padding-left: 12px;
}
.judicial-suspicion-label {
  font-size: 0.82em;
  font-weight: 700;
  color: #c0392b;
  margin-bottom: 4px;
}
.judicial-suspicion-list {
  margin: 4px 0;
  padding-left: 4px;
  list-style: none;
}
.judicial-suspicion-list.critical li { color: #8b1a1a; font-size: 0.88em; margin-bottom: 4px; }
.judicial-suspicion-list.secondary li { color: #6b5230; font-size: 0.85em; margin-bottom: 3px; }

/* 决策按钮 */
.judicial-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 4px;
}
.btn-judicial {
  padding: 8px 18px;
  border: 1.5px solid #8b6914;
  background: #fdf8ee;
  color: #4a3210;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.92em;
  transition: background 0.15s;
}
.btn-judicial:hover { background: #ede5d0; }
.btn-judicial-primary {
  background: #8b4513;
  color: #fff;
  border-color: #6a340f;
}
.btn-judicial-primary:hover { background: #6a340f; }
.btn-judicial:disabled { opacity: 0.5; cursor: not-allowed; }

/* 决策结果区 */
.judicial-result-area {
  border-top: 1px solid #c8b98a;
  padding-top: 10px;
}
.judicial-result-wrap { display: flex; flex-direction: column; gap: 6px; }
.judicial-result-action {
  font-weight: 700;
  color: #4a3210;
  font-size: 0.95em;
}
.judicial-result-effects {
  font-size: 0.9em;
  color: #2c6e3a;
  font-weight: 600;
}
.judicial-chain-label {
  font-size: 0.83em;
  font-weight: 600;
  color: #6b5230;
  margin-top: 4px;
}
.judicial-chain-list {
  margin: 2px 0;
  padding-left: 16px;
  font-size: 0.85em;
  color: #5a4520;
  line-height: 1.6;
}
.judicial-result-treasury {
  font-size: 0.85em;
  color: #8b6914;
  font-weight: 600;
}

/* 导航按钮行 */
.judicial-modal-nav {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* 司法标签徽章 */
.judicial-tab-badge {
  display: inline-block;
  background: #c62828;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}
.judicial-tab-badge.hidden { display: none; }

/* 待处理请愿区块（社交Tab顶部） */
.npc-pending-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 16px;
}

/* NPC请求徽章（社交Tab） */
.tab-badge {
  display: inline-block;
  background: #e67e22;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}
.tab-badge.hidden { display: none; }

/* 待审卷宗列表 */
.judicial-pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.judicial-pending-card {
  background: #fffdf7;
  border: 1px solid #c8b98a;
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.judicial-pending-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.judicial-pending-title {
  font-weight: 600;
  color: #3a2c10;
  font-size: 0.95em;
  flex: 1;
}
.judicial-pending-county {
  font-size: 0.82em;
  color: #8a7a5a;
}
.judicial-pending-excerpt {
  font-size: 0.88em;
  color: #5a4a2a;
  line-height: 1.5;
}

/* 司法档案表 */
.pref-judicial-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  margin-top: 6px;
}
.pref-judicial-log-table th,
.pref-judicial-log-table td {
  border: 1px solid #d8c9a0;
  padding: 5px 8px;
  text-align: left;
}
.pref-judicial-log-table th {
  background: #f0e8d0;
  font-weight: 600;
  color: #5c4a2a;
}
.pref-judicial-log-table tr:nth-child(even) td {
  background: #faf6ed;
}

/* ==================== Annual Review ==================== */
.annual-review-card,
.pref-personnel-card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #d8ccb3;
  border-radius: 10px;
  background: #fbf7ef;
}

.annual-review-metrics,
.pref-personnel-metrics,
.pref-personnel-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 10px 0 12px;
  color: #5c4a2a;
  font-size: 0.92em;
}

.annual-review-form-grid,
.pref-review-form {
  display: grid;
  gap: 10px;
}

.annual-review-form-grid textarea,
.pref-review-form textarea,
.pref-review-form select {
  width: 100%;
  padding: 8px;
  border: 1px solid #cdbb94;
  border-radius: 6px;
  background: #fffdf8;
  font: inherit;
}

.annual-review-block,
.pref-personnel-block {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.annual-review-subtitle,
.pref-personnel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.annual-review-actions,
.pref-review-actions {
  margin-top: 10px;
}

.annual-review-risk {
  color: #8c5b21;
}

/* ── 县级司法判决方向 ── */
.county-verdict-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.county-verdict-option {
  background: #fef9f0;
  border: 1px solid #d8c9a0;
  border-radius: 4px;
  padding: 6px 10px;
}
.county-verdict-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-county-verdict-option {
  background: #fff8ec;
  border: 1px solid #b8936a;
  color: #5a3010;
  font-weight: 600;
  white-space: nowrap;
}
.btn-county-verdict-option:hover:not(:disabled) {
  background: #8b4513;
  color: #fff;
  border-color: #8b4513;
}
.btn-county-verdict-option:disabled { opacity: 0.5; cursor: not-allowed; }
.county-verdict-effects {
  font-size: 0.82em;
  color: #6b5230;
}
.county-verdict-rationale {
  margin-top: 4px;
  font-size: 0.82em;
  color: #7a6a50;
  line-height: 1.4;
}

/* ── 知府来文（县情总览） ── */
#prefect-directive-info {
  margin-top: 6px;
}
.prefect-directive-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  background: #fdf8ec;
  border-left: 3px solid #c8a840;
  border-radius: 3px;
  margin-bottom: 5px;
  font-size: 0.9em;
  line-height: 1.4;
}
.prefect-directive-tag {
  font-weight: bold;
  color: #7a5010;
  white-space: nowrap;
  flex-shrink: 0;
}
.prefect-directive-age {
  white-space: nowrap;
  flex-shrink: 0;
}
.prefect-directive-text {
  color: #4a3820;
}

/* ── 知府复审结果（司法归档） ── */
.prefect-review-block {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.9em;
  line-height: 1.5;
}
.prefect-review-block.upheld {
  background: #f0f7ec;
  border-left: 3px solid #5a8a3a;
}
.prefect-review-block.overturned {
  background: #fff5e8;
  border-left: 3px solid #c07020;
}
.prefect-review-header {
  font-weight: bold;
  color: #3a3020;
  margin-bottom: 4px;
}
.prefect-review-block.overturned .prefect-review-header {
  color: #8a4010;
}
.prefect-review-arrow {
  color: #c07020;
}
.prefect-review-letter {
  color: #5a4830;
  font-style: italic;
  margin: 4px 0 2px;
  padding-left: 6px;
  border-left: 2px solid #c8a840;
}
.prefect-review-affinity {
  margin-top: 4px;
  color: #8a4010;
}

/* ── 判决效果弹窗 ── */
.verdict-effects-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  animation: fadeInScale 0.15s ease;
}
.verdict-effects-popup-inner {
  background: #faf6ed;
  border: 2px solid #8b6914;
  border-radius: 8px;
  padding: 20px 28px;
  text-align: center;
  min-width: 220px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
}
.verdict-effects-title {
  font-weight: bold;
  font-size: 1em;
  color: #4a3520;
  margin-bottom: 10px;
}
.verdict-effects-body {
  font-size: 1.05em;
  color: #3a5a20;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
}
@keyframes fadeInScale {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── 已审案件归档 ── */
.judicial-archive-card {
  opacity: 0.88;
  border-left: 3px solid #b8a070;
}
.judicial-archive-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.judicial-archive-verdict {
  flex: 1;
  text-align: right;
  font-size: 0.85em;
  min-width: 80px;
}
.btn-tiny {
  font-size: 0.78em;
  padding: 2px 8px;
  background: #f0e8d8;
  border: 1px solid #c8aa78;
  border-radius: 3px;
  cursor: pointer;
  color: #5c4a2a;
  white-space: nowrap;
}
.btn-tiny:hover { background: #e0d0b0; }

.pref-personnel-replacement {
  margin-top: 8px;
  color: #7a2f21;
  font-weight: 600;
}

/* === Bribery System === */
.modal-sm { max-width: 420px; }

.bribe-modal-content { border-color: #8b4513; }
.bribe-modal-title { color: #8b4513; margin-bottom: 12px; }

.bribe-prompt {
  font-size: 0.95em;
  line-height: 1.7;
  color: #4a3a2a;
  background: #fef9f0;
  border-left: 3px solid #c8b98a;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 0 4px 4px 0;
}

.bribe-amount {
  font-weight: 600;
  color: #8b4513;
  margin-bottom: 16px;
  font-size: 1.05em;
}

.bribe-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-danger {
  background: #8b2500;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 0.9em;
}
.btn-danger:hover { background: #a83000; }

/* ===== 暴动状态横幅 ===== */
.riot-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: #5a0808;
  color: #f5d0c0;
  font-size: 0.87em;
  font-weight: 600;
  border-bottom: 2px solid #880000;
}
.riot-status-banner.hidden { display: none; }
.riot-banner-icon { font-size: 1.1em; flex-shrink: 0; }
.riot-banner-text { flex: 1; }
.riot-progress-wrap {
  width: 110px;
  height: 7px;
  background: #380000;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.riot-progress-fill {
  height: 100%;
  background: #e06060;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.riot-progress-label {
  font-size: 0.83em;
  color: #f5b0a0;
  flex-shrink: 0;
  min-width: 72px;
  text-align: right;
}

/* 知府接管时主屏轻微红色内投影 */
.screen-riot-active {
  box-shadow: inset 0 0 0 400px rgba(100, 0, 0, 0.04);
}

/* ===== 暴动危机弹窗 ===== */
.riot-crisis-content {
  max-width: 400px;
  text-align: center;
  background: #1e0808;
  border: 2px solid #8b0000;
  color: #f0d0c0;
  padding: 0 0 24px;
}
.riot-crisis-header {
  background: #6b0000;
  padding: 20px 24px 14px;
  margin-bottom: 20px;
}
.riot-crisis-icon {
  font-size: 2em;
  display: block;
  margin-bottom: 4px;
}
.riot-crisis-title {
  color: #ffe0d0;
  font-size: 1.15em;
  margin: 0;
}
.riot-crisis-body {
  font-size: 0.92em;
  line-height: 1.75;
  color: #e8c8b8;
  margin: 0 24px 12px;
}
.riot-crisis-note {
  font-size: 0.83em;
  color: #c09080;
  margin: 0 24px 20px;
}
.btn-riot-close {
  background: #8b2500;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 32px;
  cursor: pointer;
  font-size: 0.95em;
}
.btn-riot-close:hover { background: #a83000; }

/* ===== 月报中的暴动/裁决事件高亮 ===== */
.report-event-riot {
  border-left-color: #c0392b;
  background: #fff5f5;
  font-weight: 700;
  color: #7a0000;
}
.report-event-takeover {
  border-left-color: #d4a017;
  background: #fffbee;
  font-weight: 600;
  color: #7a5a00;
}
.report-event-resolution-good {
  border-left-color: #5a8a3c;
  background: #f5fff2;
  font-weight: 700;
  color: #2a5c1a;
}
.report-event-resolution-bad {
  border-left-color: #c0392b;
  background: #fff5f5;
  font-weight: 700;
  color: #7a0000;
}

.governor-silver {
  color: #8b6914;
  font-weight: 600;
  font-size: 0.9em;
}
.governor-silver.hidden { display: none; }

@media (max-width: 600px) {
  .feedback-fab {
    right: 12px;
    bottom: 12px;
  }
  .pref-infra-grid { grid-template-columns: 1fr; }
  .pref-talent-summary { flex-wrap: wrap; }
  .advance-result-content { max-width: 100%; }
  .judicial-modal-content { padding: 14px 12px; }
  .judicial-modal-footer { flex-direction: column; }
  .annual-review-subtitle,
  .pref-personnel-header { align-items: flex-start; }
}

/* === 官场子 tab === */
.offdom-subtab-bar {
  display: flex;
  gap: 6px;
  padding: 8px 0 12px;
  border-bottom: 1px solid #d4c5a0;
  margin-bottom: 14px;
}
.offdom-subtab-btn {
  padding: 5px 14px;
  border: 1px solid #b8a070;
  border-radius: 4px;
  background: #f5ede0;
  color: #5a3a10;
  cursor: pointer;
  font-size: 0.88em;
}
.offdom-subtab-btn.active {
  background: #8b5e1a;
  color: #fff;
  border-color: #8b5e1a;
}

/* === 仕途轨迹 === */
.career-wrap { padding: 4px 0; }

.career-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #fdf6e8;
  border: 1px solid #d4c5a0;
  border-radius: 6px;
}
.career-stat { display: flex; align-items: center; gap: 6px; }
.career-stat-label { color: #7a5c20; font-size: 0.85em; }
.career-stat-value { font-weight: 600; color: #3a200a; }

/* 候选池 badge */
.pool-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.82em;
  font-weight: 600;
}
.pool-none    { background: #eee; color: #777; }
.pool-level1  { background: #d4edda; color: #155724; }
.pool-level2  { background: #cce5ff; color: #004085; }
.pool-level3  { background: #fff3cd; color: #856404; }

/* 任期进度条 */
.career-progress-bar {
  height: 6px;
  background: #e8dcc8;
  border-radius: 3px;
  margin-bottom: 14px;
}
.career-progress-fill {
  height: 100%;
  background: #8b5e1a;
  border-radius: 3px;
  transition: width 0.4s;
}

/* 升迁条件 */
.career-requirements {
  padding: 10px 14px;
  background: #f9f3e6;
  border-left: 3px solid #c8a04a;
  border-radius: 0 4px 4px 0;
  margin-bottom: 16px;
}
.career-req-title { font-weight: 700; color: #5a3a10; margin-right: 6px; }
.career-req-remain { font-size: 0.85em; color: #8a6030; }
.career-req-desc { margin-top: 4px; font-size: 0.88em; color: #5a4020; line-height: 1.55; }

/* 候选池日志 & 各小节 */
.career-section { margin-bottom: 18px; }
.career-section-title {
  font-size: 0.9em;
  font-weight: 700;
  color: #5a3a10;
  border-bottom: 1px solid #d4c5a0;
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.career-log-list { list-style: none; padding: 0; }
.career-log-item {
  padding: 5px 0;
  font-size: 0.87em;
  color: #3a280e;
  border-bottom: 1px dashed #e0d0b0;
}
.career-log-item:last-child { border-bottom: none; }

/* 历年考评表 */
.career-review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}
.career-review-table th {
  background: #f0e6cc;
  color: #5a3a10;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 2px solid #c8a04a;
}
.career-review-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e8dcc8;
  color: #3a280e;
}
.career-review-table tr:hover td { background: #fdf6e8; }
.career-incident-row td {
  font-size: 0.82em;
  color: #8b3a00;
  background: #fff8f0;
  padding: 2px 8px 6px;
}

/* 考评等级 badge */
.grade-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.85em;
  font-weight: 600;
}
.grade-you   { background: #d4edda; color: #155724; }
.grade-liang { background: #cce5ff; color: #004085; }
.grade-zhong { background: #f5f5f5; color: #444; }
.grade-cha   { background: #f8d7da; color: #721c24; }
.grade-empty { color: #aaa; }

/* === 升迁事件面板 === */
.promo-event-box {
  border: 2px solid #c8a04a;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: #fffdf4;
}
.promo-event-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.promo-event-title {
  font-weight: 700;
  font-size: 1em;
  color: #5a3a10;
}
.promo-state-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  background: #f0e0b0;
  color: #7a4a00;
  font-size: 0.82em;
}
.promo-vacancy {
  font-size: 0.9em;
  color: #3a280e;
  margin-bottom: 8px;
}
.promo-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.87em;
}
.promo-candidates-label { color: #7a5c20; }
.promo-candidate {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.85em;
}
.promo-candidate.self  { background: #d4edda; color: #155724; font-weight: 600; }
.promo-candidate.npc   { background: #e8dcc8; color: #5a3a10; }

/* 行动区 */
.promo-actions { margin-top: 10px; }
.promo-btn-advisor {
  padding: 5px 14px;
  border: 1px solid #8b5e1a;
  border-radius: 4px;
  background: #f5ede0;
  color: #5a3a10;
  cursor: pointer;
  font-size: 0.88em;
  margin-bottom: 10px;
}
.promo-btn-advisor:hover { background: #e8d8b8; }
.promo-advisor-tip {
  padding: 8px 12px;
  background: #fdf9ec;
  border-left: 3px solid #c8a04a;
  border-radius: 0 4px 4px 0;
  font-size: 0.88em;
  color: #3a280e;
  line-height: 1.6;
  margin: 8px 0 12px;
}
.promo-gift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.promo-gift-card {
  border: 1px solid #d4c5a0;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fdf6e8;
  cursor: pointer;
  transition: background 0.15s;
}
.promo-gift-card:hover { background: #f0e0c0; border-color: #c8a04a; }
.promo-gift-card-title { font-weight: 600; color: #5a3a10; font-size: 0.9em; }
.promo-gift-card-desc  { font-size: 0.82em; color: #7a5c30; margin-top: 3px; }

/* 已行动 */
.promo-action-done {
  font-size: 0.88em;
  color: #3a5a20;
  padding: 6px 10px;
  background: #f0fff0;
  border-radius: 4px;
  margin-top: 8px;
}

/* 等待吏部 */
.promo-ministry-msg { font-size: 0.9em; padding: 8px 0; color: #3a280e; }
.promo-ministry-nominated     { color: #155724; font-weight: 600; }
.promo-ministry-not-nominated { color: #856404; }

/* 结果 */
.promo-result {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 6px;
}
.promo-result-success { background: #d4edda; border: 1px solid #5a8a3c; }
.promo-result-fail    { background: #f8d7da; border: 1px solid #c0392b; }
.promo-result-reason  { font-size: 0.9em; font-weight: 600; margin-bottom: 10px; }
.promo-new-game-btn   { margin-top: 6px; }

@media (max-width: 600px) {
  .promo-gift-grid { grid-template-columns: 1fr; }
}

/* ==================== Term Complete Modal ==================== */
.term-complete-content {
  max-width: 480px;
  padding: 24px 28px;
}
.term-complete-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e8d5a0;
  padding-bottom: 12px;
}
.term-complete-title {
  font-size: 1.2em;
  font-weight: 700;
  color: #3a280e;
  margin: 0;
}
.term-complete-body {
  font-size: 0.95em;
  color: #3a280e;
  margin-bottom: 14px;
  line-height: 1.5;
}
.term-complete-transfer {
  background: #fffbe6;
  border: 1px solid #e8c84a;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.88em;
  color: #5a3a10;
  margin-bottom: 14px;
}
.term-complete-transfer-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.term-complete-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.term-complete-stat {
  background: #faf4e4;
  border: 1px solid #e8d5a0;
  border-radius: 5px;
  padding: 6px 10px;
  text-align: center;
}
.term-complete-stat-label {
  font-size: 0.75em;
  color: #7a5c30;
}
.term-complete-stat-val {
  font-size: 1em;
  font-weight: 600;
  color: #3a280e;
}
.term-complete-footer {
  border-top: 1px solid #e8d5a0;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.term-complete-flavor {
  font-size: 0.88em;
  color: #5a3a10;
  font-style: italic;
  flex: 1;
}
.term-complete-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-retire {
  color: #7a3a20;
  border-color: #c8a080;
}
.btn-retire:hover { background: #f5e8d8; }

/* Career review — term grouping */
.career-term-group { margin-bottom: 14px; }
.career-term-label {
  font-size: 0.82em;
  font-weight: 600;
  color: #7a5c30;
  background: #f5edda;
  padding: 3px 8px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #e8d5a0;
  border-bottom: none;
}

/* County name in game header */
.county-name-display {
  font-weight: 700;
  font-size: 1em;
  color: #3a280e;
  margin-right: 6px;
}

/* ── 知县档案卡（仕途轨迹子面板） ─────────────────────────────────────────── */
.archive-card {
  background: #fdf6e8;
  border: 1px solid #d8c088;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.archive-title {
  font-size: 0.82em;
  font-weight: 700;
  color: #7a5c20;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.archive-quote {
  font-size: 0.9em;
  color: #5a3a10;
  font-style: italic;
  margin-bottom: 8px;
  border-left: 3px solid #d8b060;
  padding-left: 8px;
}
.archive-style {
  margin-left: 6px;
  font-style: normal;
  font-size: 0.85em;
  color: #8a7a5a;
  background: #f0e4c0;
  border-radius: 3px;
  padding: 1px 6px;
}
.archive-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.archive-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.archive-stat-label {
  font-size: 0.8em;
  color: #8a7050;
}
.archive-stat-value {
  font-size: 0.88em;
  font-weight: 600;
  color: #3a200a;
}

/* ── 流言板 ───────────────────────────────────────────────────────────────── */
.rumors-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.rumor-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: #fdf8ef;
  border: 1px solid #e8d8a8;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.87em;
  line-height: 1.5;
}
.rumor-cat {
  flex-shrink: 0;
  font-size: 0.75em;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 5px;
}
.rumor-cat-neighbor { background: #ddeeff; color: #2060a0; }
.rumor-cat-folk     { background: #ddf5dd; color: #206020; }
.rumor-cat-public   { background: #fff0cc; color: #906000; }
.rumor-text {
  flex: 1;
  color: #3a280e;
}
.rumor-source {
  flex-shrink: 0;
  font-size: 0.78em;
  color: #9a8060;
  white-space: nowrap;
}
.rumor-urgent {
  border-left: 3px solid #c0392b;
  padding-left: 8px;
}
.rumor-age {
  color: #999;
  font-size: 0.75em;
  margin-left: 4px;
}


/* ========================================================
   书信系统 (Letter System)
   ======================================================== */

/* 信箱按钮 + 徽标 */
.letter-btn {
  position: relative;
}
.letter-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #c0392b;
  color: #fff;
  font-size: 0.7em;
  font-weight: bold;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  pointer-events: none;
}
.letter-badge-urgent {
  background: #e67e22;
  animation: letter-pulse 1.2s ease-in-out infinite;
}
@keyframes letter-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* 信箱 Modal */
.letter-modal-content {
  max-width: 680px;
  width: 96%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.letter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid #e0d5c0;
  background: #fdf8ef;
  flex-shrink: 0;
}
.letter-modal-header h4 {
  margin: 0;
  color: #5c4a2a;
  font-size: 1.05em;
}
.letter-modal-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Tab 栏 */
.letter-tabs {
  display: flex;
  border-bottom: 1px solid #e0d5c0;
  background: #faf5ea;
  flex-shrink: 0;
}
.letter-tab-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: #7a6848;
  font-size: 0.9em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.letter-tab-btn:hover { color: #5c4a2a; }
.letter-tab-btn.active {
  color: #5c4a2a;
  font-weight: bold;
  border-bottom-color: #c8a060;
}

/* 内容面板 */
.letter-pane {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
}

/* 信箱 tab 嵌入式工具栏 */
.letter-tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 0;
  border-bottom: 1px solid #e0d5c0;
  background: #faf5ea;
  margin-bottom: 0;
}
.letter-tab-toolbar .letter-tabs {
  border-bottom: none;
  background: transparent;
  flex: 1;
}

/* tab 内的 pane 不用 flex，正常块排列 */
#tab-letters .letter-pane,
#pref-tab-letters .letter-pane {
  overflow-y: visible;
  flex: none;
}
.letter-loading, .letter-empty, .letter-error {
  text-align: center;
  color: #9a8060;
  padding: 30px 10px;
  font-size: 0.9em;
}
.letter-error { color: #8b0000; }

/* 信件列表项 */
.letter-item {
  border: 1px solid #e0d5c0;
  border-radius: 5px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.letter-item:hover { background: #fdf8ef; border-color: #c8a060; }
.letter-unread {
  background: #fffbf0;
  border-left: 3px solid #c8a060;
  font-weight: 500;
}
.letter-blocking {
  border-left: 3px solid #c0392b !important;
  background: #fff5f5 !important;
}
.letter-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82em;
  color: #9a8060;
  margin-bottom: 3px;
}
.letter-counterpart { font-weight: 600; color: #5c4a2a; }
.letter-date { color: #a09070; }
.letter-subject {
  font-size: 0.95em;
  color: #3a2810;
  margin-bottom: 5px;
}
.letter-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.letter-tag {
  font-size: 0.72em;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.letter-tag-type     { background: #e8f0e8; color: #407040; }
.letter-tag-conf     { background: #f0e8e8; color: #704040; }
.letter-tag-urgent   { background: #ffe0e0; color: #8b0000; font-weight: bold; }
.letter-tag-reply    { background: #fff0cc; color: #8b6000; }
.letter-deadline     { font-size: 0.75em; color: #c0392b; }

/* 信件详情 */
.letter-back-btn {
  margin-bottom: 10px;
}
.letter-detail-card {
  border: 1px solid #e0d5c0;
  border-radius: 6px;
  padding: 14px 16px;
  background: #fefcf7;
}
.letter-detail-subject {
  font-size: 1.05em;
  color: #3a1800;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #d0c090;
}
.letter-detail-meta {
  font-size: 0.82em;
  color: #7a6848;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.letter-meta-label { color: #a08050; }
.letter-parent-ref {
  font-size: 0.8em;
  color: #9a8060;
  margin-bottom: 8px;
  font-style: italic;
}
.letter-burn-notice {
  background: #fff0e0;
  border: 1px solid #e0a060;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.85em;
  color: #804020;
  margin-bottom: 10px;
}
.letter-detail-body {
  font-size: 0.93em;
  color: #3a2810;
  line-height: 1.85;
  white-space: pre-wrap;
  padding: 10px 0;
  border-bottom: 1px dashed #d0c090;
  margin-bottom: 12px;
}

/* 回复区 */
.letter-reply-area {
  margin-top: 10px;
}
.letter-reply-label {
  font-size: 0.85em;
  color: #7a6848;
  margin-bottom: 6px;
}
.letter-choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  background: #fdf8ef;
  color: #3a2810;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.12s;
}
.letter-choice-btn:hover { background: #f5ecd0; }
.letter-choice-hint {
  font-size: 0.8em;
  color: #9a8060;
}
.letter-replied-notice {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f0f5e8;
  border-radius: 4px;
  font-size: 0.85em;
  color: #507030;
  border: 1px solid #c0d0a0;
}

/* 写信 Modal 表单 */
.letter-compose-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.letter-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85em;
  color: #7a6848;
}
.letter-form-select,
.letter-form-input {
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.93em;
  background: #fdf8ef;
  color: #3a2810;
}
.letter-form-textarea {
  padding: 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.92em;
  resize: vertical;
  background: #fdf8ef;
  color: #3a2810;
  line-height: 1.7;
}

/* ══════════════════════════════════════════════
   幕僚室 (counsel-*)
   ══════════════════════════════════════════════ */

/* 自创施政分区标题 */
.invest-custom-title {
  margin: 18px 0 8px;
  font-size: 0.95em;
  color: #6a4a20;
  border-bottom: 1px solid #d8c898;
  padding-bottom: 4px;
}

/* ── 施政 tab 入口卡片 ────────────────────────────────── */
.counsel-entry-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fdf5e0;
  border: 1px solid #c8b07a;
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  user-select: none;
}
.counsel-entry-card:hover {
  background: #f5e8c0;
  border-color: #a07840;
}
.counsel-entry-icon {
  font-size: 1.7em;
  flex-shrink: 0;
}
.counsel-entry-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.counsel-entry-text strong {
  font-size: 0.98em;
  color: #4a2e0a;
}
.counsel-entry-text span {
  font-size: 0.82em;
  color: #8a6840;
}

/* ── 红点 badge ────────────────────────────────────────── */
.counsel-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #e03030;
  border-radius: 50%;
  vertical-align: middle;
  margin-left: 5px;
  flex-shrink: 0;
}
.counsel-entry-card .counsel-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 10px;
  height: 10px;
  margin: 0;
}

/* ── Modal 外壳 ────────────────────────────────────────── */
.counsel-modal-content {
  width: min(820px, 96vw);
  height: min(680px, 88vh);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────*/
.counsel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #d8c898;
  background: #fdf5e0;
  flex-shrink: 0;
}
.counsel-header-title {
  margin: 0;
  font-size: 1em;
  color: #5a3e1b;
  font-weight: bold;
}
.counsel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.counsel-sidebar-btn {
  position: relative;
}
.counsel-sidebar-btn.active {
  background: #5a3e1b;
  color: #f5e8c8;
  border-color: #3a2810;
}

/* ── Body: chat + sidebar ─────────────────────────────── */
.counsel-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Main chat area ───────────────────────────────────── */
.counsel-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* 消息滚动区 */
.counsel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fdf8f0;
}

/* 消息气泡 — 通用行 */
.counsel-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 82%;
}

/* NPC 靠左 */
.counsel-msg-npc {
  align-self: flex-start;
}
.counsel-msg-avatar {
  font-size: 1.3em;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.counsel-msg-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.counsel-msg-label {
  font-size: 0.75em;
  color: #9a7040;
  padding: 0 2px;
}

/* 气泡 */
.counsel-msg-bubble {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.91em;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}
.counsel-bubble-npc {
  background: #fff;
  border: 1px solid #d8c898;
  border-top-left-radius: 2px;
  color: #3a2810;
}
.counsel-bubble-user {
  background: #d4e8c0;
  border: 1px solid #a0c070;
  border-top-right-radius: 2px;
  color: #253a10;
}

/* 知县 靠右 */
.counsel-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.counsel-msg-user .counsel-msg-inner {
  align-items: flex-end;
}

/* 系统消息 居中 */
.counsel-msg-system {
  align-self: center;
  max-width: 90%;
}
.counsel-system-text {
  background: #fff8e6;
  border: 1px solid #e0c060;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.82em;
  color: #7a5a10;
  text-align: center;
  line-height: 1.5;
}

/* ── 内联施政卡片（嵌入消息流） ──────────────────────── */
.counsel-inline-cards {
  margin: 4px 0 8px 36px;  /* 与 NPC 气泡左对齐 */
}
.counsel-inline-cards-label {
  font-size: 0.73em;
  color: #9a7040;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

/* ── 建议施政卡片区（保留，已不再主动使用） ─────────── */
.counsel-action-cards {
  padding: 10px 14px;
  border-top: 1px solid #e8d8b0;
  background: #f8f4e8;
  flex-shrink: 0;
}
.counsel-cards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.counsel-cards-label {
  font-size: 0.75em;
  color: #9a7040;
  font-weight: bold;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.counsel-cards-toggle {
  border: 1px solid #cfbb93;
  background: #fff8e8;
  color: #7a5730;
  border-radius: 6px;
  font-size: 0.75em;
  padding: 2px 8px;
  cursor: pointer;
}
.counsel-cards-toggle:hover {
  background: #f5e8c8;
  border-color: #b89662;
}
.counsel-action-cards.collapsed {
  padding-top: 8px;
  padding-bottom: 8px;
}
.counsel-action-cards.collapsed .counsel-cards-head {
  margin-bottom: 0;
}
.counsel-action-cards.collapsed .counsel-cards-grid {
  display: none;
}
.counsel-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.counsel-action-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  background: #fff;
  border: 1px solid #c8b07a;
  border-radius: 7px;
  padding: 8px 10px 8px 12px;
  cursor: pointer;
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  max-width: calc(50% - 4px);
  box-sizing: border-box;
  transition: background 0.12s;
}
.counsel-action-card:hover:not(.disabled) {
  background: #f5e8c8;
  border-color: #a07840;
}
.counsel-action-card.disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.counsel-card-body  { flex: 1; min-width: 0; }
.counsel-card-name  { font-weight: bold; font-size: 0.88em; color: #5a3e1b; }
.counsel-card-cost  { font-size: 0.78em; color: #8a6840; }
.counsel-card-rationale { font-size: 0.78em; color: #6a6050; line-height: 1.4; }
.counsel-card-disabled  { font-size: 0.76em; color: #c06040; }
.counsel-card-dismiss {
  align-self: flex-start;
  flex-shrink: 0;
  background: none;
  border: none;
  color: #b09060;
  font-size: 1em;
  line-height: 1;
  padding: 0 0 0 6px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.1s;
}
.counsel-card-dismiss:hover { opacity: 1; color: #8a3020; }

/* ── 新构想申报卡片区 ─────────────────────────────────── */
.counsel-propose-cards {
  padding: 10px 14px;
  border-top: 1px solid #c8d8b0;
  background: #f4f9ec;
  flex-shrink: 0;
}
.counsel-propose-cards-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.counsel-propose-cards-label {
  font-size: 0.75em;
  font-weight: bold;
  color: #4a6830;
  flex: 1;
}
.counsel-propose-card {
  background: #edf5e0;
  border: 1px solid #a8c480;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  cursor: default;
}
.counsel-propose-card-body { flex: 1; min-width: 0; }
.counsel-propose-card-name { font-weight: bold; font-size: 0.88em; color: #3a5820; }
.counsel-propose-card-rationale { font-size: 0.78em; color: #5a6850; line-height: 1.4; margin-top: 3px; }
.counsel-propose-card-hint { font-size: 0.75em; color: #7a9060; margin-top: 4px; }
.counsel-propose-card-actions { display: flex; gap: 6px; margin-top: 6px; }
.counsel-propose-card-submit {
  font-size: 0.78em; padding: 3px 8px;
  background: #6a9040; color: #fff; border: none;
  border-radius: 4px; cursor: pointer;
}
.counsel-propose-card-submit:hover { background: #507030; }
.counsel-propose-card-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.counsel-propose-card-dismiss {
  font-size: 0.78em; padding: 3px 8px;
  background: none; color: #7a9060; border: 1px solid #a8c480;
  border-radius: 4px; cursor: pointer;
}
.counsel-propose-card-dismiss:hover { background: #d8e8c8; }

/* ── 输入栏 ───────────────────────────────────────────── */
.counsel-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #d8c898;
  background: #fdf5e0;
  flex-shrink: 0;
}
.counsel-input {
  flex: 1;
  padding: 7px 11px;
  border: 1px solid #c8b98a;
  border-radius: 6px;
  font-size: 0.93em;
  background: #fff;
  color: #3a2810;
  outline: none;
}
.counsel-input:focus {
  border-color: #8a6840;
}

/* ── 侧边栏 ───────────────────────────────────────────── */
.counsel-sidebar {
  width: 0;
  overflow: hidden;
  border-left: 0px solid #d8c898;
  background: #faf6ec;
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease, border-left-width 0.22s ease;
  flex-shrink: 0;
}
.counsel-sidebar.open {
  width: 260px;
  border-left-width: 1px;
  overflow-y: auto;
}
.counsel-sidebar-inner {
  width: 260px;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.counsel-sidebar-section-title {
  font-size: 0.78em;
  font-weight: bold;
  color: #8a6030;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  border-bottom: 1px solid #e0d0a0;
  padding-bottom: 4px;
}

/* 申报表单 */
.counsel-propose-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.counsel-form-input {
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.88em;
  background: #fff;
  color: #3a2810;
  width: 100%;
  box-sizing: border-box;
}
.counsel-form-textarea {
  padding: 6px 8px;
  border: 1px solid #c8b98a;
  border-radius: 4px;
  font-size: 0.87em;
  resize: vertical;
  background: #fff;
  color: #3a2810;
  line-height: 1.55;
  width: 100%;
  box-sizing: border-box;
}

/* 申报记录列表 */
.counsel-policy-group {
  margin-bottom: 10px;
}
.counsel-policy-group-hd {
  font-size: 0.78em;
  font-weight: bold;
  color: #7a6040;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.counsel-policy-count {
  background: #d8c898;
  color: #5a4020;
  border-radius: 8px;
  padding: 0 5px;
  font-size: 0.9em;
}
.counsel-policy-item {
  padding: 6px 9px;
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 0.83em;
  line-height: 1.45;
}
.counsel-policy-item.status-pending {
  background: #fffae8;
  border: 1px solid #d8c060;
}
.counsel-policy-item.status-approved {
  background: #eef7e6;
  border: 1px solid #90c070;
}
.counsel-policy-item.status-rejected {
  background: #fdf0f0;
  border: 1px solid #d09080;
}
.counsel-policy-item-name { font-weight: bold; color: #3a2810; }
.counsel-policy-item-meta { font-size: 0.85em; color: #6a8050; margin-top: 2px; }
.counsel-policy-item-reason { font-size: 0.83em; color: #a04030; margin-top: 2px; }
.counsel-policy-discard-btn {
  display: block;
  margin-top: 5px;
  padding: 2px 8px;
  font-size: 0.78em;
  color: #a04030;
  background: transparent;
  border: 1px solid #c07060;
  border-radius: 4px;
  cursor: pointer;
}
.counsel-policy-discard-btn:hover { background: #fdf0f0; }
.counsel-policy-discard-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 皇帝巡游摊派 ── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
  display: flex; align-items: flex-start; gap: 8px;
  cursor: pointer; font-size: 0.9em; color: #3a2810;
  line-height: 1.4;
}
.radio-label input[type="radio"] { margin-top: 2px; flex-shrink: 0; }
.modal-section { padding: 10px 0; border-top: 1px solid #e8d9b0; }
.modal-section h4 { color: #6b4c0a; margin: 0 0 8px 0; font-size: 0.95em; }

/* ── 上级管理 Tab ── */
.superior-section {
  background: #fdf8f0;
  border: 1px solid #d4c090;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.superior-section-title {
  font-weight: bold;
  color: #5a3a10;
  font-size: 0.95em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e8d090;
}
.superior-prefect-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.superior-pref-name {
  font-size: 1em;
  font-weight: bold;
  color: #3a2810;
}
.superior-prefect-name {
  font-size: 0.95em;
  color: #5a3a10;
}
.superior-affinity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.superior-affinity-num {
  font-size: 0.85em;
  color: #8a7a5a;
}
.superior-attr-label {
  color: #8a7a5a;
  font-size: 0.88em;
  min-width: 3em;
}
.superior-attr-row {
  font-size: 0.88em;
  color: #4a3a20;
  margin-bottom: 3px;
}
.superior-bio {
  font-size: 0.85em;
  color: #6a5a40;
  margin-top: 5px;
  font-style: italic;
}
.superior-directive-item {
  background: #fff8ec;
  border: 1px solid #d4b870;
  border-radius: 4px;
  padding: 7px 10px;
  margin-bottom: 6px;
}
.superior-directive-type {
  font-weight: bold;
  color: #7a4a10;
  font-size: 0.9em;
}
.superior-directive-month {
  font-size: 0.82em;
  color: #8a7a5a;
  margin-left: 6px;
}
.superior-directive-text {
  font-size: 0.88em;
  color: #3a2810;
  margin-top: 4px;
  line-height: 1.5;
}
.superior-judicial-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: #4a3a20;
}
/* 府级概况 */
.pref-state-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
  font-size: 0.9em;
}
.pref-state-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pref-state-label { color: #8a7a5a; font-size: 0.82em; }
.pref-state-value { font-weight: 600; color: #3a2810; }
.infra-pip {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  background: #d5ceb8;
  margin-right: 3px;
}
.infra-pip-on { background: #6b8f4a; }
/* 各县税收表 */
.superior-tax-scroll { overflow-x: auto; }
.superior-tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.superior-tax-table th, .superior-tax-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #ede7d9;
  text-align: right;
  white-space: nowrap;
}
.superior-tax-table th { background: #f5f0e8; color: #5a3a10; font-weight: 600; text-align: center; }
.superior-tax-table td:first-child { text-align: left; font-weight: 600; color: #3a2810; }
.tax-retained { color: #8a7a5a; font-size: 0.82em; margin-left: 4px; }
.tax-ok  { color: #27ae60; }
.tax-warn { color: #c0702a; }
.tax-bad  { color: #c0392b; }
.superior-gazette-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.superior-gazette-title {
  font-weight: bold;
  color: #5a3a10;
  font-size: 0.95em;
}

/* ── NPC 简单请愿卡片（V2赈灾 / G1出资建塾）── */
.npc-request-card {
  background: #fffbf0;
  border: 1px solid #c8a060;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
}
.npc-req-msg {
  font-size: 0.88em;
  color: #4a2c10;
  margin-bottom: 8px;
  line-height: 1.5;
}
.npc-req-btns {
  display: flex;
  gap: 8px;
}
.npc-req-btns button {
  padding: 4px 14px;
  border-radius: 4px;
  border: 1px solid #a07040;
  cursor: pointer;
  font-size: 0.85em;
}
.btn-npc-accept { background: #4a7c59; color: #fff; }
.btn-npc-accept:hover { background: #3a6a49; }
.btn-npc-refuse { background: #f5f0e8; color: #5a3a10; }
.btn-npc-refuse:hover { background: #e8dcc8; }
.npc-req-done {
  font-size: 0.85em;
  color: #6a7a6a;
  font-style: italic;
}

/* ── Token 用量面板 ─────────────────────────────── */
.token-usage-panel {
  margin-top: 12px;
  border: 1px solid var(--border, #d0c8b0);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.82em;
}
.token-usage-panel.hidden { display: none; }

.token-usage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-muted, #f5f0e8);
  cursor: pointer;
  user-select: none;
}
.token-usage-title { font-weight: 600; flex: 1; }
.token-usage-total { color: var(--text-muted, #888); font-size: 0.9em; }
.token-usage-arrow { font-size: 0.75em; transition: transform 0.2s; }
.token-usage-header.open .token-usage-arrow { transform: rotate(90deg); }

.token-usage-body { overflow-x: auto; }
.token-usage-body.hidden { display: none; }

.token-usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.token-usage-table th,
.token-usage-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border, #d0c8b0);
  text-align: right;
  white-space: nowrap;
}
.token-usage-table th:first-child,
.token-usage-table td:first-child { text-align: left; }
.token-usage-table th { background: var(--bg-muted, #f5f0e8); font-weight: 600; }
.token-usage-table tr:last-child td { border-bottom: none; }
