:root {
  --bg: #0b111b;
  --surface: #121b2b;
  --surface-2: #192438;
  --border: #25344f;
  --text: #e6edf7;
  --muted: #93a4bf;
  --accent: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #3b82f6);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.7);
}
h1 { margin: 0; font-size: 1.2rem; }
h2 { margin: 0 0 0.25rem 0; font-size: 1.05rem; }
h3 { margin: 0 0 0.5rem 0; font-size: 0.95rem; }
.subtitle { margin: 0; font-size: 0.8rem; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  padding: 1rem 1.5rem 0.5rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.kpi-label { font-size: 0.78rem; color: var(--muted); }
.kpi-val { font-size: 1.3rem; }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  padding: 0.6rem 1rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

main { padding: 1.2rem 1.5rem 2.5rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.muted { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0; }

.btn {
  border: none;
  border-radius: 7px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.76rem; }
.btn:disabled { opacity: 0.5; cursor: wait; }

.pill {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
}
.pill-green { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.pill-amber { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.pill-red { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.pill-neutral { background: rgba(147, 164, 191, 0.16); color: #cbd5e1; }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
th, td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.sectors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
}
.card, .learning-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.learning-banner { margin-bottom: 1rem; }
.learning-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.6rem; font-size: 0.85rem; }

.news-list { display: grid; gap: 0.6rem; }
.news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.news-item a { color: #93c5fd; text-decoration: none; font-weight: 600; }
.news-item a:hover { text-decoration: underline; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.form-stack { display: flex; flex-direction: column; gap: 0.7rem; }
.form-stack label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.row-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; }

input, select, textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
}
.sep { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.qr-wrap { text-align: center; margin: 0.75rem 0; }
.qr-wrap img { max-width: 210px; border-radius: 8px; background: #fff; padding: 6px; }
.hidden { display: none !important; }
.toast {
  background: #1d4ed8;
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
}
.pos-green { color: #4ade80; }
.pos-red { color: #f87171; }
.wa-media-wrap { margin-bottom: 0.4rem; }
.wa-thumb { max-width: 180px; max-height: 120px; border-radius: 6px; border: 1px solid var(--border); object-fit: cover; display: block; }
