/* Estate Tabs - Tab-Based View CSS */

/* Estate View Container - Ensures proper layout */
.estate-view {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

/* Tab Navigation Container - Ensures tabs stay above content */
.estate-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
  width: 100%;
  position: relative;
  z-index: 10;
}

.estate-tab {
  padding: 12px 20px;
  background: var(--bg-light);
  border: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  position: relative;
  color:#333;
}

.estate-tab:hover:not(.inactive) {
  background: var(--border);
}

.estate-tab.active {
  background: white;
  border-bottom: 3px solid var(--secondary);
  color: var(--secondary);
}

.estate-tab.progression-hidden {
  display: none !important;
}

.estate-tab.inactive {
  background: var(--bg-light);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.estate-tab.inactive:hover {
  background: var(--bg-light);
}

.estate-tab.inactive {
  opacity: 0.5;
  cursor: not-allowed;
}

.estate-tab.inactive:hover {
  background: var(--bg-light);
}

/* Tab Content Container - Ensures full width layout */
.estate-tab-content-container {
  width: 100%;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px var(--shadow);
  margin-top: 0;
  clear: both;
}

/* Trade Tab - Internal Trade Tabs */
.trade-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.trade-tab {
  padding: 8px 16px;
  background: var(--bg-light);
  border: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: all 0.2s;
}

.trade-tab:hover {
  background: var(--border);
}

.trade-tab.active {
  background: white;
  border-bottom: 2px solid var(--secondary);
  color: var(--secondary);
  font-weight: 600;
}

.trade-tab-content {
  display: none;
  padding: 15px 0;
  animation: fadeIn 0.2s;
}

.trade-tab-content.active {
  display: block;
}

/* ============================================
   Army Sub-Tabs
   ============================================ */
.army-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 20px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.army-tab {
  padding: 8px 16px;
  background: var(--bg-light);
  border: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: all 0.2s;
}

.army-tab:hover {
  background: var(--border);
}

.army-tab.active {
  background: white;
  border-bottom: 2px solid var(--secondary);
  color: var(--secondary);
  font-weight: 600;
}

.army-tab-content {
  display: none;
  padding: 0;
  animation: fadeIn 0.2s;
}

.army-tab-content.active {
  display: block;
}

/* ============================================
   Buildings Sub-Tabs
   ============================================ */
.buildings-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 20px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.buildings-tab {
  padding: 8px 16px;
  background: var(--bg-light);
  border: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: all 0.2s;
}

.buildings-tab:hover {
  background: var(--border);
}

.buildings-tab.active {
  background: white;
  border-bottom: 2px solid var(--secondary);
  color: var(--secondary);
  font-weight: 600;
}

.buildings-tab-content {
  display: none;
  padding: 0;
  animation: fadeIn 0.2s;
}

.buildings-tab-content.active {
  display: block;
}

/* ============================================
   Building Catalog Cards
   ============================================ */
.building-catalog {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.building-catalog-tier {
  margin-bottom: 16px;
}

.building-catalog-tier h4 {
  font-size: 15px;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.building-card {
  background: var(--bg-light, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 6px;
}

.building-card:hover {
  border-color: var(--secondary, #6366f1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.building-card.expanded {
  border-color: var(--secondary, #6366f1);
  background: white;
}

.building-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.building-card-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.building-card-summary {
  flex: 1;
  min-width: 0;
}

.building-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text, #111827);
  margin: 0;
}

.building-card-desc {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  margin: 2px 0 0 0;
}

.building-card-chevron {
  font-size: 16px;
  color: var(--text-secondary, #6b7280);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.building-card.expanded .building-card-chevron {
  transform: rotate(180deg);
}

.building-card-details {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e5e7eb);
}

.building-card.expanded .building-card-details {
  display: block;
}

.building-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.building-detail-section {
  background: var(--bg-light, #f9fafb);
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--border, #e5e7eb);
}

.building-card.expanded .building-detail-section {
  background: var(--bg-light, #f3f4f6);
}

.building-detail-section.cost {
  border-left-color: #ef4444;
}

.building-detail-section.production {
  border-left-color: #10b981;
}

.building-detail-section.consumption {
  border-left-color: #f59e0b;
}

.building-detail-section.requirements {
  border-left-color: #6366f1;
}

.building-detail-section.storage {
  border-left-color: #3b82f6;
}

.building-detail-section.bonus {
  border-left-color: #8b5cf6;
}

.building-detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #6b7280);
  margin: 0 0 4px 0;
}

.building-detail-value {
  font-size: 13px;
  color: var(--text, #111827);
  margin: 0;
  line-height: 1.6;
}

.building-card-owned {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  margin-left: auto;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
  flex-shrink: 0;
}

/* Building catalog upgrade section */
.building-catalog-upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 8px;
}

.building-catalog-upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.building-catalog-upgrade-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.building-catalog-upgrade-cost {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-catalog-upgrade {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 6px;
}

.btn-catalog-upgrade:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Legendary Building Perks ─── */

.legendary-section {
  flex-direction: column;
  align-items: stretch;
  background: rgba(234, 179, 8, 0.06);
  border-color: rgba(234, 179, 8, 0.2);
}

.legendary-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #eab308;
  margin-bottom: 4px;
}

.legendary-badge.locked {
  color: #9ca3af;
}

.legendary-locked-info,
.legendary-upgrade-info {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.btn-legendary-upgrade {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  border: none;
  cursor: pointer;
  align-self: flex-start;
}

.btn-legendary-upgrade:hover {
  background: linear-gradient(135deg, #92400e, #b45309);
}

.legendary-choose-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.legendary-perk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.legendary-perk-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legendary-perk-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.legendary-perk-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.legendary-perk-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.legendary-perk-type-badge.passive {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.legendary-perk-type-badge.active {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
}

.legendary-perk-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.legendary-perk-card-cost {
  font-size: 11px;
  color: #9ca3af;
  margin: 0;
}

.btn-legendary-select {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  margin-top: 4px;
  align-self: flex-start;
}

.legendary-selected {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legendary-perk-name {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24;
}

.legendary-perk-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.legendary-buff-active {
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
  margin-top: 4px;
}

.btn-legendary-activate {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 4px;
}

.btn-legendary-activate:hover {
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
}

.btn-legendary-activate:disabled,
.btn-legendary-upgrade:disabled,
.btn-legendary-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================
   Combat Log
   ============================================ */
.combat-log-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.combat-log-filter {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-light);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.combat-log-filter:hover {
  background: var(--border);
}

.combat-log-filter.active {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

/* ===== Active Attacks List ===== */
.attacks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attack-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.attack-card.outgoing {
  border-left: 4px solid #3b82f6;
}

.attack-card.incoming {
  border-left: 4px solid #ef4444;
}

.attack-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface, #f8f9fa);
  border-bottom: 1px solid var(--border);
}

.attack-direction {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
}

.attack-target {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
}

.attack-card-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attack-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.attack-label {
  color: #6b7280;
  font-weight: 500;
}

.attack-value {
  font-weight: 600;
  color: var(--primary);
}

.attack-eta {
  color: #f59e0b;
  font-variant-numeric: tabular-nums;
}

.attack-unknown {
  color: #9ca3af;
  font-style: italic;
}

.attack-card-actions {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.btn-cancel-attack {
  background: transparent;
  color: #ef4444;
  border: 1px solid #fca5a5;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-attack:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.btn-cancel-attack:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.combat-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.battle-report-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.battle-report-item:hover {
  border-color: var(--secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.battle-report-item.expanded {
  border-color: var(--secondary);
}

.battle-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.battle-report-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.combat-type-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.battle-report-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.battle-report-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.battle-report-summary {
  font-size: 12px;
  color: var(--text-muted);
}

.battle-report-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.battle-report-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.battle-report-badge.victory {
  background: #d4edda;
  color: #155724;
}

.battle-report-badge.defeat {
  background: #f8d7da;
  color: #721c24;
}

.battle-report-badge.cancelled {
  background: #fff3cd;
  color: #856404;
}

.battle-report-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.battle-report-expand {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

/* Detail section (inline expand) */
.battle-report-detail {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  animation: fadeIn 0.2s;
}

.report-section {
  margin-top: 12px;
}

.report-section h5 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Power comparison bar */
.power-comparison {
  margin-top: 12px;
}

.power-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.power-label:last-of-type {
  margin-top: 3px;
  text-align: right;
}

.power-bar {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.power-bar-attacker {
  background: #e74c3c;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

.power-bar-defender {
  background: #3498db;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}

/* Casualty table */
.casualty-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}

.casualty-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.casualty-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.unit-type-cell {
  font-weight: 500;
}

.casualties-cell {
  color: #e74c3c;
  font-weight: 600;
}

/* Resources stolen */
.resources-stolen {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.resource-item {
  font-size: 13px;
  padding: 4px 8px;
  background: white;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Rituals */
.rituals-info {
  font-size: 13px;
  color: var(--text);
}

.rituals-info div {
  margin-bottom: 4px;
}

/* Type-specific details */
.bandit-details,
.location-details {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.victory-text {
  color: #155724;
  font-weight: 600;
}

.defeat-text {
  color: #721c24;
  font-weight: 600;
}

/* Timestamp footer */
.report-timestamp {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* Phase timeline */
.phase-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase-entry {
  background: var(--bg-secondary, #2a2a2a);
  border-left: 3px solid var(--border-accent, #666);
  border-radius: 4px;
  padding: 8px 12px;
}

.phase-header {
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text-primary, #eee);
}

.phase-icon {
  margin-right: 4px;
}

.phase-events {
  margin: 4px 0;
}

.phase-event {
  font-size: 12px;
  color: var(--text-secondary, #bbb);
  padding: 2px 0;
}

.phase-damage {
  display: flex;
  gap: 12px;
  font-size: 12px;
  margin: 4px 0;
}

.dmg-dealt {
  color: #5cb85c;
}

.dmg-taken {
  color: #d9534f;
}

.phase-casualties {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  margin: 2px 0;
}

.your-losses {
  color: #d9534f;
}

.enemy-losses {
  color: #5cb85c;
}

.phase-routed {
  font-size: 12px;
  font-style: italic;
}

.keywords-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #444);
}

.keyword-tag {
  background: var(--bg-tertiary, #333);
  border: 1px solid var(--border-color, #555);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary, #ccc);
}

/* Pagination */
.combat-log-pagination {
  margin-top: 16px;
  text-align: center;
}

.combat-log-pagination.hidden {
  display: none;
}

/* Armory placeholder */
.empty-state-container {
  text-align: center;
  padding: 40px 20px;
}

.empty-state-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Religion Tab - Religion Specific Styles */
.religion-info {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

.religion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 600;
}

.religion-header .label {
  color: var(--text-muted);
}

.religion-header .value {
  color: var(--text);
  font-weight: 600;
}

.faith-points {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.religion-setup {
  margin: 20px 0;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

.religion-comparison {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.comparison-card {
  flex: 1;
  min-width: 260px;
  padding: 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.comparison-card h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aesir-card {
  border-color: #8b6914;
}

.aesir-card h4 {
  color: #8b6914;
}

.christianity-card {
  border-color: #2e5fa1;
}

.christianity-card h4 {
  color: #2e5fa1;
}

.comparison-flavor {
  font-style: italic;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 12px 0;
}

.comparison-section {
  margin-bottom: 10px;
}

.comparison-section strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.comparison-section ul {
  margin: 4px 0 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
}

.comparison-section .highlight {
  font-weight: 600;
}

.comparison-section p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.religion-choices {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.religion-choice-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

.religion-choice-btn:hover:not(:disabled) {
  background: var(--border);
  border-color: var(--secondary);
}

.religion-choice-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.religion-choice-btn .religion-icon {
  font-size: 20px;
}

.religion-choice-btn .religion-name {
  font-weight: 600;
}

.religion-choice-btn .religion-description {
  font-size: 12px;
  color: var(--text-muted);
}

.rituals-section {
  margin-top: 20px;
}

.active-rituals, .available-rituals {
  margin: 15px 0;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

/* Religion Tab - Current Religion Display */
#currentReligionPanel {
  background: white;
  border: 1px solid var(--border);
}

#currentReligionIcon {
  font-size: 24px;
}

#currentReligionName {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
}

#faithPointsValue {
  font-weight: 600;
  color: var(--secondary);
}

/* Parish Tab - Parish Specific Styles */
.parish-info {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
}

.parish-details {
  min-height: 60px;
}

.parish-detail-item {
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.parish-detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--primary);
}

.detail-value {
  color: var(--text);
}

/* Parish Buildings */
.parish-buildings-section {
  margin-top: 20px;
}

.parish-building {
  margin-bottom: 15px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.parish-building-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.parish-building-header h4 {
  margin: 0;
  color: var(--primary);
  font-size: 16px;
}

.building-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.building-status.in_progress {
  background: #e3f2fd;
  color: #1976d2;
}

.building-status.completed {
  background: #e8f5e9;
  color: #388e3c;
}

.progress-container {
  margin: 10px 0;
}

.progress-bar {
  height: 8px;
  background: var(--secondary);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  display: block;
  text-align: right;
}

/* Animated progress bars for queue items */
.queue-item-progress {
  position: relative;
  height: 20px;
  background: var(--bg-light);
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.queue-item-progress .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--primary));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  animation: progressPulse 2s infinite;
}

.queue-item-progress .progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 12px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@keyframes progressPulse {
  0% { box-shadow: 0 0 0 0 rgba(78, 186, 255, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(78, 186, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 186, 255, 0); }
}

.queue-item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.queue-item-time {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 5px;
}

.queue-item-invalid {
  opacity: 0.6;
  position: relative;
}

.queue-item-invalid::after {
  content: "⚠️";
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--danger);
}

.building-details {
  font-size: 14px;
  color: #666;
  margin: 10px 0;
}

.building-details p {
  margin: 5px 0;
}

/* Parish Members */
.parish-members {
  margin-top: 10px;
}

.parish-member {
  padding: 12px;
  margin-bottom: 10px;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.parish-member:hover {
  background: var(--bg-light);
  border-color: var(--secondary);
}

.member-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.member-name {
  font-weight: 600;
  color: var(--primary);
}

.member-role {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--secondary);
  color: white;
}

.member-details {
  font-size: 12px;
  color: #666;
}

.member-details p {
  margin: 4px 0;
}

/* Parish Feed */
.parish-feed {
  max-height: 500px;
  overflow-y: auto;
}

.parish-feed-entry {
  padding: 12px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.parish-feed-entry:hover {
  border-color: var(--secondary);
}

.feed-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.feed-icon {
  font-size: 18px;
}

.feed-actor {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
}

.feed-time {
  margin-left: auto;
  font-size: 11px;
  color: #999;
}

.feed-entry-body {
  font-size: 13px;
  color: #444;
  margin-bottom: 8px;
  line-height: 1.4;
}

.feed-reactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.feed-reaction-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: #555;
}

.feed-react-buttons {
  display: flex;
  gap: 6px;
}

.feed-react-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-light);
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}

.feed-react-btn:hover {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

.feed-react-btn.reacted {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
  opacity: 0.8;
}

.alliance-content, .banner-content {
  min-height: 100px;
}

.estate-tab-content {
  display: none;
}

.estate-tab-content.active {
  display: block;
  animation: fadeIn 0.3s;
}

/* Tab-specific panels */
.tab-panel {
  margin-bottom: 25px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.tab-panel h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 18px;
}

/* Resource Summary Grid (legacy - removed) */

/* ===== Patch Notes Banner ===== */
.patch-notes-banner {
  padding: 0;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #2c1810, #3a2218);
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 10px;
  overflow: hidden;
}

.patch-notes-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: #e8d9b8;
  transition: background 0.15s;
}

.patch-notes-link:hover {
  background: rgba(201, 168, 76, 0.1);
}

.patch-notes-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c9a84c;
  background: rgba(201, 168, 76, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.patch-notes-message {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patch-notes-date {
  font-size: 12px;
  color: #9a8a6a;
  white-space: nowrap;
}

/* ===== Season Promo Banner ===== */
.season-promo-banner {
  display: block;
  position: relative;
  margin-bottom: 15px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(46, 134, 222, 0.4);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.season-promo-banner:hover {
  border-color: rgba(201, 162, 39, 0.6);
  box-shadow: 0 0 16px rgba(201, 162, 39, 0.15);
}

.season-promo-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.season-promo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(22, 33, 62, 0.9) 0%, rgba(22, 33, 62, 0.55) 50%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

.season-promo-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #fff;
  background: #2e86de;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.season-promo-title {
  font-size: 16px;
  font-weight: 700;
  color: #c9a227;
  white-space: nowrap;
}

.season-promo-cta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #a8b2c1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.season-promo-banner:hover .season-promo-cta {
  background: rgba(201, 162, 39, 0.15);
  color: #c9a227;
  border-color: rgba(201, 162, 39, 0.35);
}

@media (max-width: 480px) {
  .season-promo-img {
    height: 70px;
  }
  .season-promo-overlay {
    padding: 0 12px;
    gap: 8px;
  }
  .season-promo-title {
    font-size: 13px;
  }
  .season-promo-cta {
    display: none;
  }
}

/* ===== Status Report Banner ===== */
.status-report-banner {
  padding: 0;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #2a1a1a, #3a2020);
  border: 1px solid rgba(224, 85, 85, 0.35);
  border-radius: 10px;
  overflow: hidden;
}

.status-report-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  color: #e8d9b8;
  transition: background 0.15s;
}

.status-report-link:hover {
  background: rgba(224, 85, 85, 0.1);
}

.status-report-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.status-report-text {
  flex: 1;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-report-resolved {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4caf50;
  background: rgba(76, 175, 80, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.status-report-arrow {
  font-size: 14px;
  color: #9a8a6a;
  flex-shrink: 0;
}

/* ===== Banner Nudge ===== */
.banner-nudge {
  background: linear-gradient(135deg, rgba(55, 48, 30, 0.9), rgba(70, 58, 30, 0.95));
  border: 1px solid rgba(200, 170, 80, 0.35);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  gap: 12px;
}

.banner-nudge.hidden {
  display: none;
}

.banner-nudge-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.banner-nudge-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.banner-nudge-text {
  color: #d4c8a0;
  font-size: 13px;
  line-height: 1.4;
}

.banner-nudge-text strong {
  color: #f0e0a0;
}

.banner-nudge-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.banner-nudge-btn {
  background: rgba(200, 170, 80, 0.25);
  color: #f0e0a0;
  border: 1px solid rgba(200, 170, 80, 0.4);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.2s;
}

.banner-nudge-btn:hover {
  background: rgba(200, 170, 80, 0.4);
}

.banner-nudge-dismiss {
  background: none;
  border: none;
  color: #9a8a6a;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  line-height: 1;
}

.banner-nudge-dismiss:hover {
  color: #d4c8a0;
}

/* ===== Seasonal Event Panel ===== */
.seasonal-event-panel {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.9), rgba(20, 40, 70, 0.95));
  border: 1px solid rgba(100, 160, 255, 0.3);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 15px;
}

.seasonal-event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.seasonal-event-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.seasonal-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.seasonal-event-title h3 {
  margin: 0 0 2px 0;
  font-size: 15px;
  color: var(--bg-light);
  white-space: nowrap;
}

.seasonal-description {
  margin: 0;
  font-size: 12px;
  color: var(--bg-light);
  line-height: 1.4;
}

.seasonal-countdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.countdown-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-value {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}

.seasonal-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.seasonal-effect-tag {
  background: rgba(100, 160, 255, 0.15);
  border: 1px solid rgba(100, 160, 255, 0.25);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: #93c5fd;
  white-space: nowrap;
}

.seasonal-effect-tag.positive {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.seasonal-effect-tag.negative {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.seasonal-next {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.next-label {
  font-weight: 600;
  color: var(--bg-light);
}

.next-icon {
  font-size: 14px;
}

.next-name {
  color: var(--bg-light);
}

/* ===== Overview Grid: Leaderboard + Threats ===== */
.overview-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 0;
}

.overview-widget {
  display: flex;
  flex-direction: column;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.widget-header h3 {
  margin-bottom: 8px;
}

/* Attack Alert Banner */
.attack-alert-banner {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  border: 1px solid #dc2626;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  animation: alertPulse 2s ease-in-out infinite;
}

.attack-alert-banner.hidden {
  display: none;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 12px 4px rgba(220, 38, 38, 0.3); }
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fecaca;
  font-weight: 600;
}

.alert-icon {
  font-size: 20px;
}

.alert-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-retaliate {
  background: #dc2626;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.btn-retaliate:hover {
  background: #ef4444;
}

.btn-dismiss {
  background: transparent;
  color: #fca5a5;
  border: 1px solid #fca5a5;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-dismiss:hover {
  background: rgba(252, 165, 165, 0.15);
}

/* Leaderboard Widget */
.leaderboard-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lb-tab {
  background: var(--surface, #f8f9fa);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text, #333);
}

.lb-tab:hover {
  background: var(--border);
}

.lb-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface, #f8f9fa);
  border: 1px solid transparent;
  font-size: 13px;
}

.leaderboard-row.self {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  font-weight: 600;
}

.lb-rank {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}

.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.npc-badge {
  background: #6b7280;
  color: white;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.lb-score {
  font-weight: 600;
  color: var(--secondary);
  white-space: nowrap;
}

.leaderboard-self-rank {
  margin-top: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: #6b7280;
}

.leaderboard-self-rank.hidden {
  display: none;
}

/* Threats Widget */
.threats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}

.threat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface, #f8f9fa);
  border: 1px solid transparent;
}

.threat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
}

.threat-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
}

.threat-meta {
  font-size: 11px;
  color: #6b7280;
}

.threat-stolen {
  font-size: 11px;
  color: #ef4444;
}

.btn-retaliate-sm {
  background: var(--primary);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-retaliate-sm:hover {
  background: var(--secondary);
}

/* Bandits in Threats Widget */
.bandits-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bandits-divider {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  padding: 6px 0 2px;
  border-top: 1px solid var(--border, #e5e7eb);
  margin-top: 4px;
}

.bandit-row {
  border-left: 3px solid #f39c12;
}

.bandit-size-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
}

.bandit-local-tag {
  font-size: 10px;
  font-weight: 600;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}

.btn-bandit-attack-sm {
  background: #d97706;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-bandit-attack-sm:hover {
  background: #b45309;
}

/* Building Controls */
.building-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.building-controls select,
.building-controls input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 14px;
}

.building-controls button {
  padding: 8px 16px;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
}

/* Building Cost Display */
.building-cost-display {
  background: white;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 15px;
}

.resource-costs {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Unit Training Controls */
.unit-training-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

/* Army Stats Display */
.army-stats-section {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.army-stats-section h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.stat-card {
  background: var(--bg-light);
  padding: 12px;
  border-radius: 6px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: #666;
  display: block;
  margin-bottom: 5px;
}

.stat-value {
  font-weight: 600;
  color: var(--primary);
  font-size: 18px;
}

.stat-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.stat-offensive {
  color: #d32f2f;
}

.stat-defensive {
  color: #388e3c;
}

.stat-speed {
  color: #1976d2;
}

/* Unit Details Display */
.unit-details-section {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.unit-details-section h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 18px;
}

.unit-detail-item {
  padding: 10px;
  margin-bottom: 10px;
  background: var(--bg-light);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.unit-info {
  flex: 1;
}

.unit-info strong {
  color: var(--primary);
}

.unit-stats {
  display: flex;
  gap: 15px;
}

.unit-stats .stat {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Garrison Summary */
.garrison-summary-section {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.combat-guide-link {
  text-align: center;
  margin: 12px 0 4px;
  font-size: 13px;
}

.combat-guide-link a {
  color: #d4af37;
  text-decoration: none;
}

.combat-guide-link a:hover {
  text-decoration: underline;
}

.garrison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.garrison-header h4 {
  margin: 0;
  color: var(--primary);
}

.total-garrison {
  font-weight: 600;
  color: var(--secondary);
}

.location-garrisons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.location-garrison {
  padding: 12px;
  background: var(--bg-light);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.location-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.location-info strong {
  color: var(--primary);
}

.unit-count {
  font-weight: 600;
  color: var(--secondary);
}

.unit-breakdown {
  font-size: 12px;
  color: #666;
}

.unit-type {
  margin-right: 10px;
}

/* Unit Training Controls */
.unit-training-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.unit-training-controls select,
.unit-training-controls input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 14px;
}

/* Parish Buildings */
.parish-buildings-section {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.parish-buildings-section h3 {
  color: var(--primary);
  margin-bottom: 15px;
  font-size: 18px;
}

.parish-building {
  margin-bottom: 15px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.parish-building-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.parish-building-header h4 {
  margin: 0;
  color: var(--primary);
  font-size: 16px;
}

.building-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.building-status.in_progress {
  background: #e3f2fd;
  color: #1976d2;
}

.building-status.completed {
  background: #e8f5e9;
  color: #388e3c;
}

.progress-container {
  margin: 10px 0;
}

.progress-bar {
  height: 8px;
  background: var(--secondary);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-text {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  display: block;
  text-align: right;
}

.building-details {
  font-size: 14px;
  color: #666;
  margin: 10px 0;
}

.building-details p {
  margin: 5px 0;
}

.contribute-btn {
  width: 100%;
  padding: 8px;
  margin-top: 10px;
}

/* Building Slots Grid */
.building-slots-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.building-slot {
  aspect-ratio: 1;
  background: white;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.building-slot:hover {
  border-color: var(--secondary);
  background: #f0f8ff;
}

.building-slot.occupied {
  background: #e8f5e9;
  border-color: #4caf50;
}

.building-slot.available {
  background: #fff3e0;
  border-color: #ff9800;
}

/* Action Log */
.action-log-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border-radius: 6px;
}

.activity-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-item:hover {
  background: #f5f5f5;
}

.activity-time {
  color: #666;
  font-size: 12px;
  margin-right: 10px;
}

.activity-message {
  flex: 1;
  color: #333;
}

.loading-state, .empty-state, .error-state {
  padding: 15px;
  text-align: center;
  color: #666;
  font-style: italic;
}

.loading-state::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.error-state {
  color: #d32f2f;
}

.empty-state {
  color: #757575;
}

/* Activity Log Panel */
#actionLogOverview {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--border);
}

#viewAllActivityBtn {
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
}

#viewAllActivityBtn:hover {
  background: #1976d2;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .estate-tabs {
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    /* Scroll indicator: fade gradient on right edge */
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    scrollbar-width: none;  /* Firefox */
  }
  .estate-tabs::-webkit-scrollbar {
    display: none;
  }

  .estate-tab {
    padding: 8px 12px;
    font-size: 14px;
    white-space: nowrap;
  }

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

  .overview-grid-row {
    grid-template-columns: 1fr;
  }

  .leaderboard-tabs {
    gap: 3px;
  }

  .attack-alert-banner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .building-slots-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Building catalog mobile fixes */
  .building-card {
    padding: 10px 12px;
  }

  .building-card-icon {
    font-size: 22px;
    width: 30px;
  }

  .building-card-name {
    font-size: 14px;
  }

  .building-card-desc {
    font-size: 12px;
  }

  .building-detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .building-detail-value {
    word-break: break-word;
  }

  .building-catalog-upgrade {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-catalog-upgrade {
    width: 100%;
    text-align: center;
  }

  .legendary-perk-grid {
    grid-template-columns: 1fr;
  }
}

/* Build Completion Notification */
.build-completion-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: var(--secondary);
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: 600;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Autocomplete Styles */
.autocomplete-dropdown {
  position: absolute;
  z-index: 1000;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background-color: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-top: 2px;
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.autocomplete-item:hover, .autocomplete-item.autocomplete-active {
  background-color: var(--border);
}

/* Queue item animations */
.queue-item, .training-item {
  transition: all 0.3s ease;
  opacity: 1;
}

.queue-item.completed, .training-item.completed {
  opacity: 0.7;
  transform: translateY(-5px);
  background-color: #f0f8ff;
  border-left: 3px solid #4CAF50;
}

/* Progress bar smooth animation */
.progress-fill, .progress-bar {
  transition: width 0.3s ease-out;
}

/* Notification styles */
.build-completion-notification, .training-completion-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-out 2.7s forwards;
  font-weight: 500;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ============================================
   SETTINGS TAB
   ============================================ */

.settings-section {
  margin-bottom: 30px;
}

.settings-section h4 {
  color: var(--primary);
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 15px;
  gap: 20px;
}

.setting-info {
  flex: 1;
}

.setting-label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  color: var(--text);
}

.setting-description {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.setting-control {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-message {
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 15px;
  font-size: 14px;
}

.settings-message.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.settings-message.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Title Select */
.title-select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  min-width: 180px;
  transition: border-color 0.3s;
}

.title-select:hover {
  border-color: var(--primary);
}

.title-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.15);
}

/* Responsive Settings */
@media (max-width: 768px) {
  .setting-item {
    flex-direction: column;
    gap: 15px;
  }
  
  .setting-control {
    align-self: flex-start;
  }
}

/* Banner Settings */
.banner-picker {
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 15px;
}

.banner-picker .setting-label {
  margin-bottom: 12px;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.banner-grid-item {
  position: relative;
  border: 3px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  aspect-ratio: 4 / 3;
}

.banner-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-grid-item:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.banner-grid-item.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.banner-preview {
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 15px;
}

.banner-preview .setting-label {
  margin-bottom: 12px;
}

.banner-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px;
  background: #2c3e50;
  border-radius: 6px;
  min-height: 100px;
}

.banner-preview-flag {
  width: 48px;
  height: 96px;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.banner-preview-flag .banner-preview-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-preview-flag .banner-preview-border {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.banner-preview-pole {
  width: 3px;
  height: 30px;
  background: #8B7355;
  border-radius: 1px;
}

.banner-preview-label {
  color: #bdc3c7;
  font-size: 12px;
  margin-top: 4px;
}

.preview-no-banner {
  color: #7f8c8d;
  font-style: italic;
  padding: 30px 0;
}

@media (max-width: 768px) {
  .banner-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
}

/* ====================================
   Estate Tier Styles
   ==================================== */

.tier-info-display {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tier-current {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border: 2px solid #dee2e6;
}

.tier-icon {
  font-size: 48px;
  line-height: 1;
}

.tier-details h4 {
  margin: 0 0 5px 0;
  font-size: 20px;
  color: #333;
}

.tier-details p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.tier-upgrade-panel {
  padding: 20px;
  background: #fff;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
}

.tier-upgrade-panel h4 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #2c5282;
}

.tier-description {
  margin: 0 0 15px 0;
  font-size: 14px;
  color: #666;
  font-style: italic;
}

.tier-upgrade-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.tier-cost-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  font-size: 14px;
}

.tier-cost-item.affordable {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.tier-cost-item.insufficient {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.tier-cost-item .icon {
  font-size: 18px;
}

.tier-cost-item .cost {
  font-weight: 600;
}

.tier-upgrade-progress {
  margin: 15px 0;
  padding: 15px;
  background: #e7f3ff;
  border-radius: 8px;
  border: 1px solid #b3d9ff;
}

.progress-bar {
  width: 100%;
  height: 24px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dee2e6;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4299e1 0%, #2b6cb0 100%);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.progress-text {
  margin: 0 0 5px 0;
  font-size: 14px;
  font-weight: 600;
  color: #2c5282;
}

.progress-eta {
  margin: 0;
  font-size: 13px;
  color: #666;
}

#upgradeTierBtn {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
}

#upgradeTierBtn:disabled {
  background: #dee2e6;
  color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tier-upgrade-costs {
    flex-direction: column;
  }
  
  .tier-current {
    flex-direction: column;
    text-align: center;
  }
}

/* ====================================
   Estate Canvas Styles
   ==================================== */

.canvas-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#buildingsCanvas {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  height: auto;
  cursor: default;
  touch-action: pan-x pan-y pinch-zoom;
}

.canvas-unsupported {
  padding: 40px 20px;
  text-align: center;
  color: #ef4444;
  background: #fef2f2;
  border: 2px dashed #f87171;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
}

/* Building Type Cards in Modal */
.building-type-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px;
}

.building-card {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.building-card:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.building-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.building-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: #1f2937;
}

.building-cost {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 5px;
  line-height: 1.4;
}

.building-time {
  font-size: 12px;
  color: #3b82f6;
  font-weight: 600;
}

/* Worker Assignment Slider */
.worker-assignment {
  margin: 20px 0;
  padding: 15px;
  background: #f9fafb;
  border-radius: 8px;
}

.worker-assignment label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1f2937;
}

.worker-assignment input[type="range"] {
  width: 100%;
  margin: 10px 0;
}

#workerCount {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-weight: 600;
  color: #3b82f6;
  margin-left: 10px;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Responsive Canvas */
@media (max-width: 1300px) {
  #buildingsCanvas {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 768px) {
  .building-type-cards {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  
  .building-card {
    padding: 10px;
  }
  
  .building-icon {
    font-size: 28px;
  }
  
  .building-name {
    font-size: 12px;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions button {
    width: 100%;
  }
}

/* ─── Roads & Paths Section ───────────────────────────────────────────── */

.parish-roads-section {
  margin-top: 10px;
}

.parish-roads {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.road-card {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.road-card-road {
  border-left: 3px solid #2e7d32;
  background: #f1f8e9;
}

.road-card-path {
  border-left: 3px solid #757575;
}

.road-card-constructing {
  border-left: 3px solid #1565c0;
  background: #e3f2fd;
}

.road-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

.road-type-badge {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.road-destination {
  font-size: 13px;
  color: var(--text-secondary);
}

.road-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.road-stat {
  display: flex;
  align-items: center;
  gap: 3px;
}

.road-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 4px;
}

.road-status.road-constructing {
  background: #bbdefb;
  color: #0d47a1;
}

.road-status.road-active {
  background: #c8e6c9;
  color: #1b5e20;
}

.road-time {
  margin-left: auto;
  font-weight: 600;
  font-size: 12px;
}

.road-upgrade-form {
  margin-top: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}

.road-cost-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.road-discount-badge {
  color: #4caf50;
  font-weight: 600;
  font-size: 11px;
}

.road-expert-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}

.road-expert-row label {
  font-weight: 600;
  min-width: 65px;
}

.road-expert-select {
  flex: 1;
  min-width: 180px;
  max-width: 340px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-light, #fff);
  color: var(--text-primary);
  cursor: pointer;
}

.road-expert-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 58, 109, 61), 0.15);
}

.road-time-estimate {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.road-upgrade-btn {
  width: 100%;
  padding: 8px;
  font-size: 13px;
}

.road-upgrade-blocked {
  margin-top: 6px;
  font-size: 12px;
  color: #b71c1c;
  padding: 6px 10px;
  background: #ffebee;
  border-radius: 6px;
}

/* ============================================
   MOBILE OVERRIDES (≤768px)
   ============================================ */
@media (max-width: 768px) {

  /* Content container */
  .estate-tab-content-container {
    padding: 10px;
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
  }

  /* Canvas scales down */
  .canvas-container {
    gap: 6px;
  }

  #buildingsCanvas {
    width: 100%;
    height: auto;
    border-radius: 6px;
  }

  /* Tab panels */
  .tab-panel {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 6px;
  }

  /* Trade sub-tabs */
  .trade-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
  }

  .trade-tabs::-webkit-scrollbar {
    display: none;
  }

  .trade-tab {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 40px;
  }

  /* Resource summary grid */
  .resource-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* Overview grid */
  .overview-grid-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Building cards — compact grid */
  .building-type-cards {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .building-card {
    padding: 8px;
  }

  .building-icon {
    font-size: 24px;
  }

  .building-name {
    font-size: 11px;
  }

  /* Building slots grid */
  .building-slots-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  /* Combat / Army */
  .army-grid {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .unit-card {
    padding: 10px;
    flex-wrap: wrap;
    overflow: hidden;
    max-width: 100%;
  }

  .unit-card .card-image {
    width: 48px;
    height: 48px;
  }

  .unit-card .card-content {
    flex: 1;
    min-width: 0;
  }

  .unit-actions {
    width: 100%;
    margin-top: 4px;
  }

  .unit-actions .dismiss-btn {
    width: 100%;
    min-height: 40px;
  }

  .attack-alert-banner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    font-size: 0.85rem;
  }

  /* Leaderboard */
  .leaderboard-tabs {
    gap: 3px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .lb-tab {
    font-size: 12px;
    padding: 6px 8px;
    white-space: nowrap;
  }

  /* Modal actions stacked */
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }

  .modal-actions button {
    width: 100%;
    min-height: 44px;
  }

  /* Seasonal event */
  .seasonal-event-header {
    flex-direction: column;
    gap: 6px;
  }

  .seasonal-event-title {
    font-size: 0.9rem;
  }

  /* Settings */
  .settings-grid {
    grid-template-columns: 1fr;
  }

  /* Tier upgrade costs */
  .tier-upgrade-costs {
    flex-direction: column;
  }

  /* Roads */
  .road-card-header {
    flex-direction: column;
    gap: 4px;
  }

  .road-card-stats {
    flex-wrap: wrap;
    gap: 6px;
  }

  .road-expert-row {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }

  .road-expert-select {
    max-width: 100%;
    min-width: auto;
  }

  /* Hide inactive tab content */
  .estate-tab-content:not(.active) {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Garrison Food Supply — Wheat Bar & Starvation Indicators
   ═══════════════════════════════════════════════════════════════ */

.fort-wheat-section {
  margin: 12px 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.fort-wheat-section.fort-starving {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
  animation: fort-starve-pulse 1.5s ease-in-out infinite;
}

@keyframes fort-starve-pulse {
  0%, 100% { border-color: #e74c3c; }
  50% { border-color: #c0392b; box-shadow: 0 0 8px rgba(231, 76, 60, 0.4); }
}

.fort-wheat-bar-container {
  width: 100%;
  height: 14px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 7px;
  overflow: hidden;
  margin: 6px 0;
}

.fort-wheat-bar {
  height: 100%;
  border-radius: 7px;
  transition: width 0.5s ease, background 0.5s ease;
}

.fort-wheat-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.fort-wheat-rate {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 2px;
}

.fort-wheat-eta {
  font-size: 12px;
  color: #f39c12;
  text-align: center;
  margin-top: 2px;
}

.fort-starving-warning {
  color: #e74c3c;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  margin-top: 6px;
  animation: fort-starve-text-blink 1s ease-in-out infinite;
}

@keyframes fort-starve-text-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.fort-auto-supply-badge {
  font-size: 12px;
  color: #27ae60;
  text-align: center;
  margin-top: 4px;
}

.fort-auto-supply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin-left: 8px;
}

.fort-auto-supply-toggle input[type="checkbox"] {
  cursor: pointer;
}

.auto-supply-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0;
  width: 100%;
}

.auto-supply-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.auto-supply-slider-row label {
  white-space: nowrap;
  min-width: 100px;
}

.auto-supply-slider-row input[type="range"] {
  flex: 1;
  min-width: 80px;
  cursor: pointer;
  accent-color: #27ae60;
}

.fort-supply-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.fort-supply-input-row .input-field {
  width: 120px;
}

/* Starvation indicator on map icon */
.fort-starve-indicator {
  animation: fort-starve-text-blink 1s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════
   Fortification Upgrade Section
   ═══════════════════════════════════════════════════════════════ */

.fort-upgrade-section {
  margin: 12px 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.fort-upgrade-section h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.fort-level-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.fort-level-badge {
  background: #2c3e50;
  color: #f1c40f;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 13px;
}

.fort-level-effect {
  font-size: 12px;
  color: var(--text-secondary);
}

.fort-upgrade-in-progress {
  color: #d4880f;
  font-size: 13px;
  font-weight: bold;
  padding: 4px 0;
}

.fort-upgrade-next {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.fort-upgrade-label {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
}

.fort-upgrade-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
}

.fort-cost-item {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: capitalize;
}

.fort-upgrade-effects {
  font-size: 12px;
  color: #27ae60;
  margin: 4px 0;
}

.fort-upgrade-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 8px 0;
}

.fort-upgrade-hint {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 4px;
}

.fort-max-level {
  font-size: 13px;
  color: #27ae60;
  font-weight: bold;
  margin-top: 4px;
}

/* ─── Daily Objectives ──────────────────────────────────────────────── */

.daily-objectives-panel {
  margin-bottom: 16px;
}

.daily-objectives-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.daily-objectives-header h3 {
  margin: 0;
  font-size: 16px;
}

.daily-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

.streak-icon {
  font-size: 16px;
}

.streak-count {
  font-weight: 700;
  color: #e67e22;
}

.daily-objectives-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-objective {
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s;
}

.daily-objective.completed {
  border-color: #27ae60;
  background: #f0faf4;
}

.objective-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.objective-tier {
  font-size: 10px;
  letter-spacing: -2px;
}

.objective-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.objective-reward {
  font-size: 12px;
  color: #8b6914;
  font-weight: 600;
}

.objective-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.objective-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.objective-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.objective-bar-fill {
  height: 100%;
  background: #3498db;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.daily-objective.completed .objective-bar-fill {
  background: #27ae60;
}

.objective-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

.daily-objective.completed .objective-count {
  color: #27ae60;
}

.daily-objectives-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.daily-bonus {
  display: flex;
  gap: 4px;
}

.daily-bonus.claimed .bonus-value {
  color: #27ae60;
  text-decoration: line-through;
}

.bonus-value {
  font-weight: 600;
  color: #8b6914;
}

.daily-reset {
  display: flex;
  gap: 4px;
}

.reset-value {
  font-weight: 600;
}

/* ── Parish Buildings Collapsible ─────────────────────────────────────── */

.parish-buildings-collapsible {
  padding-top: 0;
}

.parish-buildings-collapse-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border-radius: 4px;
  transition: background 0.15s;
  min-height: 44px;
}

.parish-buildings-collapse-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.collapse-chevron {
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.parish-buildings-collapse-btn[data-expanded="false"] .collapse-chevron {
  transform: rotate(-90deg);
}

#parishBuildings {
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 2000px;
}

#parishBuildings.collapsed {
  max-height: 0;
}

/* Canvas bottom padding when city toolbar is present (toolbar is abs bottom:0) */
@media (max-width: 768px) {
  .canvas-container.has-city-toolbar {
    padding-bottom: 40vh;
  }
}
