


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


:root {
  --bg:          #0c0e14;
  --bg2:         #11131c;
  --surface:     #181b27;
  --surface2:    #1f2235;
  --surface3:    #272b42;
  --border:      #2a2f4a;
  --accent:      #7c6dfa;
  --accent-dim:  #5a4fd4;
  --accent2:     #fa6d8f;
  --success:     #4ecca3;
  --warn:        #f9c74f;
  --danger:      #f94144;
  --text:        #dde1f5;
  --text-muted:  #7a80a8;
  --text-faint:  #454b6e;
  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.35);
  --shadow:      0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.65);
  --sidebar-w:   220px;
  --header-h:    60px;
}


body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  
  font-family: 'DM Sans', system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }


.shell {
  display: flex;
  min-height: 100vh;
}


.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;
  height: 100vh;
  z-index: 50;
  
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.4rem 1.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.sidebar-section {
  padding: 1rem 0.8rem 0.4rem;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 0.6rem;
  margin-bottom: 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface3);
  color: var(--text);
}

.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.8rem;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.user-card:hover { background: var(--surface2); }

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

.user-info { overflow: hidden; }
.user-name { font-size: 0.82rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }


.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}


.topbar {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  
  padding: 0 1.8rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}


.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-dim); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface2); color: var(--text); }

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

.btn-danger:hover { opacity: 0.85; }

.btn-success {
  background: var(--success);
  color: #000;
}

.btn-success:hover { opacity: 0.85; }


.page-body {
  padding: 2rem 2.2rem;
  flex: 1;
}


.stats-grid {
  display: grid;
  
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

.stat-card.green::before  { background: var(--success); }
.stat-card.yellow::before { background: var(--warn); }
.stat-card.red::before    { background: var(--danger); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}


.progress-wrap {
  background: var(--surface3);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-top: 0.8rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.5s ease;
  width: 0%;
}


.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}


.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  z-index: 300;
  box-shadow: var(--shadow-lg);
}

.overlay.open, .modal.open { display: block; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close {
  background: var(--surface2);
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover { background: var(--surface3); color: var(--text); }


.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.form-label .req { color: var(--accent2); }

.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

.form-control:focus { border-color: var(--accent); }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.4rem;
}


.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.empty-state-text { font-size: 0.9rem; }


.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
}

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


.sidebar-toggle {
  display: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}


@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 1.2rem; }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
  }
  .sidebar-overlay.open { display: block; }
}
