:root {
  --primary: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --surface: #ffffff;
  --page-bg: #f4f7fb;
  --text-primary: #172033;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, .06);
}

body {
  background: var(--page-bg);
  color: var(--text-primary);
}

.app-navbar {
  padding: 10px 0;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  margin: 0;
  color: var(--text-primary);
  text-decoration: none;
}

.app-brand:hover {
  color: var(--text-primary);
}

.app-brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #0f766e);
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
  font-size: 1.2rem;
}

.app-brand-title,
.app-brand-subtitle {
  display: block;
  line-height: 1.25;
}

.app-brand-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 800;
}

.app-brand-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 600;
}

.app-navbar-toggler {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 10px;
}

.app-nav {
  gap: 4px;
  padding-inline-start: 10px;
}

.app-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .92rem;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.app-nav .nav-link:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, .08);
}

.app-nav .nav-link.active {
  color: var(--primary);
  background: rgba(37, 99, 235, .1);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
}

.app-nav .nav-link i {
  font-size: 1rem;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
  transition: background .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.app-userbox:hover,
.app-userbox.active {
  color: inherit;
  background: rgba(37, 99, 235, .08);
  border-color: rgba(37, 99, 235, .22);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .08);
}

.app-user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(37, 99, 235, .1);
}

.app-user-meta {
  display: grid;
  line-height: 1.15;
}

.app-user-role {
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
}

.app-user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 800;
}

.app-logout-form {
  margin: 0;
}

.app-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding-inline: 14px;
  border: 1px solid rgba(220, 38, 38, .2);
  color: var(--danger);
  background: rgba(220, 38, 38, .07);
  font-weight: 800;
}

.app-logout-btn:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.card { border-radius: 14px; border-color: var(--border-color); }
.table th { white-space: nowrap; color: var(--text-muted); font-weight: 700; font-size: .86rem; }
.guest-bg { background: linear-gradient(135deg, #eef6ff, #f8fafc); }
.btn, .form-control, .form-select { border-radius: 10px; }

.dashboard-page {
  max-width: 1480px;
  margin-inline: auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.dashboard-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-filter .form-label {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: .82rem;
}

.dashboard-stat-card {
  position: relative;
  min-height: 148px;
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .1);
}

.dashboard-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  font-size: 1.25rem;
}

.tone-primary .dashboard-card-icon { color: var(--primary); background: rgba(37, 99, 235, .1); }
.tone-success .dashboard-card-icon { color: var(--success); background: rgba(22, 163, 74, .1); }
.tone-warning .dashboard-card-icon { color: var(--warning); background: rgba(217, 119, 6, .12); }
.tone-info .dashboard-card-icon { color: var(--info); background: rgba(8, 145, 178, .1); }

.dashboard-card-title {
  color: var(--text-muted);
  font-size: .86rem;
  margin-bottom: 6px;
}

.dashboard-card-value {
  font-weight: 800;
  font-size: clamp(1.1rem, 1.7vw, 1.55rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.dashboard-card-trend {
  margin-top: 8px;
  font-size: .78rem;
  font-weight: 700;
}

.dashboard-panel {
  height: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-panel-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
}

.chart-container-lg {
  height: 320px;
}

.chart-container-rank {
  min-height: 280px;
}

.chart-empty {
  display: none;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
  background: #f8fafc;
}

.chart-empty i {
  font-size: 1.8rem;
  color: #94a3b8;
}

.chart-empty.visible {
  display: flex;
}

.latest-projects-table .badge {
  border-radius: 999px;
  padding: .45rem .65rem;
}

.profile-page {
  max-width: 980px;
  margin-inline: auto;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #0f766e);
  box-shadow: 0 14px 28px rgba(37, 99, 235, .2);
  font-size: 1.65rem;
}

.profile-card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.marketer-select-tools .input-group-text {
  color: var(--text-muted);
  background: #f8fafc;
  border-color: var(--border-color);
}

.marketer-select-tools .form-text {
  min-height: 19px;
}

@media (max-width: 768px) {
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .app-navbar {
    padding: 8px 0;
  }

  .app-brand {
    min-width: 0;
    max-width: calc(100vw - 84px);
  }

  .app-brand-icon {
    width: 40px;
    height: 40px;
  }

  .app-brand-title {
    max-width: 210px;
  }

  .app-nav {
    gap: 6px;
    padding: 12px 0 8px;
  }

  .app-nav .nav-link {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .app-header-actions {
    align-items: stretch;
    flex-direction: column;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
  }

  .app-userbox {
    justify-content: flex-start;
    border-radius: 12px;
  }

  .app-logout-btn {
    width: 100%;
    justify-content: center;
  }

  .dashboard-header,
  .dashboard-filter {
    display: block;
  }

  .dashboard-filter > div {
    margin-top: 10px;
  }

  .chart-container,
  .chart-container-lg {
    height: 260px;
  }

  .chart-container-rank {
    min-height: 280px;
  }

  .latest-projects-table table,
  .latest-projects-table thead,
  .latest-projects-table tbody,
  .latest-projects-table th,
  .latest-projects-table td,
  .latest-projects-table tr {
    display: block;
  }

  .latest-projects-table thead {
    display: none;
  }

  .latest-projects-table tr {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #fff;
  }

  .latest-projects-table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 0;
    padding: 7px 0;
    font-size: .92rem;
  }

  .latest-projects-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 700;
  }
}
