/* ============================================================
   Agency Panel — Main Stylesheet
   Classic · Minimal · Light
   All components use shared variables & utility classes.
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #f7f7f8;
  --surface:     #ffffff;
  --border:      #e4e4e7;
  --border-light:#f0f0f2;
  --text-1:      #18181b;
  --text-2:      #52525b;
  --text-3:      #a1a1aa;
  --primary:     #2563eb;
  --primary-h:   #1d4ed8;
  --primary-t:   #eff6ff;
  --danger:      #ef4444;
  --danger-h:    #dc2626;
  --danger-t:    #fef2f2;
  --success:     #22c55e;
  --success-t:   #f0fdf4;
  --sidebar-w:   180px;
  --topbar-h:    52px;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --font:        'Figtree', system-ui, sans-serif;
  --transition:  150ms ease;
}

/* Vertical scrollbar width */
::-webkit-scrollbar {
  width: 12px; 
}

/* Horizontal scrollbar height */
::-webkit-scrollbar {
  height: 12px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}
.content {
  flex: 1;
  padding: 24px;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark  { font-size: 1.3rem; color: var(--primary); }
.brand-text  { font-size: .95rem; font-weight: 600; color: var(--text-1); letter-spacing: -.01em; }
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 12px 8px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--bg); color: var(--text-1); text-decoration: none; }
.nav-link.active { background: var(--primary-t); color: var(--primary); }
.nav-icon { font-size: 1rem; opacity: .7; width: 18px; text-align: center; flex-shrink: 0; }
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-t);
  color: var(--primary);
  font-weight: 600;
  font-size: .82rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-name  { display: block; font-size: .83rem; font-weight: 600; color: var(--text-1); }
.sidebar-user-role  { display: block; font-size: .75rem; color: var(--text-3); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 150;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: .9rem; font-weight: 600; color: var(--text-1); }
.user-name    { font-size: .83rem; color: var(--text-2); font-weight: 500; }
.menu-toggle  {
  display: none;
  background: none; border: none;
  font-size: 1.1rem; cursor: pointer;
  color: var(--text-2);
  padding: 4px;
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title  { font-size: .92rem; font-weight: 600; color: var(--text-1); }
.card-body   { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.stat-label { font-size: .78rem; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.8rem; font-weight: 600; color: var(--text-1); line-height: 1.2; margin-top: 4px; }
.stat-sub   { font-size: .78rem; color: var(--text-3); margin-top: 2px; }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
tbody td {
  padding: 11px 16px;
  font-size: .87rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }
.td-name { font-weight: 500; color: var(--text-1); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
}
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }
.badge-amber  { background: #fffbeb; color: #d97706; }
.badge-gray   { background: var(--bg); color: var(--text-2); }
.badge-green  { background: var(--success-t); color: #16a34a; }
.badge-danger { background: var(--danger-t); color: var(--danger); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .87rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-h); border-color: var(--danger-h); }
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-outline:hover { background: var(--bg); color: var(--text-1); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-1); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-loading::after {
  content: '';
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 4px;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group   { margin-bottom: 16px; }
.form-label   {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-hint   { font-size: .77rem; color: var(--text-3); margin-top: 4px; }
.form-error  { font-size: .77rem; color: var(--danger); margin-top: 4px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2352525b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%; 
  max-width: 80%;
  transform: translateY(8px);
  transition: transform var(--transition);
  overflow: scroll;
 height: 90%;
    scrollbar-width: none;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title  { font-size: .92rem; font-weight: 600; }
.modal-close  {
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; color: var(--text-3); line-height: 1;
  padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg); color: var(--text-1); }
.modal-body   { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Alert ───────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .86rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-t); color: #166534; border-color: #bbf7d0; }
.alert-danger  { background: var(--danger-t);  color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--primary-t); color: #1e40af; border-color: #bfdbfe; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--text-1);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: .86rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 500;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #16a34a; }
.toast.error   { background: var(--danger); }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-heading { font-size: 1.15rem; font-weight: 600; color: var(--text-1); }
.page-sub     { font-size: .82rem; color: var(--text-3); margin-top: 2px; }

/* ── Auth Layout ─────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%; max-width: 380px;
  padding: 36px 32px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo-mark  { font-size: 2rem; color: var(--primary); display: block; line-height: 1; }
.auth-logo-name  { font-size: 1.1rem; font-weight: 700; color: var(--text-1); display: block; margin-top: 6px; }
.auth-title      { font-size: 1rem; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.auth-sub        { font-size: .83rem; color: var(--text-3); margin-bottom: 20px; }
.auth-footer     { margin-top: 16px; text-align: center; font-size: .82rem; color: var(--text-3); }

/* ── Utilities ───────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mt-20        { margin-top: 20px; }
.mb-16        { margin-bottom: 16px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-sm      { font-size: .82rem; }
.text-muted   { color: var(--text-3); }
.text-danger  { color: var(--danger); }
.fw-500       { font-weight: 500; }
.fw-600       { font-weight: 600; }
.w-full       { width: 100%; }
.hidden       { display: none !important; }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: .88rem;
}
.empty-state-icon { font-size: 2rem; display: block; margin-bottom: 10px; }

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

.filter-div {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
     -ms-overflow-style: none;
  scrollbar-width: none;
}

.filter-div::-webkit-scrollbar {
  display: none;
}



/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }
  .main-wrap { margin-left: 0;max-width: 100%; }
  .menu-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
  .modal {
      height: 100%;
      border-radius: 0px;
      max-width: 100%;
  }
  .form-control {
      font-size:16px;
      flex: 0 0 auto;
  }
  
  .filter-div  {
      flex-wrap: nowrap; /* ❌ remove wrap */ overflow-x: auto; /* ✅ enable horizontal scroll */ scroll-behavior: smooth;
  }
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
