:root {
  --bg: #071427;
  --bg-soft: #0d1e37;
  --sidebar: #0a1a31;
  --card: #10233f;
  --card-soft: #122948;
  --border: rgba(196, 167, 106, 0.26);
  --primary: #cfae66;
  --primary-strong: #e2c586;
  --accent: #d8b978;
  --text: #f2f6ff;
  --muted: #9cb0d1;
  --success: #3dd6a1;
  --warning: #f5c15d;
  --danger: #ff7d8e;
  --radius: 16px;
  --shadow: 0 16px 36px rgba(1, 6, 17, 0.45);
  --shadow-hover: 0 20px 42px rgba(1, 6, 17, 0.6);
  --sidebar-width: 236px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  overflow-x: hidden;
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(207, 174, 102, 0.14), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(67, 106, 180, 0.18), transparent 34%),
    linear-gradient(180deg, #061224 0%, #091a31 45%, #061223 100%);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  padding: 20px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.brand {
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(207, 174, 102, 0.2), rgba(207, 174, 102, 0.05));
  border: 1px solid rgba(207, 174, 102, 0.34);
  margin-bottom: 14px;
}

.brand-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: #d7c192;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-links {
  display: grid;
  gap: 7px;
}

.nav-link {
  text-decoration: none;
  color: #c3d1eb;
  font-weight: 600;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: #fff;
  background: rgba(207, 174, 102, 0.14);
  border-color: rgba(207, 174, 102, 0.35);
}

.nav-link.active {
  color: #0b1730;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  padding: 28px 30px;
  display: grid;
  gap: 18px;
  align-content: start;
  max-width: calc(100vw - var(--sidebar-width));
}

@media (min-width: 1400px) {
  .main-content {
    padding: 32px 36px;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .metric-value {
    font-size: 32px;
  }
}


.card,
.report-panel {
  background: linear-gradient(180deg, var(--card), var(--card-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.search-wrap { flex: 1; min-width: 160px; }
.label-text { position: absolute; left: -9999px; }

.search-wrap input,
.filter-bar input,
.filter-bar select,
.report-actions select,
.report-actions input {
  width: 100%;
  border: 1px solid rgba(184, 153, 89, 0.45);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  background: #0b1d37;
  font-size: 0.9rem;
}

.search-wrap input:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.report-actions select:focus,
.report-actions input:focus {
  outline: 2px solid rgba(207, 174, 102, 0.25);
  border-color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.notification {
  border: 1px solid rgba(184, 153, 89, 0.35);
  background: #0b1d37;
  border-radius: 11px;
  padding: 8px 11px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.date-display { font-size: 0.84rem; color: var(--muted); }

.profile {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0b1730;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.page-hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.hero-card,
.excel-inline {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(160deg, #102647, #0b1e38);
  box-shadow: var(--shadow);
}

.hero-title { margin: 0 0 8px; font-size: 1.25rem; }
.hero-text,
.report-note,
.excel-meta,
.pipeline-stage p,
.agent-meta,
.settings-card p { margin: 0; color: var(--muted); }

.hero-metrics,
.kpi-grid,
.chart-grid,
.bottom-grid,
.pipeline-grid,
.agents-grid,
.settings-grid,
.reports-grid,
.report-actions {
  display: grid;
  gap: 12px;
}

.hero-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.hero-pill {
  border: 1px solid rgba(207, 174, 102, 0.25);
  background: rgba(8, 20, 38, 0.8);
  border-radius: 11px;
  padding: 10px;
}
.hero-pill strong { display: block; font-size: 1.04rem; margin: 5px 0; }

.excel-inline {
  color: var(--text);
  text-decoration: none;
  display: grid;
  gap: 8px;
}

.excel-inline:hover,
.report-panel.excel-sync:hover { box-shadow: var(--shadow-hover); }

.excel-inline ul,
.excel-files { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.excel-inline li,
.excel-files li {
  border: 1px solid rgba(207, 174, 102, 0.24);
  border-radius: 10px;
  padding: 9px;
  background: rgba(11, 29, 55, 0.7);
  font-size: 0.86rem;
}

.kpi-grid { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.chart-grid { grid-template-columns: 2fr 1fr; }
.chart-wide { grid-row: span 2; }
.bottom-grid { grid-template-columns: 2fr 1fr; }
.pipeline-grid { grid-template-columns: repeat(5, minmax(145px, 1fr)); }
.agents-grid { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
.settings-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
.reports-grid { grid-template-columns: 2fr 1fr; }
.report-actions { grid-template-columns: repeat(3, minmax(120px, 1fr)); }

.metric-card,
.chart-card,
.table-card,
.leaderboard-card,
.settings-card,
.pipeline-stage,
.agent-perf-card,
.report-panel {
  padding: 18px;
}

.metric-title {
  margin: 0;
  color: #b8c7e3;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.metric-value { margin: 10px 0 6px; font-size: 29px; font-weight: 700; }
.metric-growth { margin: 0; font-size: 0.8rem; font-weight: 600; }
.metric-growth.positive { color: var(--success); }
.metric-growth.negative { color: var(--danger); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.section-head span { color: #cbb784; font-size: 0.82rem; }

.chart-card h2,
.table-card h2,
.leaderboard-card h2,
.settings-card h3,
.pipeline-stage h3,
.page-title,
.report-panel h2,
.report-panel h3 {
  margin: 0 0 10px;
  font-size: 1.03rem;
}

.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.87rem;
}

th,
td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid rgba(207, 174, 102, 0.2);
  white-space: nowrap;
}

th {
  color: #ccb77f;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
}

tbody tr:hover { background: rgba(207, 174, 102, 0.07); }

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}
.status.active { color: #1f3f8a; background: #d2defd; }
.status.sold { color: #0f8e67; background: #d9f8eb; }
.status.pending { color: #9a6a14; background: #fdecc9; }

.agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.agent-list li {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.agent-name,
.agent-sales { margin: 0; font-weight: 600; }

.excel-badge {
  display: inline-block;
  background: rgba(207, 174, 102, 0.18);
  color: #f0d8a0;
  border: 1px solid rgba(207, 174, 102, 0.4);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 12px;
}

.btn-primary,
.btn-secondary {
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-primary {
  border: 0;
  color: #0b1730;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.btn-secondary {
  border: 1px solid rgba(207, 174, 102, 0.45);
  color: #f3ddb1;
  background: rgba(11, 29, 55, 0.85);
}

.report-panel.excel-sync {
  text-decoration: none;
  color: inherit;
  display: grid;
  gap: 10px;
  background: #fff;
  border: 1px solid #dbe6fb;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.88rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

@media (max-width: 1200px) {
  .kpi-grid,
  .pipeline-grid,
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .page-hero,
  .hero-metrics,
  .chart-grid,
  .bottom-grid,
  .reports-grid,
  .report-actions,
  .settings-grid,
  .filter-bar { grid-template-columns: 1fr; }

  .chart-wide { grid-row: auto; }
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px;
  }

  .brand { margin-bottom: 8px; }

  .nav-links {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 3px;
    gap: 6px;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .metric-value { font-size: 24px; }
  .hero-title { font-size: 1.08rem; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .kpi-grid,
  .pipeline-grid,
  .agents-grid,
  .settings-grid { grid-template-columns: 1fr; }
}
