/* ═══════════════════════════════════════════════════════════════
   NexCRM — Clean Professional Light Theme
   Signature: Refined sidebar with gradient accent rail + 
   card-first data display with micro-depth system
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sora:wght@600;700&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --primary:       #2563EB;
  --primary-light: #EFF6FF;
  --primary-dark:  #1D4ED8;
  --accent:        #7C3AED;
  --accent-light:  #F5F3FF;
  --success:       #059669;
  --success-light: #ECFDF5;
  --warning:       #D97706;
  --warning-light: #FFFBEB;
  --danger:        #DC2626;
  --danger-light:  #FEF2F2;
  --info:          #0891B2;
  --info-light:    #ECFEFF;
  --purple:        #7C3AED;
  --purple-light:  #F5F3FF;

  --bg:            #F8FAFC;
  --surface:       #FFFFFF;
  --surface-2:     #F1F5F9;
  --border:        #E2E8F0;
  --border-light:  #F1F5F9;

  --text-base:     #1E293B;
  --text-muted:    #64748B;
  --text-faint:    #94A3B8;
  --text-inverse:  #FFFFFF;

  --sidebar-w:     260px;
  --sidebar-bg:    #0F172A;
  --sidebar-text:  #CBD5E1;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active:#2563EB;
  --sidebar-accent-rail: linear-gradient(180deg, #2563EB 0%, #7C3AED 100%);

  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-xs:     0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm:     0 1px 4px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.04);
  --shadow:        0 4px 16px rgba(15,23,42,0.08), 0 1px 4px rgba(15,23,42,0.04);
  --shadow-lg:     0 8px 32px rgba(15,23,42,0.12), 0 2px 8px rgba(15,23,42,0.06);

  --font-sans:     'Inter', system-ui, sans-serif;
  --font-display:  'Sora', sans-serif;

  --header-h:      64px;
  --transition:    all 0.18s ease;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

ul { list-style: none; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* Signature: gradient accent rail on left edge */
.sidebar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sidebar-accent-rail);
  border-radius: 0 2px 2px 0;
}

.sidebar-brand {
  padding: 22px 20px 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-brand .brand-name span {
  color: var(--primary);
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 14px 20px 6px 24px;
}

.nav-item {
  margin: 1px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 450;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link.active {
  background: rgba(37,99,235,0.18);
  color: #93C5FD;
  font-weight: 600;
}

.nav-link.active .nav-icon {
  color: var(--primary);
}

.nav-icon {
  width: 18px;
  font-size: 0.9rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
  transition: var(--transition);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 0.82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 0.7rem; color: rgba(255,255,255,0.35); }
.sidebar-user .chevron { color: rgba(255,255,255,0.3); font-size: 0.75rem; }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 800;
  box-shadow: var(--shadow-xs);
}

.topbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.topbar-toggle:hover { background: var(--surface-2); color: var(--text-base); }

.topbar-breadcrumb {
  flex: 1;
  font-size: 0.875rem;
}

.topbar-breadcrumb .page-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-base);
}

.topbar-search {
  position: relative;
  width: 240px;
}
.topbar-search input {
  width: 100%;
  padding: 7px 12px 7px 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-base);
  transition: var(--transition);
  outline: none;
}
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.topbar-search .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn {
  width: 36px; height: 36px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--primary-light); color: var(--primary); }

.topbar-btn .notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.lang-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.8rem;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
}

/* ── PAGE CONTENT ────────────────────────────────────────────── */
.page-content {
  padding: 28px 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-heading { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-base); letter-spacing: -0.03em; }
.page-subheading { font-size: 0.85rem; color: var(--text-muted); margin-top: 3px; }

.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger);  }
.stat-icon.purple { background: var(--purple-light);  color: var(--purple);  }
.stat-icon.teal   { background: var(--info-light);    color: var(--info);    }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; color: var(--text-base); letter-spacing: -0.03em; line-height: 1; }
.stat-change { font-size: 0.75rem; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger);  }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-base);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--text-faint); font-size: 0.9rem; }

.card-body { padding: 22px; }
.card-body-p0 { padding: 0; }

.card-footer {
  padding: 14px 22px;
  background: var(--surface-2);
  border-top: 1px solid var(--border-light);
}

/* ── DATA TABLE ──────────────────────────────────────────────── */
.data-table-wrap { overflow-x: auto; scrollbar-width: none; }
.data-table-wrap::-webkit-scrollbar { display: none; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  padding: 12px 16px;
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-base);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background 0.12s;
}
.data-table tbody tr:hover td { background: var(--primary-light); }

.data-table .td-id { color: var(--text-faint); font-size: 0.8rem; font-weight: 500; }
.data-table .td-name { font-weight: 500; }
.data-table .td-amount { font-weight: 600; font-family: var(--font-display); }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: var(--success);  }
.badge-danger   { background: var(--danger-light);  color: var(--danger);   }
.badge-warning  { background: var(--warning-light); color: var(--warning);  }
.badge-primary  { background: var(--primary-light); color: var(--primary);  }
.badge-info     { background: var(--info-light);    color: var(--info);     }
.badge-secondary { background: var(--surface-2); color: var(--text-muted); }
.badge-light    { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple   { background: var(--purple-light); color: var(--purple); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,0.3); }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,0.35); }

.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { background: #047857; color: #fff; }

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

.btn-warning  { background: var(--warning); color: #fff; }
.btn-warning:hover  { background: #B45309; color: #fff; }

.btn-secondary{ background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover{ background: var(--border); color: var(--text-base); }

.btn-outline-primary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 0.78rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }

.btn-icon { padding: 7px; min-width: 32px; justify-content: center; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-base);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
  font-family: var(--font-sans);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control:disabled { background: var(--surface-2); color: var(--text-faint); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-text { font-size: 0.76rem; color: var(--text-faint); margin-top: 4px; }
.form-error { font-size: 0.76rem; color: var(--danger); margin-top: 4px; }

.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: repeat(2, 1fr); }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-group-text {
  padding: 9px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger   { background: var(--danger-light);  color: #991B1B; border: 1px solid #FECACA; }
.alert-warning  { background: var(--warning-light); color: #92400E; border: 1px solid #FDE68A; }
.alert-info     { background: var(--info-light);    color: #155E75; border: 1px solid #A5F3FC; }

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.page-link {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}
.page-link:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-link.disabled { opacity: 0.4; cursor: not-allowed; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-box-lg { max-width: 800px; }
.modal-box-xl { max-width: 1050px; }
@keyframes modalIn {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-faint); font-size: 1.1rem; padding: 4px; border-radius: var(--radius-sm); transition: var(--transition); }
.modal-close:hover { background: var(--surface-2); color: var(--text-base); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ── DROPDOWN ────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 9999;
  padding: 6px;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-base);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger:hover { background: var(--danger-light); color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ── PROGRESS ────────────────────────────────────────────────── */
.progress-bar-wrap { background: var(--surface-2); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s ease; }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  padding: 60px 24px;
  text-align: center;
}
.empty-state .empty-icon {
  width: 72px; height: 72px;
  background: var(--surface-2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: var(--text-faint);
  margin: 0 auto 18px;
}
.empty-state .empty-title { font-weight: 600; font-size: 1rem; color: var(--text-base); margin-bottom: 6px; }
.empty-state .empty-desc { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 20px; }

/* ── TOOLTIP ─────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-base);
  color: #fff;
  font-size: 0.73rem;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Topbar tooltips drop down (sticky header leaves no space above) */
.topbar [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 6px);
}

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-bar .form-control { width: auto; }
.filter-bar .search-input { width: 240px; }

/* ── SIDEBAR OVERLAY (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 899;
}

/* ── NOTIFICATION PANEL ──────────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 500;
  animation: dropIn 0.15s ease;
  overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-header span { font-weight: 600; font-size: 0.9rem; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-light); display: flex; gap: 12px; cursor: pointer; transition: var(--transition); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-light); }
.notif-item .notif-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; background: var(--primary-light); color: var(--primary); }
.notif-item .notif-msg { font-size: 0.82rem; color: var(--text-base); }
.notif-item .notif-time { font-size: 0.72rem; color: var(--text-faint); margin-top: 2px; }
.notif-footer { padding: 12px; text-align: center; border-top: 1px solid var(--border); }

/* ── AVATAR ──────────────────────────────────────────────────── */
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── KANBAN ──────────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { background: var(--surface-2); border-radius: var(--radius-lg); padding: 16px; width: 270px; flex-shrink: 0; }
.kanban-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kanban-col-title { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.kanban-count { font-size: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; color: var(--text-muted); }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; cursor: grab; transition: var(--transition); box-shadow: var(--shadow-xs); }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ── LOGIN PAGE ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Background mesh pattern */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(37,99,235,0.12) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 420px;
  padding: 44px 40px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}
.login-logo h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.04em; }
.login-logo h1 span { color: var(--primary); }
.login-logo p { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* ── DETAIL VIEW ─────────────────────────────────────────────── */
.detail-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.detail-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 10px; }
.detail-meta-item { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.detail-meta-item i { color: var(--text-faint); width: 14px; text-align: center; }

/* ── INVOICE / ESTIMATE PRINT ────────────────────────────────── */
.doc-paper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  max-width: 860px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
.doc-title { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; color: var(--text-base); }
.doc-number { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.doc-party-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 8px; }
.doc-party-name { font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.doc-party-details { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; }
.doc-table th { padding: 10px 14px; background: var(--surface-2); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); border-bottom: 2px solid var(--border); text-align: left; }
.doc-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; vertical-align: middle; }
.doc-table tr:last-child td { border-bottom: none; }
.doc-totals { display: flex; justify-content: flex-end; }
.doc-totals-table { min-width: 260px; }
.doc-totals-table tr td { padding: 7px 0; font-size: 0.875rem; }
.doc-totals-table tr td:last-child { text-align: right; font-weight: 500; }
.doc-totals-table tr.total-row td { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--border); padding-top: 14px; color: var(--primary); }

/* ── UTILS ───────────────────────────────────────────────────── */
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-primary  { color: var(--primary); }
.text-sm       { font-size: 0.82rem; }
.text-xs       { font-size: 0.75rem; }
.fw-600        { font-weight: 600; }
.fw-500        { font-weight: 500; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.w-100 { width: 100%; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .page-content { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 272px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.4);
  }
  .sidebar-overlay.visible { display: block; }
  .main-content { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .topbar-search { width: 160px; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.3rem; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .doc-paper { padding: 24px 18px; }
  .doc-parties { grid-template-columns: 1fr; gap: 20px; }
  .kanban-board { padding-bottom: 20px; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .topbar-search { display: none; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .filter-bar .search-input { width: 100%; }
  .pagination { justify-content: center; }
  .topbar { padding: 0 14px; }
}

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header .page-actions, .filter-bar, .btn { display: none !important; }
  .main-content { margin-left: 0; }
  .doc-paper { box-shadow: none; border: none; }
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
