/* ── MONARCH CRM — Dark Biotech Premium Theme ── */

:root {
  --bg-base:       #07090f;
  --bg-surface:    #0d1120;
  --bg-card:       #111827;
  --bg-card-hover: #161f30;
  --bg-input:      #0d1120;
  --border:        #1e2d45;
  --border-light:  #243452;

  --gold:          #c9a84c;
  --gold-light:    #e8c96a;
  --gold-glow:     rgba(201, 168, 76, 0.15);
  --gold-border:   rgba(201, 168, 76, 0.35);

  --text-primary:   #e8eaf0;
  --text-secondary: #8a9bb5;
  --text-muted:     #4a5a72;

  --status-lead:       #3b82f6;
  --status-contacted:  #8b5cf6;
  --status-onboarded:  #06b6d4;
  --status-active:     #10b981;
  --status-highvol:    #f59e0b;
  --status-inactive:   #6b7280;

  --priority-low:    #6b7280;
  --priority-med:    #3b82f6;
  --priority-high:   #f59e0b;
  --priority-urgent: #ef4444;

  --sidebar-w: 220px;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.6);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  line-height: 1.2;
}

.sidebar-brand .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 14px 20px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-left-color: var(--border-light);
}

.sidebar-nav a.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-left-color: var(--gold);
}

.sidebar-nav a .nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border);
}

.user-block {
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.user-title {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 0;
  transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--text-secondary); }
.sidebar-footer a:last-child:hover { color: #ef4444; }

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.home-btn:hover {
  background: rgba(212,175,55,0.2);
  border-color: var(--gold);
  color: var(--gold);
}

/* ── New Orders button ── */
.new-orders-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  background: rgba(107,114,128,0.15);
  border: 1px solid rgba(107,114,128,0.35);
  border-radius: 6px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  position: relative;
}
.new-orders-btn:hover {
  background: rgba(107,114,128,0.25);
  color: #d1d5db;
}
.new-orders-btn--alert {
  background: rgba(220,38,38,0.18);
  border-color: rgba(220,38,38,0.6);
  color: #fca5a5;
  animation: new-orders-pulse 1.8s ease-in-out infinite;
}
.new-orders-btn--alert:hover {
  background: rgba(220,38,38,0.3);
  color: #fee2e2;
}
@keyframes new-orders-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}
.new-orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #dc2626;
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, background 0.2s;
}

.stat-card:hover {
  border-color: var(--gold-border);
  background: var(--bg-card-hover);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.gold { color: var(--gold); }
.stat-value.emerald { color: #10b981; }
.stat-value.amber { color: #f59e0b; }
.stat-value.rose { color: #ef4444; }

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── DASHBOARD GRID ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── TABLES ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

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

thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }

tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 13px;
}

.td-muted { color: var(--text-secondary); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-lead        { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-contacted   { background: rgba(139,92,246,0.15); color: #a78bfa; }
.badge-onboarded   { background: rgba(6,182,212,0.15);  color: #22d3ee; }
.badge-active      { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-highvolume  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-inactive    { background: rgba(107,114,128,0.15);color: #9ca3af; }
.badge-prospect    { background: rgba(107,114,128,0.15);color: #9ca3af; }
.badge-approved    { background: rgba(6,182,212,0.15);  color: #22d3ee; }
.badge-paused      { background: rgba(245,158,11,0.15); color: #fbbf24; }

.badge-new      { background: rgba(220,38,38,0.2);   color: #f87171; font-weight:700; }
.badge-paid     { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-pending  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-refunded { background: rgba(239,68,68,0.15);  color: #f87171; }

.badge-open       { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-inprogress { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-completed  { background: rgba(16,185,129,0.15); color: #34d399; }

.badge-low    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-medium { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge-high   { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-urgent { background: rgba(239,68,68,0.15);   color: #f87171; }

/* Generic semantic badges */
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-info    { background: rgba(6,182,212,0.15);  color: #22d3ee; }
.badge-muted   { background: rgba(107,114,128,0.15);color: #9ca3af; }
/* Shorthand color badges */
.badge-blue   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge-green  { background: rgba(16,185,129,0.15);  color: #34d399; }
.badge-yellow { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-grey   { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-red    { background: rgba(239,68,68,0.15);   color: #f87171; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: #07090f;
}
.btn-primary:hover {
  background: var(--gold-light);
  color: #07090f;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.6);
}

.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-xs  { padding: 3px 9px;  font-size: 11px; border-radius: 5px; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-success {
  background: rgba(16,185,129,0.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}
.btn-success:hover {
  background: rgba(16,185,129,0.25);
  border-color: rgba(16,185,129,0.6);
}

/* ── FORMS ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid.col-1 { grid-template-columns: 1fr; }
.form-grid.col-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

textarea { resize: vertical; min-height: 80px; }

select { cursor: pointer; }

input::placeholder { color: var(--text-muted); }

/* ── SEARCH / FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 160px;
}

.filter-bar form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── FLASH MESSAGES ── */
.flash-list {
  list-style: none;
  margin-bottom: 20px;
}

.flash {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-success {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  color: #34d399;
}

.flash-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
}

/* ── ACTIVITY LOG ── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

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

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-desc {
  font-size: 13px;
  color: var(--text-primary);
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── PAYOUT REPORT ── */
.payout-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.commission-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.commission-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon  { font-size: 36px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state .empty-sub   { font-size: .85rem; color: var(--text-muted); max-width: 380px; margin: 0 auto; }
.empty-state p { font-size: 14px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.04) 0%, transparent 60%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand .crown { font-size: 32px; margin-bottom: 8px; }

.login-brand h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
}

.login-brand p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.login-card .form-group { margin-bottom: 16px; }

.login-card .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 8px; }

/* ── ACTION CELL ── */
.action-cell { display: flex; gap: 6px; }

/* ── FORM PAGE ── */
.form-section { margin-bottom: 28px; }

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.col-3 { grid-template-columns: 1fr; }
  .form-group.span-2,
  .form-group.span-3 { grid-column: span 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .payout-summary { grid-template-columns: 1fr; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── UTILITY ── */
.text-gold     { color: var(--gold); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.fw-bold { font-weight: 700; }
.font-mono { font-family: 'Fira Code', 'Consolas', monospace; }
