/* ============================================================
   OGA CRM — Light Mode, OpenLoop Brand, ViberNet-inspired
   ============================================================ */

:root {
  /* Brand — OpenLoop Blue */
  --brand:        #1863dc;
  --brand-dark:   #114baf;
  --brand-mid:    #4182eb;
  --brand-light:  #eff4fd;
  --brand-glow:   rgba(24, 99, 220, 0.15);

  /* Neutrals */
  --ink:          #0f0a1a;
  --ink-2:        #3d3552;
  --white:        #ffffff;
  --bg:           #f6f4f9;
  --bg-elevated:  #ffffff;

  /* Semantic */
  --success:      #059669;
  --danger:       #dc2626;
  --warning:      #d97706;
  --info:         #0284c7;

  /* UI */
  --border:       rgba(24, 99, 220, 0.10);
  --border-soft:  rgba(15, 10, 26, 0.08);
  --shadow-xs:    0 1px 3px rgba(24,99,220,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:    0 4px 18px rgba(24,99,220,.09), 0 1px 4px rgba(0,0,0,.04);
  --shadow-md:    0 8px 36px rgba(24,99,220,.13), 0 2px 8px rgba(0,0,0,.05);
  --radius:       14px;
  --radius-sm:    9px;
  --sidebar-w:    240px;

  /* Text */
  --text:         var(--ink);
  --text-dim:     var(--ink-2);
  --text-faint:   #8b7fa8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-dark); }

h1, h2, h3 {
  font-family: "Outfit", "DM Sans", sans-serif;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 12px;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

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

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  box-shadow: 2px 0 20px rgba(24,99,220,.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 10px 10px;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s, box-shadow .15s;
}

.nav a i {
  font-size: 13.5px;
  width: 17px;
  text-align: center;
  opacity: .65;
  flex-shrink: 0;
  transition: opacity .15s;
}

.nav a:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.nav a:hover i { opacity: 1; }

.nav a.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(24,99,220,.28);
}

.nav a.active i { opacity: 1; }

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-info { min-width: 0; }

.user-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

.page-title {
  font-size: 21px;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  margin-bottom: 22px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-mid) 100%);
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   STAT CARDS
   ============================================================ */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-mid) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--brand);
  font-size: 15px;
}

.card .card-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
  font-weight: 700;
}

.card .card-value {
  font-family: "Outfit", sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 5px;
}

.card .card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ============================================================
   PANEL
   ============================================================ */

.panel {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i {
  color: var(--brand);
  font-size: 14px;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #eff4fd 0%, #e4eeff 50%, #f6f4f9 100%);
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.auth-card .brand-logo {
  height: 36px;
  margin-bottom: 20px;
}

.auth-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.auth-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

th {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  background: var(--bg);
}

tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--brand-light); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   PILLS / BADGES
   ============================================================ */

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: .02em;
}

.field-full { grid-column: 1 / -1; }

input, select, textarea {
  background: var(--white);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24,99,220,.10);
}

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

form { margin: 0; }

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 14px rgba(24,99,220,.28);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(24,99,220,.38);
  color: #fff;
}

.btn:active { transform: translateY(0); }

.btn-sm { padding: 5px 14px; font-size: 12px; box-shadow: 0 2px 8px rgba(24,99,220,.20); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border-soft);
  color: var(--text-dim);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 4px 14px rgba(220,38,38,.22);
}

.btn-danger:hover { box-shadow: 0 6px 20px rgba(220,38,38,.32); }

.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   BANNERS
   ============================================================ */

.banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-success {
  background: #ecfdf5;
  border: 1px solid rgba(5,150,105,.22);
  color: var(--success);
}

.banner-error {
  background: #fef2f2;
  border: 1px solid rgba(220,38,38,.22);
  color: var(--danger);
}

/* ============================================================
   FILTERS / TOOLBAR
   ============================================================ */

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: flex-end;
}

.filters .field { min-width: 150px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */

.feed { display: flex; flex-direction: column; }

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}

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

.feed-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 6px;
}

.feed-time { color: var(--text-faint); white-space: nowrap; font-size: 12px; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.text-dim    { color: var(--text-dim); }
.text-faint  { color: var(--text-faint); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.mt-0        { margin-top: 0; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
}

.empty-state i {
  font-size: 34px;
  margin-bottom: 12px;
  display: block;
  opacity: .35;
}

/* Progress bar */
.bar {
  height: 6px;
  border-radius: 99px;
  background: var(--brand-light);
  overflow: hidden;
  width: 100px;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-mid) 100%);
}

/* Leaderboard ranks */
.rank-1 { color: #b45309; font-weight: 700; }
.rank-2 { color: #6b7280; font-weight: 700; }
.rank-3 { color: #92400e; font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -250px;
    z-index: 40;
    transition: left 0.22s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 70px 16px 28px; }
}

@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 28px 20px; }
  .page-title { font-size: 19px; margin-bottom: 18px; }
  .content { padding: 64px 14px 24px; }
}
