﻿:root {
  --bg: #0B0F19;
  --surface: #111827;
  --surface-2: #172033;
  --border: #1F2937;
  --text: #F9FAFB;
  --muted: #9CA3AF;
  --gold: #F59E0B;
  --gold-soft: rgba(245, 158, 11, 0.14);
  --emerald: #10B981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius: 14px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
.mono { font-family: 'JetBrains Mono', monospace; }
.accent-gold { color: var(--gold); }
.accent-emerald { color: var(--emerald); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px; flex-wrap: wrap; padding: 10px 20px;
}

.brand-group { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--gold-soft); border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--gold); font-weight: 700; display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
}

.brand-title { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.75rem; color: var(--muted); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.75rem;
  background: var(--emerald-soft); color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); }

.controls-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.currency-switch {
  display: flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px;
}

.curr-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 7px; font-size: 0.8rem;
  font-weight: 600; cursor: pointer;
}

.curr-btn.active { background: var(--gold); color: #0B0F19; }

.rate-box {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 10px; font-size: 0.78rem; color: var(--muted);
}

.rate-box input {
  width: 74px; background: transparent; border: none;
  color: var(--text); font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem; outline: none;
}

.main-content { padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}

.hero-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}

.hero-header h1 { font-size: 1.45rem; font-weight: 700; }
.hero-header p { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-primary {
  background: var(--gold); color: #0B0F19; border: none;
  border-radius: 10px; padding: 0 20px; font-weight: 700;
  font-size: 0.9rem; cursor: pointer;
}

.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 500; cursor: pointer;
}

.input-wrap { display: flex; gap: 10px; max-width: 520px; }

.input-wrap input, .table-actions input, .table-actions select, .form-group select {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 10px 14px;
  font-size: 0.9rem; outline: none;
}

.input-wrap input { flex: 1; font-family: 'JetBrains Mono', monospace; }
.input-wrap input:focus, .table-actions input:focus, .form-group select:focus { border-color: var(--gold); }

.demo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.demo-label { font-size: 0.78rem; color: var(--muted); }

.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 5px 12px;
  font-size: 0.76rem; cursor: pointer;
}

.chip:hover { border-color: var(--gold); color: var(--gold); }

.banner {
  margin-top: 16px; padding: 12px 16px; border-radius: 10px;
  font-size: 0.86rem; border: 1px solid transparent;
}

.banner-info { background: var(--gold-soft); border-color: rgba(245, 158, 11, 0.3); color: #FDE68A; }
.banner-ok { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.3); color: #A7F3D0; }
.banner-warn { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.3); color: #FECACA; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-label { font-size: 0.78rem; color: var(--muted); }
.kpi-value { font-size: 1.45rem; font-weight: 700; margin: 6px 0 4px; }
.kpi-meta { font-size: 0.76rem; color: var(--muted); }

.bento-mid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; }

.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}

.card-head h2 { font-size: 1.05rem; font-weight: 600; }
.card-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.seg-group {
  display: flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px;
}

.seg-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 5px 11px; border-radius: 6px; font-size: 0.78rem;
  font-weight: 600; cursor: pointer;
}

.seg-btn.active { background: var(--surface-2); color: var(--text); }

.chart-stage { position: relative; width: 100%; height: 220px; }
#rebateChart { width: 100%; height: 100%; display: block; }

.chart-tooltip {
  position: fixed; pointer-events: none; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text); padding: 8px 10px;
  border-radius: 8px; font-size: 0.76rem; display: none; z-index: 30;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.form-group select { width: 100%; }
.slider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
input[type="range"] { width: 100%; accent-color: var(--gold); cursor: pointer; }
.slider-ticks { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 4px; }

.calc-result {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
}

.calc-result span { font-size: 0.84rem; color: var(--muted); }
.calc-result strong { font-size: 1.25rem; }

.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.badge-paid { background: var(--emerald-soft); color: var(--emerald); }
.badge-pending { background: var(--gold-soft); color: var(--gold); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 540px; width: 100%; padding: 20px;
}

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}

.modal-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal-body { font-size: 0.88rem; color: var(--muted); display: flex; flex-direction: column; gap: 10px; }
.modal-body ol { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .bento-mid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .input-wrap { flex-direction: column; }
}
