/* MAPU App — aigenkapital.com Theme */
:root {
  --primary: #13607E;
  --secondary: #1F4F70;
  --fg: #292929;
  --bg: #faf7f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --radius: 0.75rem;
  --bull: #16a34a;
  --bear: #dc2626;
  --neutral: #9ca3af;
  --leicht-bull: #ca8a04;
  --leicht-bear: #ea580c;
  --font-head: 'Jost', system-ui, sans-serif;
  --font-body: 'Hind', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

/* Nav */
nav {
  background: var(--primary);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
nav .logo {
  font-family: var(--font-head);
  font-weight: 700;
  color: white;
  font-size: 1.1rem;
  text-decoration: none;
  flex: 1;
}
nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.4rem;
  transition: all 0.15s;
}
nav a:hover, nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}
nav .regime-badge {
  font-size: 0.8rem;
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Layout */
main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.page-title {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 1.5rem;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.card-value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.card-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Score ring */
.score-ring {
  width: 120px;
  height: 120px;
  position: relative;
  margin: 0 auto;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
}
.score-ring .score-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}
.score-ring .score-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* Regime card */
.regime-card {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.regime-name {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 700;
}
.regime-sub { font-size: 0.85rem; opacity: 0.8; margin-top: 0.25rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(19,96,126,0.04); }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Stance badges */
.stance {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.stance-bull { background: #dcfce7; color: #15803d; }
.stance-bear { background: #fee2e2; color: #b91c1c; }
.stance-neutral { background: #f3f4f6; color: #6b7280; }

/* Signal dots */
.dot { font-size: 1.1rem; line-height: 1; }

/* Filters */
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--fg);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
input[type="text"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  width: 100%;
  max-width: 320px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--primary); }

/* Axis bars */
.axis-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.axis-label { font-size: 0.75rem; color: var(--muted); width: 80px; flex-shrink: 0; }
.axis-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.axis-fill { height: 100%; border-radius: 999px; transition: width 0.5s; }
.axis-val { font-size: 0.75rem; font-weight: 600; width: 30px; text-align: right; }

/* CB Calendar */
.meeting-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.meeting-item:last-child { border-bottom: none; }
.meeting-bank {
  font-weight: 700;
  color: var(--primary);
  width: 48px;
}
.meeting-days {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.msg {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 0.25rem;
}
.msg-ai {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
}
.chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.chat-input input { flex: 1; }
.btn {
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.btn:hover { background: var(--secondary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}
.login-card {
  background: white;
  border-radius: 1.5rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 0.5rem;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
.login-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.login-card input {
  max-width: 100%;
  margin-bottom: 1rem;
}
.login-card .btn { width: 100%; padding: 0.75rem; font-size: 1rem; }
.error-msg { color: #dc2626; font-size: 0.85rem; text-align: center; margin-top: 0.5rem; }

/* Divider section */
.section { margin-bottom: 1.5rem; }
.section-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Drill-down modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--card);
  border-radius: 1.5rem 1.5rem 0 0;
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

/* Loading */
.loading { text-align: center; padding: 2rem; color: var(--muted); }
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #e5e7eb 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.25rem;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Responsive */
@media (max-width: 640px) {
  main { padding: 1rem; }
  .regime-card { flex-direction: column; text-align: center; }
  nav { gap: 1rem; }
  nav a { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
}
