:root {
  --bg: #0b0f14;
  --card: #121822;
  --muted: #1b2432;
  --text: #e6edf3;
  --text-dim: #b6c2cf;
  --good: #22c55e;
  --bad: #ef4444;
  --accent: #22c55e;
  --border: #2a3443;
  --header-bg: rgba(11, 15, 20, 0.95);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Ubuntu,
    Cantarell,
    Noto Sans,
    Helvetica,
    Arial;
  background: linear-gradient(180deg, #0b0f14 0%, #0e131a 100%);
  color: var(--text);
  line-height: 1.5;
}

/* Header redesign - cleaner, more organized */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.1) blur(8px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  /* Much more compact */
}

.header-main {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  /* Reduced from 12px */
}

.header-main h1 {
  font-size: clamp(20px, 3vw, 28px);
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--accent), #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Game Status Bar */
.game-status-bar {
  display: flex;
  justify-content: center;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.game-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.game-status.saved {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.game-status.unsaved {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  animation: pulse-warning 2s infinite;
}

.game-status.pending {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.game-status.new-game {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

@keyframes pulse-warning {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Slot Selection Grid */
.slot-selection-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.slot-selection-btn {
  padding: 15px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 14px;
}

.slot-selection-btn:hover {
  background: var(--muted);
  border-color: var(--accent);
}

.slot-selection-btn.empty {
  color: var(--text-dim);
  font-style: italic;
}

.slot-selection-btn .slot-header {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.slot-selection-btn .slot-details {
  font-size: 12px;
  color: var(--text-dim);
}

.slot-selection-btn.current-slot {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: 0 0 0 1px var(--accent);
}

.slot-selection-btn.current-slot .slot-header {
  color: var(--accent);
}

.slot-selection-btn.current-slot .slot-header::after {
  content: " (Current)";
  font-weight: normal;
  font-size: 12px;
  opacity: 0.8;
}

/* Core stats - prominently displayed */
.core-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

/* Enhanced grid layout */
.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(16px, 3vw, 24px);
  align-items: start;
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Card improvements */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h2 {
  font-size: 16px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--muted), var(--card));
  font-weight: 600;
}

.card .content {
  padding: clamp(12px, 2vw, 20px);
}

/* Enhanced pill design */
.pill {
  background: linear-gradient(135deg, var(--muted), var(--card));
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-dim);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.pill strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pill.danger {
  background: linear-gradient(135deg, #2a1919, #1d1212);
  border-color: #512626;
  color: #ffb3b3;
}

.pill.danger strong {
  color: #ffe2e2;
}

.pill.success {
  background: linear-gradient(135deg, #1a2a1d, #131e17);
  border-color: #2c3e29;
  color: #d9ffe5;
}

.pill.success strong {
  color: var(--good);
}

/* New Stats Layout */
.stats-section {
  border-top: 1px solid var(--border);
  background: var(--card);
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

.stats-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.stats-collapse-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.stats-collapse-btn:hover {
  background: var(--border);
  color: var(--text);
}

.collapse-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.stats-section.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.stats-section.collapsed .stats-container {
  display: none;
}

.stats-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  margin-bottom: 0;
  /* Remove bottom margin */
}

.stats-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.stats-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.stats-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

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

.stats-card-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  padding: 6px;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: background-color 0.2s ease;
}

.stat-item:hover {
  background: var(--muted);
}

.stat-item.highlight {
  background: var(--success-bg);
  border: 1px solid var(--success);
}

.stat-item.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--bad);
}

.stat-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.stat-item.highlight .stat-value {
  color: var(--good);
}

.stat-item.danger .stat-value {
  color: var(--bad);
}

/* Responsive adjustments for new stats */
/* Responsive adjustments for new stats */
@media (min-width: 769px) {
  .stats-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

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

@media (min-width: 1200px) {
  .stats-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-section.collapsed .stats-container {
    display: none;
  }

  .stats-header {
    padding: 6px 12px;
  }

  .stats-container {
    padding: 8px;
    gap: 8px;
  }
}

/* Slots section - cleaner */
.slots {
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.slot-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Enhanced button design */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #18202b, #121822);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  font-size: 14px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  border-color: #2c3e29;
  background: linear-gradient(135deg, #1a2a1d, #131e17);
  color: #d9ffe5;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.btn.primary:hover {
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.btn.danger {
  border-color: #442222;
  background: linear-gradient(135deg, #2a1919, #1d1212);
  color: #ffd9d9;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
}

/* Enhanced tabs */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--muted);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s ease;
  font-weight: 500;
  flex: 1;
  text-align: center;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.tab.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
}

/* Enhanced table design */
.table-wrap {
  margin-top: 16px;
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #243041;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #101520, #0f1419);
  z-index: 2;
  text-align: left;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  padding: 12px 8px;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

tbody td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 13px;
  line-height: 1.4;
  height: auto;
  box-sizing: border-box;
}

tbody tr {
  transition: background-color 0.2s ease;
  min-height: 48px;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.asset {
  line-height: 1.4;
}

.asset strong {
  display: block;
  line-height: 1.4;
  margin: 0;
}

.asset small {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  display: block;
  margin: 0;
}

.delta {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.4;
}

.delta.pos {
  color: var(--good);
}

.delta.neg {
  color: var(--bad);
}

.qty-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.2s ease;
}

.qty-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.actions {
  max-width: 280px;
}

.action-grid {
  border-collapse: separate;
  border-spacing: 2px;
  width: 100%;
}

.action-grid td {
  padding: 0;
  border: none;
  width: 50%;
}

.actions .btn {
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  min-width: auto;
  width: 100%;
  display: block;
}

/* Compact action layout for real estate */
.actions-real-estate {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  max-width: 160px;
}

.actions-real-estate .btn {
  padding: 3px 6px;
  font-size: 10px;
  text-align: center;
}

/* Primary actions (more prominent) */
.actions .btn.primary-action {
  background: linear-gradient(135deg, var(--accent), #16a34a);
  color: white;
  font-weight: 600;
}

.actions .btn.primary-action:hover {
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Sell buttons (red) */
.actions .btn[data-action='sell'] {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  font-weight: 600;
}

.actions .btn[data-action='sell']:hover {
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* Secondary actions (lighter tints) */
.actions .btn[data-action='buy-max'] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(22, 163, 74, 0.3));
  color: var(--text);
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.actions .btn[data-action='sell-max'] {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.3), rgba(185, 28, 28, 0.3));
  color: var(--text);
  border: 1px solid rgba(220, 38, 38, 0.5);
}

/* Enhanced news and status */
.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  background: linear-gradient(135deg, var(--muted), var(--card));
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.news-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.news-item .tag {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
  opacity: 0.8;
  margin-right: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Status message container */
.status-message-container {
  margin: 12px 0;
  position: relative;
}

.status {
  min-height: 24px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--card-bg), var(--muted));
  border-radius: 8px;
  border: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
}

.status:not(:empty) {
  opacity: 1;
  visibility: visible;
  max-height: 200px;
  margin-bottom: 8px;
}

.status::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--primary);
  transition: background-color 0.3s ease;
}

.foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

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

/* Enhanced charts */
.charts {
  display: grid;
  gap: 20px;
}

canvas {
  width: 100%;
  height: 180px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

/* P&L improvements */
.pl-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.pl-card {
  background: linear-gradient(135deg, var(--muted), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.pl-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 4px 0;
}

.pl-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.news-title {
  margin: 20px 0 12px;
  color: var(--text);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
}

/* Enhanced Modal Design */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal__dialog {
  position: relative;
  width: min(800px, 95vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--muted), var(--card));
}

.modal__header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal__body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal__body::-webkit-scrollbar {
  width: 8px;
}

.modal__body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.modal__body::-webkit-scrollbar-thumb {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.modal__body::-webkit-scrollbar-thumb:hover {
  background: #243041;
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--muted);
}

/* Form elements in modals */
.modal__body label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(135deg, var(--muted), var(--card));
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
}

.modal__body label:hover {
  border-color: var(--accent);
}

.modal__body input,
.modal__body select {
  width: 180px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0f1620;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.modal__body input:focus,
.modal__body select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Career modal improvements */
#careerJobsList,
#educationList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.career-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  background: var(--muted);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.career-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.career-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.career-tab.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.career-pane {
  display: none;
}

.career-pane.active {
  display: block;
}

/* Budget tabs */
.budget-tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.budget-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.budget-tab.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.budget-pane {
  display: none;
}

.budget-pane.active {
  display: block;
}

/* Financial Reports Tabs */
.financial-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-dim);
}

.financial-tab:hover {
  background: rgba(230, 237, 243, 0.05);
  color: var(--text);
}

.financial-tab.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.financial-pane {
  display: none;
}

.financial-pane.active {
  display: block;
}

/* Insurance flag improvements */
.ins-flag {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--muted), var(--card));
  color: var(--text-dim);
  transition: all 0.2s ease;
}

.ins-flag input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.ins-flag.on {
  background: linear-gradient(135deg, #1a2a1d, #131e17);
  color: var(--good);
  border-color: #2c3e29;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.ins-flag:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

/* Statements styling */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.stat-card {
  background: linear-gradient(135deg, var(--muted), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-card h5 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Loading states and micro-interactions */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

.slide-in {
  animation: slideInRight 0.3s ease-out;
}

/* Enhanced status messages */
.status {
  animation: slideInDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.status.success::before {
  background: var(--good);
}

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

.status.success {
  border-color: rgba(34, 197, 94, 0.3);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), var(--card-bg));
  color: var(--good);
}

.status.error {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), var(--card-bg));
  color: var(--bad);
}

/* Hover effects for interactive elements */
.pill:hover {
  cursor: default;
}

.pill[title]:hover {
  cursor: help;
}

/* Enhanced button hierarchy */
.btn.secondary {
  background: var(--muted);
  border-color: var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 14px;
}

.btn.secondary:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--border);
}

/* Compact button variant for toolbars */
.btn.compact {
  padding: 6px 10px;
  font-size: 12px;
  min-height: auto;
}

/* Dropdown menu styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 200px;
  padding: 8px 0;
  margin-top: 4px;
  backdrop-filter: blur(8px);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown.active .dropdown-content {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: left;
  gap: 8px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.danger {
  color: var(--bad);
}

.dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.dropdown-section {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.02);
  margin: 0 8px 8px;
  border-radius: var(--radius-sm);
}

.dropdown-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-select {
  width: 100%;
  padding: 6px 8px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.dropdown-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

/* Close dropdown when clicking outside */
.dropdown-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
}

/* Action button groups */
.btn-group {
  display: flex;
  gap: 4px;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.btn-group .btn:not(:last-child) {
  border-right: none;
}

/* Pill variants for better semantic meaning */
.pill.info {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), var(--muted));
  border-color: rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
}

.pill.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), var(--muted));
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

/* Better visual hierarchy in cards */
.card-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.card-section:last-child {
  border-bottom: none;
}

.card-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Improved header layout spacing */
.header-main {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

/* Better visual separation */
.core-stats {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.secondary-stats {
  background: rgba(255, 255, 255, 0.01);
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Better table alternating rows */
tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(34, 197, 94, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Improved scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--muted), var(--border));
  border-radius: 4px;
  border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #243041, var(--muted));
}

/* Selection styling */
::selection {
  background: rgba(34, 197, 94, 0.2);
  color: var(--text);
}

/* Better transitions */
* {
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

/* Improved accessibility */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border: #ffffff;
    --text-dim: #cccccc;
  }

  .btn {
    border-width: 2px;
  }

  .pill {
    border-width: 2px;
  }
}

/* News item enhancements */
.news-item.important {
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), var(--muted));
}

.news-item.warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), var(--muted));
}

.news-item.negative {
  border-left: 4px solid var(--bad);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), var(--muted));
}

/* Better focus states */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Print styles */
@media print {
  header {
    position: static;
  }

  .btn,
  .modal {
    display: none !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Responsive improvements */
@media (max-width: 768px) {
  .wrap {
    padding: 12px;
  }

  .card h2 {
    padding: 12px 16px;
    font-size: 14px;
  }

  .card .content {
    padding: 16px;
  }

  .modal__dialog {
    width: 95vw;
    margin: 10px;
  }

  .modal__header {
    padding: 16px;
  }

  .modal__body {
    padding: 16px;
  }

  .modal__footer {
    padding: 12px 16px;
  }

  .table-wrap {
    font-size: 12px;
  }

  tbody td {
    padding: 6px;
  }

  thead th {
    padding: 10px 6px;
  }

  .actions {
    max-width: 200px;
  }

  .actions-real-estate {
    grid-template-columns: repeat(3, 1fr);
    max-width: 140px;
  }

  .actions .btn {
    padding: 3px 5px;
    font-size: 10px;
  }

  .actions-real-estate .btn {
    padding: 2px 4px;
    font-size: 9px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 13px;
  }

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

  .charts {
    gap: 16px;
  }

  canvas {
    height: 150px;
  }

  .core-stats {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
  }

  .secondary-stats {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  /* Status messages responsive styling */
  .status-message-container {
    margin: 8px 0;
  }

  .status {
    padding: 12px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .header-main {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .game-status-bar {
    padding: 4px 8px;
  }

  .game-status {
    font-size: 11px;
    padding: 3px 8px;
  }

  .dropdown-content {
    right: auto;
    left: 0;
    min-width: 180px;
  }

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

  .pill {
    padding: 8px 12px;
    font-size: 12px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .modal__dialog {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }
}

/* Statements */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.stat-card h5 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.stat-row strong {
  font-variant-numeric: tabular-nums;
}

/* Reset modal styling */
.reset-difficulty-btn {
  justify-content: flex-start;
  text-align: left;
  transition: all 0.2s ease;
  border: 2px solid var(--border);
}

.reset-difficulty-btn:hover {
  border-color: var(--primary);
  background: var(--light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}