:root {
  --ch-primary:        #2563EB;
  --ch-primary-hover:  #1D4ED8;
  --ch-accent:         #06B6D4;
  --ch-accent-hover:   #0891B2;
  --ch-bg:             #F8FAFC;
  --ch-surface:        #FFFFFF;
  --ch-sidebar-bg:     #1E293B;
  --ch-sidebar-text:   #94A3B8;
  --ch-sidebar-active: #F1F5F9;
  --ch-sidebar-accent: #06B6D4;
  --ch-text:           #0F172A;
  --ch-text-muted:     #64748B;
  --ch-text-inverse:   #F1F5F9;
  --ch-border:         #E2E8F0;
  --ch-shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --ch-shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --ch-shadow-lg:      0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --ch-success:        #10B981;
  --ch-warning:        #F59E0B;
  --ch-danger:         #EF4444;
  --ch-info:           #06B6D4;
  --ch-sidebar-width:  260px;
  --ch-topbar-height:  64px;
  --ch-transition:     all .2s ease;
}

[data-theme="dark"] {
  --ch-primary:        #3B82F6;
  --ch-primary-hover:  #2563EB;
  --ch-accent:         #22D3EE;
  --ch-accent-hover:   #06B6D4;
  --ch-bg:             #0F172A;
  --ch-surface:        #1E293B;
  --ch-sidebar-bg:     #0F172A;
  --ch-sidebar-text:   #64748B;
  --ch-sidebar-active: #F1F5F9;
  --ch-text:           #F1F5F9;
  --ch-text-muted:     #94A3B8;
  --ch-border:         #334155;
  --ch-shadow:         0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --ch-shadow-md:      0 4px 6px rgba(0,0,0,.3), 0 2px 4px rgba(0,0,0,.2);
  --ch-shadow-lg:      0 10px 15px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
}

*, *::before, *::after { box-sizing: border-box; }
html { transition: background-color .3s ease, color .3s ease; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--ch-bg);
  color: var(--ch-text);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
  transition: var(--ch-transition);
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
}

.ch-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--ch-sidebar-width);
  height: 100vh;
  background: var(--ch-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--ch-transition);
  border-right: 1px solid rgba(255,255,255,.05);
}

.ch-sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.ch-sidebar-logo .logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #F1F5F9;
  letter-spacing: -.5px;
}

.ch-sidebar-logo .logo-text span { color: var(--ch-accent); }

.ch-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.ch-nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ch-sidebar-text);
  opacity: .6;
}

.ch-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--ch-sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--ch-transition);
  position: relative;
  cursor: pointer;
}

.ch-nav-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--ch-sidebar-active);
  text-decoration: none;
}

.ch-nav-item.active {
  background: rgba(6,182,212,.08);
  color: var(--ch-sidebar-active);
}

.ch-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 3px;
  height: 100%;
  background: var(--ch-sidebar-accent);
  border-radius: 0 2px 2px 0;
}

.ch-nav-item i { width: 18px; height: 18px; flex-shrink: 0; }

.ch-topbar {
  position: fixed;
  top: 0;
  left: var(--ch-sidebar-width);
  right: 0;
  height: var(--ch-topbar-height);
  background: var(--ch-surface);
  border-bottom: 1px solid var(--ch-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 999;
  transition: var(--ch-transition);
}

.ch-topbar-left { display: flex; align-items: center; gap: 16px; }
.ch-topbar-right { display: flex; align-items: center; gap: 16px; }

.ch-theme-toggle {
  background: none;
  border: 1px solid var(--ch-border);
  color: var(--ch-text-muted);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  transition: var(--ch-transition);
}

.ch-theme-toggle:hover {
  border-color: var(--ch-primary);
  color: var(--ch-primary);
}

.ch-user-badge { display: flex; align-items: center; gap: 10px; cursor: pointer; }

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

.ch-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(37,99,235,.1);
  color: var(--ch-primary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.ch-main {
  margin-left: var(--ch-sidebar-width);
  padding: 28px;
  height: calc(100vh - var(--ch-topbar-height));
  overflow-y: auto;
  transition: var(--ch-transition);
}

.ch-card {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--ch-shadow);
  transition: var(--ch-transition);
}

.ch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ch-border);
}

.ch-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ch-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ch-stat {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--ch-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--ch-transition);
}

.ch-stat:hover { box-shadow: var(--ch-shadow-md); transform: translateY(-1px); }

.ch-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ch-stat-icon.blue  { background: rgba(37,99,235,.1);  color: var(--ch-primary); }
.ch-stat-icon.cyan  { background: rgba(6,182,212,.1);  color: var(--ch-accent);  }
.ch-stat-icon.green { background: rgba(16,185,129,.1); color: var(--ch-success); }
.ch-stat-icon.amber { background: rgba(245,158,11,.1); color: var(--ch-warning); }
.ch-stat-icon.red   { background: rgba(239,68,68,.1);  color: var(--ch-danger);  }

.ch-stat-value { font-size: 20px; font-weight: 700; color: var(--ch-text); line-height: 1; }
.ch-stat-label { font-size: 12px; color: var(--ch-text-muted); margin-top: 4px; font-weight: 500; }

.ch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--ch-transition);
  text-decoration: none;
}

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

.ch-btn-accent { background: var(--ch-accent); color: #fff; }
.ch-btn-accent:hover {
  background: var(--ch-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6,182,212,.3);
}

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

.ch-btn-danger { background: var(--ch-danger); color: #fff; }
.ch-btn-danger:hover { background: #DC2626; color: #fff; transform: translateY(-1px); }

.ch-btn-sm{
    padding: 6px 12px;
    font-size: 12px;
}

.ch-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.ch-alert-danger  { background: rgba(239,68,68,.1);  color: var(--ch-danger);  border: 1px solid rgba(239,68,68,.2);  }
.ch-alert-success { background: rgba(16,185,129,.1); color: var(--ch-success); border: 1px solid rgba(16,185,129,.2); }
.ch-alert-warning { background: rgba(245,158,11,.1); color: var(--ch-warning); border: 1px solid rgba(245,158,11,.2); }

.ch-table-wrapper {
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--ch-shadow);
}

.ch-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.ch-status-pending  { background: rgba(245,158,11,.1); color: var(--ch-warning); }
.ch-status-active   { background: rgba(16,185,129,.1); color: var(--ch-success); }
.ch-status-closed   { background: rgba(239,68,68,.1);  color: var(--ch-danger);  }
.ch-status-signed   { background: rgba(6,182,212,.1);  color: var(--ch-accent);  }
.ch-status-paid     { background: rgba(16,185,129,.1); color: var(--ch-success); }

.ch-page-header   { padding-top:45px; margin-bottom: 24px; }
.ch-page-title    { font-size: 22px; font-weight: 700; color: var(--ch-text); margin: 0 0 4px; }
.ch-page-subtitle { font-size: 13px; color: var(--ch-text-muted); }

.ch-notif-badge { position: relative; cursor: pointer; }
.ch-notif-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 8px; height: 8px;
  background: var(--ch-danger);
  border-radius: 50%;
  border: 2px solid var(--ch-surface);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ch-fade-in { animation: fadeInUp .3s ease forwards; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ch-border); border-radius: 10px; }

/* Form Controls */
.ch-form-group {
  margin-bottom: 20px;
}

.ch-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ch-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.ch-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--ch-surface);
  border: 1px solid var(--ch-border);
  border-radius: 8px;
  color: var(--ch-text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: var(--ch-transition);
  outline: none;
}

.ch-input:focus {
  border-color: var(--ch-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

select.ch-input {
  cursor: pointer;
}

.ch-alert {
  transition: opacity 1s ease;
}

.ch-alert.fade-out {
  opacity: 0;
}

select.ch-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.ch-badge-info{
  font-size: 18px;
}