/* =========================================================
   Agency Dashboard — style.css  (Light Theme)
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #ede9fe;
  --accent:        #06b6d4;
  --success:       #059669;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #2563eb;

  --bg:       #f1f5f9;
  --bg-2:     #e2e8f0;
  --surface:  #ffffff;
  --surface-2:#f8fafc;
  --border:   #e2e8f0;
  --text:     #0f172a;
  --text-2:   #475569;
  --muted:    #94a3b8;

  --radius:   10px;
  --radius-lg:16px;
  --shadow:   0 4px 24px rgba(15,23,42,.10);
  --shadow-sm:0 1px 6px  rgba(15,23,42,.07);
  --transition:.18s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* --- Site Header --- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1.25rem;
}
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.header-right {
  justify-content: flex-end;
}
.header-center {
  display: flex;
  justify-content: center;
  flex: 1;
}
.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.brand i { color: var(--primary); }
.brand:hover { color: var(--primary); }

/* Section tabs + navs */
.nav-sections {
  display: flex;
  align-items: center;
}
.main-nav {
  display: none;
  gap: .25rem;
}
.main-nav.active-section { display: flex; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-link i { width: 16px; height: 16px; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.nav-sep { width: 1px; height: 24px; background: var(--border); }
.btn-logout {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  border-radius: var(--radius);
  color: var(--danger);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
}
.btn-logout:hover {
  background: var(--danger-light, rgba(220,38,38,.08));
}

/* Hamburger */
.hamburger {
  display: flex;
  background: none;
  border: none;
  color: var(--text-2);
  padding: .4rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.hamburger:hover { background: var(--surface-2); color: var(--text); }

/* Sidebar Drawer */
.sidebar-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}
.sidebar-drawer.open {
  transform: translateX(280px);
}
.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.sidebar-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.sidebar-tab {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.sidebar-tab:hover { background: var(--surface-2); color: var(--text); }
.sidebar-tab.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-tab i { width: 20px; height: 20px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-overlay.open { display: block; opacity: 1; }

.hide-mobile { display: inline; }

@media (max-width: 900px) {
  .nav-sections { display: none; }
  .hide-mobile { display: none; }
}

/* --- Container --- */
.container { max-width: 1280px; margin: auto; padding: 1.75rem 1.25rem; }

/* --- Page header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.page-header h1 i { color: var(--primary); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.btn i { width: 16px; height: 16px; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { opacity: .88; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { opacity: .88; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { opacity: .88; }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-icon {
  padding: .35rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .5rem;
}

/* --- KPI Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-header { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: .78rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon.blue   { background: rgba(79,70,229,.1);  color: var(--primary); }
.kpi-icon.green  { background: rgba(5,150,105,.1);  color: var(--success); }
.kpi-icon.yellow { background: rgba(217,119,6,.1);  color: var(--warning); }
.kpi-icon.red    { background: rgba(220,38,38,.1);   color: var(--danger); }
.kpi-icon.cyan   { background: rgba(6,182,212,.1);   color: var(--accent); }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.kpi-sub   { font-size: .78rem; color: var(--muted); }

/* --- Table --- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
table tr:hover { background: var(--surface-2); }
table td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table td:first-child { font-weight: 500; color: var(--text); }
tbody td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

/* Custom File Upload */
.file-upload-wrapper {
  position: relative;
  width: 100%;
  margin-top: .25rem;
}
.file-upload-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: center;
  transition: all .2s;
}
.file-upload-input:hover + .file-upload-label {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.file-upload-label i {
  width: 24px;
  height: 24px;
  color: var(--primary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.td-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: rgba(5,150,105,.1);  color: #047857; }
.badge-warning { background: rgba(217,119,6,.1);  color: #b45309; }
.badge-danger  { background: rgba(220,38,38,.1);   color: #b91c1c; }
.badge-info    { background: rgba(37,99,235,.1);   color: #1d4ed8; }
.badge-muted   { background: rgba(148,163,184,.15);color: #64748b; }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.form-control {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .55rem .85rem;
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.2);
}
.form-control::placeholder { color: var(--muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 .5rem;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .45rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: .85rem;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.page-ellipsis { padding: 0 .3rem; color: var(--muted); }

/* --- Modals --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 560px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15,23,42,.18);
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 780px; }
@keyframes modalIn {
  from { transform: translateY(-16px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)      scale(1);   opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  padding: .25rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal-footer { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* --- Alerts --- */
.alert {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
}
.alert-success { background: #d1fae5; border-left: 3px solid var(--success); color: #065f46; }
.alert-danger   { background: #fee2e2; border-left: 3px solid var(--danger);  color: #991b1b; }
.alert-warning  { background: #fef3c7; border-left: 3px solid var(--warning); color: #92400e; }

/* --- Progress bar --- */
.progress-bar-wrap { background: var(--bg-2); border-radius: 99px; height: 6px; overflow: hidden; min-width: 80px; }
.progress-bar { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.progress-bar.green  { background: var(--success); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.red    { background: var(--danger); }

/* --- Search & Filter bar --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}
.filter-bar .form-control { flex: 1; min-width: 160px; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.search-wrap input { padding-left: 2.25rem; }

/* --- Dashboard sections --- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}
@media (max-width: 768px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.dash-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  background: var(--bg-2);
  font-size: .875rem;
}
.dash-list .dl-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.dash-list .dl-sub  { color: var(--text-2); font-size: .8rem; }

/* --- Revenue chart area --- */
.chart-container { width: 100%; height: 260px; position: relative; }
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  height: 100%;
  padding-bottom: 1.5rem;
}
.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  flex: 1;
}
.chart-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
  transition: opacity .15s;
  min-height: 4px;
  cursor: pointer;
}
.chart-bar:hover { opacity: .75; }
.chart-bar-label { font-size: .7rem; color: var(--muted); }
.chart-bar-val   { font-size: .68rem; color: var(--text-2); }

/* --- Kanban avancement --- */
.kanban-wrap { display: flex; flex-direction: column; gap: .65rem; }
.kanban-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.kanban-card-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.kanban-title { font-weight: 600; font-size: .9rem; }
.kanban-meta  { font-size: .78rem; color: var(--text-2); }

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state i { width: 48px; height: 48px; opacity: .4; }
.empty-state p  { font-size: .95rem; }

/* --- Misc --- */
.text-right { text-align: right; }
.text-muted { color: var(--muted); font-size: .85rem; }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.gap-sm { gap: .5rem; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ======================================================
   Notifications admin
   ====================================================== */
.notif-wrap {
  position: relative;
}
.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  padding: 0;
}
.notif-btn:hover {
  background: var(--surface-2);
  color: var(--primary);
  border-color: var(--primary);
}
.notif-btn i { width: 18px; height: 18px; }
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
  animation: notif-pulse 1.8s ease infinite;
  line-height: 1;
}
.notif-badge.hidden { display: none; }
@keyframes notif-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%      { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(15,23,42,.15);
  z-index: 500;
  overflow: hidden;
  animation: notif-drop .18s ease;
}
.notif-dropdown.open { display: block; }
@keyframes notif-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.notif-header-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.notif-header-title i { width: 15px; height: 15px; color: var(--primary); }
.notif-mark-all {
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background var(--transition);
}
.notif-mark-all:hover { background: var(--primary-light); }

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
  color: var(--text);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: #f5f3ff; }
.notif-item.unread:hover { background: #ede9fe; }
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-icon.pre_client { background: rgba(37,99,235,.1); color: var(--info); }
.notif-icon.ticket     { background: rgba(217,119,6,.1);  color: var(--warning); }
.notif-icon i { width: 15px; height: 15px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-msg {
  font-size: .76rem;
  color: var(--text-2);
  margin-top: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-time {
  font-size: .7rem;
  color: var(--muted);
  margin-top: .2rem;
}
.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: .85rem;
}
.notif-empty i { width: 36px; height: 36px; opacity: .35; }
.notif-footer {
  padding: .65rem 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  background: var(--surface-2);
}
.notif-footer a {
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary);
}

