/* ===========================================================
   SIKHA — Sistem Kehadiran Siswa
   Design System v2.0 (Tailwind v4 Inspired)
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --font-family-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --color-primary: #2563eb;
  --color-primary-light: #4c98fd;
  --color-primary-dark: #1e3a8a;
  --color-primary-pressed: #1a3270;
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-secondary: #1e3a8a;
  --color-secondary-light: #dbeafe;
  --color-background: #f1f5f9;
  --color-sidebar: #1e293b;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-hover: #334155;
  --color-sidebar-active: #475569;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-success: #22c55e;
  --color-success-bg: #dcfce7;
  --color-success-text: #166534;
  --color-warning: #f97316;
  --color-warning-bg: #ffedd5;
  --color-warning-text: #9a3412;
  --color-error: #ef4444;
  --color-error-bg: #fee2e2;
  --color-error-text: #991b1b;
  --color-info: #2563eb;
  --color-info-bg: #eff6ff;
  --color-info-text: #1e3a8a;

  /* Spacing scale (matching Tailwind) */
  --spacing: 0.25rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
}

/* ===== RESET & BASE ===== */
*, ::before, ::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid; }

html {
  font-family: var(--font-family-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--color-background);
  color: var(--color-text);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-text);
}
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }

a { color: inherit; text-decoration: inherit; }
::selection { background: var(--color-primary); color: #fff; }

/* ===== LAYOUT ===== */
.layout-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: all 0.3s ease;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }

.sidebar-brand {
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 2.5rem; height: 2.5rem;
  background: #fff;
  border-radius: 0.625rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(37,99,235,0.1);
}
.sidebar-brand-icon svg { width: 100%; height: 100%; color: var(--color-primary); }
.sidebar-brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand-text { min-width: 0; transition: opacity 0.3s; }
.sidebar.collapsed .sidebar-brand-text { opacity: 0; width: 0; overflow: hidden; }
.sidebar-brand-text h3 { font-size: 0.875rem; font-weight: 700; color: #fff; margin: 0; line-height: 1.3; }
.sidebar-brand-text small { font-size: 0.625rem; color: var(--color-sidebar-text); display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.625rem;
  margin-top: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

.sidebar-section {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 0.5rem 0.75rem 0.25rem;
}
.sidebar.collapsed .sidebar-section { text-align: center; font-size: 0.5rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--color-sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 0.125rem;
}
.sidebar-link:hover { background: var(--color-sidebar-hover); color: #fff; }
.sidebar-link-active {
  background: var(--color-sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.sidebar-link svg {
  width: 1rem; height: 1rem;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-link:hover svg,
.sidebar-link-active svg { opacity: 1; }
.sidebar-link span { transition: opacity 0.3s; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 0.5rem; width: 2.5rem; height: 2.5rem; margin: 0 auto; }
.sidebar.collapsed .sidebar-link span { opacity: 0; width: 0; overflow: hidden; }

.sidebar-footer {
  padding: 0.625rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
}
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar-user-avatar {
  width: 1.75rem; height: 1.75rem;
  border-radius: 9999px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-avatar span { font-size: 0.75rem; font-weight: 700; color: var(--color-primary); }
.sidebar-user-info { min-width: 0; transition: opacity 0.3s; }
.sidebar.collapsed .sidebar-user-info { opacity: 0; width: 0; overflow: hidden; }
.sidebar-user-name { font-size: 0.75rem; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 0.625rem; color: var(--color-sidebar-text); }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  min-width: 0;
  transition: margin-left 0.3s ease;
}
.sidebar.collapsed + .sidebar-overlay + .main-content,
.sidebar.collapsed ~ .main-content,
body:has(.sidebar.collapsed) .main-content {
  margin-left: 64px;
}

/* ---- TOPBAR ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: 3.5rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
@media (min-width: 992px) {
  .topbar { padding: 0 1.5rem; }
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* Live Clock */
.live-clock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--color-primary-50);
  border-radius: 0.625rem;
  color: var(--color-primary);
  flex-shrink: 0;
}
.live-clock svg { flex-shrink: 0; opacity: 0.8; }
.live-clock-text { display: flex; flex-direction: column; line-height: 1.2; }
.live-clock-time {
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Inter', monospace;
  letter-spacing: 0.02em;
}
.live-clock-date {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}
@media (max-width: 639.98px) {
  .live-clock-text { display: none; }
  .live-clock { padding: 0.5rem; }
}
.topbar-title {
  font-family: var(--font-family-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar toggle */
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: #f1f5f9; color: var(--color-text); }
.sidebar-toggle.d-none { display: none !important; }
@media (min-width: 992px) {
  .sidebar-toggle { display: inline-flex; }
}

/* User dropdown */
.user-dropdown {
  position: relative;
  display: inline-flex;
}
.user-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
}
.user-dropdown-trigger:hover { background: #f1f5f9; color: var(--color-text); }
.user-dropdown-avatar {
  width: 1.5rem; height: 1.5rem;
  border-radius: 0.375rem;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}
.user-dropdown-avatar span { font-size: 0.625rem; font-weight: 700; color: #fff; }
.user-dropdown-name { display: none; }
@media (min-width: 640px) {
  .user-dropdown-name { display: block; font-size: 0.75rem; font-weight: 500; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.user-dropdown-chevron { width: 0.875rem; height: 0.875rem; color: var(--color-text-muted); }

.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 12rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.15s;
  padding: 0.375rem;
}
.user-dropdown-menu.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.1s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.user-dropdown-item:hover { background: #f1f5f9; color: var(--color-text); }
.user-dropdown-item.text-error { color: var(--color-error); }
.user-dropdown-item.text-error:hover { background: var(--color-error-bg); }
.user-dropdown-divider { height: 1px; background: var(--color-border); margin: 0.25rem 0.5rem; }

/* ---- CONTENT AREA ---- */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
@media (min-width: 992px) {
  .content-area { padding: 1.5rem; }
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- SIDEBAR OVERLAY (mobile) ---- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.show { display: block; }

/* ===== RESPONSIVE - MOBILE SIDEBAR ===== */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 240px !important;
    border-radius: 0 1rem 1rem 0;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 240px !important; }
  .sidebar.collapsed .sidebar-brand-text,
  .sidebar.collapsed .sidebar-user-info,
  .sidebar.collapsed .sidebar-link span,
  .sidebar.collapsed .sidebar-section { opacity: 1; width: auto; overflow: visible; }
  .sidebar.collapsed .sidebar-link { justify-content: flex-start; width: auto; height: auto; margin: 0; padding: 0.5rem 0.75rem; }
  .sidebar.collapsed .sidebar-user { justify-content: flex-start; }
  .sidebar-toggle.d-none { display: inline-flex !important; }
  .main-content { margin-left: 0 !important; }
  body:has(.sidebar.collapsed) .main-content { margin-left: 0 !important; }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}
.page-title {
  font-family: var(--font-family-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.025em;
  margin: 0;
}
.page-desc { margin-top: 0.125rem; font-size: 0.75rem; color: var(--color-text-muted); }

.toolbar-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) {
  .toolbar-row {
    flex-direction: row;
    align-items: flex-end;
  }
}
.toolbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02), 0 4px 12px rgba(0,0,0,0.02);
  transition: all 0.2s;
}
.card-hover:hover {
  border-color: var(--color-primary-100);
  box-shadow: 0 4px 8px rgba(0,0,0,0.04), 0 16px 32px rgba(0,0,0,0.04);
}
.card-button {
  cursor: pointer;
  transition: all 0.15s;
}
.card-button:hover {
  border-color: var(--color-primary-100);
  box-shadow: 0 4px 8px rgba(0,0,0,0.04), 0 16px 32px rgba(0,0,0,0.04);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }
.card-body.p-0 { padding: 0; }
.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
}
.card-title { font-size: 0.875rem; font-weight: 700; margin: 0; }

/* Stat cards */
.stat-card {
  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: 0.625rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
}
.stat-card:hover { border-color: var(--color-primary-100); }
.stat-icon {
  width: 2.75rem; height: 2.75rem;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 1rem; height: 1rem; }
.stat-label { font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-top: 0.125rem; font-variant-numeric: tabular-nums; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}
.btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-border), 0 0 0 4px rgba(37,99,235,0.15);
}

.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-primary:active { background: var(--color-primary-pressed); }
.btn-primary:disabled { background: #BFDBFE; border-color: #BFDBFE; color: rgba(255,255,255,0.8); }

.btn-success { background: #22C55E; color: #fff; border-color: #22C55E; }
.btn-success:hover { background: #16A34A; }
.btn-warning { background: #F97316; color: #fff; border-color: #F97316; }
.btn-warning:hover { background: #EA580C; }
.btn-danger { background: #EF4444; color: #fff; border-color: #EF4444; }
.btn-danger:hover { background: #DC2626; }

.btn-sm { height: 1.875rem; padding: 0 0.625rem; font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-lg { height: 2.75rem; padding: 0 1.25rem; font-size: 0.9375rem; }
.btn-icon { width: 2.25rem; padding: 0; justify-content: center; }
.btn-sm.btn-icon { width: 1.875rem; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; }

/* ===== FORMS ===== */
.label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.label .required { color: var(--color-error); margin-left: 2px; }

.input, .form-control {
  width: 100%;
  height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  color: var(--color-text);
  transition: all 0.15s;
  outline: none;
}
.input::placeholder { color: rgba(100,116,139,0.6); }
.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
  outline: none;
}
.input-error { border-color: var(--color-error); }
.input-error:focus { box-shadow: 0 0 0 2px rgba(239,68,68,0.15); }
.input:disabled { cursor: not-allowed; background: var(--color-background); color: var(--color-text-secondary); }

select.input, select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364748B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem;
  padding: 0.5rem 2.5rem 0.5rem 0.875rem;
  cursor: pointer;
}
textarea.input, textarea.form-control {
  height: auto;
  min-height: 5rem;
  resize: vertical;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check-input {
  width: 1rem; height: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.25rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.form-check-label { font-size: 0.85rem; color: var(--color-text); cursor: pointer; }
.form-text { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.4;
  gap: 0.25rem;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-error { background: var(--color-error-bg); color: var(--color-error-text); }
.badge-info { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-secondary { background: #F1F5F9; color: #475569; }
.badge-primary { background: var(--color-primary-100); color: var(--color-primary-dark); }

/* ===== TABLE ===== */
.table-container {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: #fff;
}
.table-container.border-0 { border: 0; border-radius: none; }
table.table {
  width: 100%;
  border-collapse: collapse;
}
table.table thead { background: #F8FAFC; }
table.table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
table.table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}
table.table tbody tr:last-child { border-bottom: none; }
table.table tbody tr:hover { background: #F8FAFC; }
table.table tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  vertical-align: middle;
}
table.table th:first-child { padding-left: 1.25rem; }
table.table td:first-child { padding-left: 1.25rem; }
table.table th:last-child, table.table td:last-child { padding-right: 1.25rem; }

/* ===== THREE-DOT MENU ===== */
.dot-menu { position: relative; display: inline-flex; }
.dot-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  transition: all 0.15s;
  cursor: pointer;
  background: none;
  border: none;
}
.dot-menu-trigger:hover { background: #f1f5f9; color: var(--color-text); }
.dot-menu-items {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  min-width: 10rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  z-index: 300;
  padding: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.15s;
}
.dot-menu-items.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dot-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all 0.1s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.dot-menu-item:hover { background: #f1f5f9; color: var(--color-text); }
.dot-menu-item.text-error { color: var(--color-error); }
.dot-menu-item.text-error:hover { background: var(--color-error-bg); }
.dot-menu-item svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }
.dot-menu-items form { display: flex; margin: 0; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content {
  background: #fff;
  border-radius: 1rem;
  width: 100%;
  max-width: 28rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease-out;
}
.modal-content.wide { max-width: 36rem; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-header h5 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close {
  width: 2rem; height: 2rem;
  border: none; background: none;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--color-background); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.25rem;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ===== ALERTS ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.alert-danger { background: var(--color-error-bg); color: var(--color-error-text); border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid rgba(34,197,94,0.2); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning-text); border: 1px solid rgba(249,115,22,0.2); }
.alert-info { background: var(--color-info-bg); color: var(--color-info-text); border: 1px solid rgba(37,99,235,0.2); }
.alert-heading { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.25rem; }

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeSlideUp 0.35s ease-out both;
}
.animate-in-delay-1 { animation-delay: 50ms; }
.animate-in-delay-2 { animation-delay: 0.1s; }
.animate-in-delay-3 { animation-delay: 0.15s; }
.animate-in-delay-4 { animation-delay: 0.2s; }

@keyframes scan-line {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
.animate-scan-line { animation: scan-line 2s ease-in-out infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes ping { 75%, 100% { opacity: 0; transform: scale(2); } }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.25rem; margin-top: 1.5rem; }
.pagination-btn, .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.25rem; height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}
.pagination-btn:hover, .page-link:hover { background: #f1f5f9; }
.pagination-btn-active, .page-link.active, .page-item.active .page-link {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

/* ===== GRID ===== */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.gap-0\.5 { gap: 0.125rem; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* ===== FLEX ===== */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

/* ===== TYPOGRAPHY ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-info { color: var(--color-info); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-heading { font-family: var(--font-family-heading); }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ===== WIDTH / HEIGHT ===== */
.w-full { width: 100%; }
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-4\.5 { width: 1.125rem; }
.w-5 { width: 1.25rem; }
.w-7 { width: 1.75rem; }
.w-8 { width: 2rem; }
.w-9 { width: 2.25rem; }
.w-11 { width: 2.75rem; }
.w-16 { width: 4rem; }
.w-60 { width: 15rem; }
.h-full { height: 100%; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; }
.h-8 { height: 2rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-11 { height: 2.75rem; }
.h-14 { height: 3.5rem; }
.h-16 { height: 4rem; }
.h-56 { height: 14rem; }
.h-64 { height: 16rem; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.min-h-0 { min-height: 0; }
.min-w-0 { min-width: 0; }
.max-w-sm { max-width: 24rem; }
.max-w-xs { max-width: 20rem; }
.max-w-5xl { max-width: 64rem; }

/* ===== SPACING ===== */
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.pr-10 { padding-right: 2.5rem; }
.pl-9 { padding-left: 2.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pr-2\.5 { padding-right: 0.625rem; }
.pt-4 { padding-top: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.ps-0 { padding-left: 0; }
.ps-4 { padding-left: 1rem; }
.pe-4 { padding-right: 1rem; }

/* ===== BORDERS ===== */
.border { border: 1px solid var(--color-border); }
.border-0 { border: 0; }
.border-2 { border-width: 2px; }
.border-t { border-top: 1px solid var(--color-border); }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-r { border-right: 1px solid var(--color-border); }
.border-l-2 { border-left-width: 2px; }
.border-primary { border-color: var(--color-primary); }
.border-border { border-color: var(--color-border); }
.border-dashed { border-style: dashed; }
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: 9999px; }

/* ===== SHADOWS ===== */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08); }
.shadow-lg { box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.shadow-none { box-shadow: none; }

/* ===== BACKGROUNDS ===== */
.bg-white { background: #fff; }
.bg-background { background: var(--color-background); }
.bg-primary { background: var(--color-primary); }
.bg-primary-50 { background: var(--color-primary-50); }
.bg-primary-light { background: var(--color-primary-light); }
.bg-secondary { background: var(--color-secondary); }
.bg-success { background: var(--color-success); }
.bg-success-bg { background: var(--color-success-bg); }
.bg-warning { background: var(--color-warning); }
.bg-warning-bg { background: var(--color-warning-bg); }
.bg-error { background: var(--color-error); }
.bg-error-bg { background: var(--color-error-bg); }
.bg-info-bg { background: var(--color-info-bg); }
.bg-transparent { background: transparent; }
.bg-sidebar { background: var(--color-sidebar); }
.bg-sidebar-active { background: var(--color-sidebar-active); }
.bg-slate-50 { background: #f8fafc; }
.bg-slate-100 { background: #f1f5f9; }

.text-white { color: #fff; }
.text-dark { color: var(--color-text); }

/* ===== DISPLAY / UTILITY ===== */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-print-none { /* print hide */ }

.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-y-0 { top: 0; bottom: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.left-0 { left: 0; }
.left-3 { left: 0.75rem; }
.right-2 { right: 0.5rem; }
.top-1\/2 { top: 50%; }
.top-4 { top: 1rem; }
.right-4 { right: 1rem; }
.bottom-0 { bottom: 0; }
.z-40 { z-index: 40; }
.z-\[100\] { z-index: 100; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.-translate-x-full { transform: translateX(-100%); }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Space between children */
.space-y-0\.5 > * + * { margin-top: 0.125rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Group hover */
.group:hover .group-hover\:opacity-100 { opacity: 1; }

/* Progress bar */
.h-1\.5 { height: 0.375rem; }
.h-2 { height: 0.5rem; }
.overflow-hidden { overflow: hidden; }
.rounded-full { border-radius: 9999px; }

/* Chart fill */
.fill-text-muted { fill: var(--color-text-muted); }

/* Responsive helpers */
@media (min-width: 992px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
  .lg\:relative { position: relative; }
  .lg\:w-16 { width: 4rem; }
  .lg\:w-10 { width: 2.5rem; }
  .lg\:h-10 { height: 2.5rem; }
  .lg\:px-0 { padding-left: 0; padding-right: 0; }
  .lg\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .lg\:p-6 { padding: 1.5rem; }
  .lg\:mx-auto { margin-left: auto; margin-right: auto; }
  .lg\:justify-center { justify-content: center; }
  .lg\:items-end { align-items: flex-end; }
  .lg\:py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
  .lg\:opacity-0 { opacity: 0; }
  .lg\:w-0 { width: 0; }
  .lg\:overflow-hidden { overflow: hidden; }
  .lg\:shrink-0 { flex-shrink: 0; }
}
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:hidden { display: none; }
  .sm\:p-2 { padding: 0.5rem; }
}

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar, .d-print-none { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
}
