/* ============ SHREIK GLOBAL — Design System ============ */
/* Adapted from Adminator 2026 design tokens */

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

/* ============ DESIGN TOKENS ============ */
:root {
  --bg-body: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F8FAFC;
  --bg-muted: #F1F5F9;
  --t-base: #1E293B;
  --t-muted: #64748B;
  --t-light: #94A3B8;
  --t-inverse: #FFFFFF;
  --border: #E4E8EF;
  --border-soft: #EEF1F5;
  --primary: #0E6E5C;
  --primary-light: #10B981;
  --primary-dark: #065F46;
  --primary-soft: #ECFDF5;
  --primary-ring: rgba(14, 110, 92, 0.18);
  --success: #10B981;
  --success-soft: #ECFDF5;
  --warning: #F59E0B;
  --warning-soft: #FFFBEB;
  --danger: #EF4444;
  --danger-soft: #FEF2F2;
  --info: #0EA5E9;
  --info-soft: #F0F9FF;
  --purple: #8B5CF6;
  --purple-soft: #F5F3FF;
  --pink: #EC4899;
  --pink-soft: #FDF2F8;
  --teal: #14B8A6;
  --teal-soft: #F0FDFA;
  --orange: #F97316;
  --orange-soft: #FFF7ED;
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  --shadow-card: 0 1px 3px 0 rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.05);
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--t-base);
  background: var(--bg-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: color .18s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ============ LAYOUT SHELL ============ */
.shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }
.main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.content { flex: 1; padding: 24px 28px 40px; }

/* ============ SIDEBAR ============ */
.d-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.d-sidebar::-webkit-scrollbar { width: 4px; }
.d-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 6px;
}
.brand img { height: 38px; width: auto; }
.brand-text { line-height: 1.15; }
.brand-name {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--t-base);
  letter-spacing: -0.02em;
}
.brand-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--t-light);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--t-light);
  padding: 12px 10px 6px;
}
.nav-divider { height: 1px; background: var(--border-soft); margin: 8px 10px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--t-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all .18s ease;
  line-height: 1.2;
  white-space: nowrap;
}
.nav-link i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: var(--bg-hover); color: var(--t-base); text-decoration: none; }
.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 600;
}
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
  background: var(--danger);
  color: #fff;
}

/* ============ TOPBAR ============ */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--t-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.breadcrumb-nav {
  font-size: 13px;
  color: var(--t-muted);
}
.breadcrumb-nav span { color: var(--t-light); margin: 0 6px; }

.topbar-search {
  position: relative;
  max-width: 280px;
  flex: 1;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  color: var(--t-base);
  transition: all .2s;
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t-light);
  font-size: 14px;
}

/* Notification Bell */
.notif-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--t-muted);
  font-size: 19px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all .18s;
}
.notif-btn:hover { background: var(--bg-muted); color: var(--t-base); }
.notif-count {
  position: absolute;
  top: 0; right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
}
.notif-count:empty, .notif-count[data-count="0"] { display: none; }

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .18s;
}
.user-menu:hover { background: var(--bg-muted); }
.user-menu-info { line-height: 1.2; text-align: right; }
.user-menu-name { font-weight: 600; font-size: 13px; color: var(--t-base); }
.user-menu-role { font-size: 11px; color: var(--t-muted); }

/* Avatars */
.avatar {
  border-radius: 50%;
  object-fit: cover;
}
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  font-family: 'Inter Tight', sans-serif;
  flex-shrink: 0;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--t-base);
  margin: 0;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-muted);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ============ KPI CARDS ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform .18s, box-shadow .18s;
  cursor: pointer;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.kpi-icon.primary { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.info { background: var(--info-soft); color: var(--info); }
.kpi-icon.purple { background: var(--purple-soft); color: var(--purple); }
.kpi-icon.orange { background: var(--orange-soft); color: var(--orange); }
.kpi-icon.teal { background: var(--teal-soft); color: var(--teal); }
.kpi-label { font-size: 12px; color: var(--t-muted); font-weight: 500; }
.kpi-value {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--t-base);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.kpi-compare { font-size: 12px; color: var(--t-muted); margin-top: 4px; }

/* ============ HERO ============ */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 20px;
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--t-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--t-base);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 4px 0 6px;
}
.hero-title .accent { color: var(--primary); }
.hero-sub { font-size: 13.5px; color: var(--t-muted); max-width: 540px; }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  line-height: 1.3;
}
.btn i { font-size: 15px; }
.btn-primary, .btn--primary {
  background: var(--primary);
  color: var(--t-inverse);
  box-shadow: 0 1px 3px 0 rgb(14 110 92 / 0.3);
}
.btn-primary:hover, .btn--primary:hover {
  background: var(--primary-dark);
  color: var(--t-inverse);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgb(14 110 92 / 0.35);
}
.btn-ghost, .btn--ghost {
  background: var(--bg-card);
  color: var(--t-base);
  border: 1px solid var(--border);
}
.btn-ghost:hover, .btn--ghost:hover {
  background: var(--bg-muted);
  border-color: var(--border);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: #92400E; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-secondary { background: var(--bg-muted); color: var(--t-muted); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }

/* ============ TABLES ============ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-wrap .table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--bg-muted);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  vertical-align: middle;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* ============ FORMS ============ */
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t-base);
  margin-bottom: 5px;
  display: block;
}
.form-control, .form-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--t-base);
  transition: all .2s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control::placeholder { color: var(--t-light); }
textarea.form-control { min-height: 100px; resize: vertical; }
.form-text { font-size: 12px; color: var(--t-muted); margin-top: 4px; }
.form-check-input { accent-color: var(--primary); }

/* ============ STATUS SUMMARY PILLS ============ */
.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t-muted);
  cursor: pointer;
  transition: all .18s;
}
.status-pill:hover { border-color: var(--primary); color: var(--primary); }
.status-pill.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.status-pill .count {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--t-base);
}

/* ============ TASK WORKFLOW STEPS ============ */
.workflow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0;
  overflow-x: auto;
  padding: 8px 0;
}
.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  position: relative;
}
.workflow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.workflow-step.completed:not(:last-child)::after { background: var(--success); }
.workflow-step.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--primary) 50%, var(--border) 50%);
}
.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  z-index: 1;
  background: var(--bg-muted);
  color: var(--t-light);
  border: 2px solid var(--border);
}
.workflow-step.completed .step-circle { background: var(--success); color: #fff; border-color: var(--success); }
.workflow-step.active .step-circle { background: var(--primary); color: #fff; border-color: var(--primary); animation: pulse 2s infinite; }
.workflow-step.rework .step-circle { background: var(--danger); color: #fff; border-color: var(--danger); }
.step-label { font-size: 11px; color: var(--t-muted); margin-top: 6px; text-align: center; font-weight: 500; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 110, 92, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(14, 110, 92, 0); }
}

/* ============ PROGRESS BAR ============ */
.progress-bar-wrap {
  background: var(--bg-muted);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width .4s ease;
}
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -28px; top: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--bg-muted);
  border: 2px solid var(--border);
  color: var(--t-light);
  z-index: 1;
}
.timeline-dot.primary { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.timeline-dot.success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.timeline-dot.warning { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.timeline-dot.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.timeline-content { font-size: 13px; color: var(--t-base); }
.timeline-meta { font-size: 11.5px; color: var(--t-light); margin-top: 2px; }

/* ============ TOAST NOTIFICATIONS ============ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 300px;
  max-width: 420px;
  animation: slideIn .3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
.toast i { font-size: 18px; }
.toast .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--t-light);
  cursor: pointer;
  font-size: 16px;
}

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

/* ============ DROPDOWN ============ */
.dropdown-menu-custom {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 6px;
  z-index: 1050;
  display: none;
}
.dropdown-menu-custom.show { display: block; }
.dropdown-item-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--t-base);
  transition: background .12s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item-custom:hover { background: var(--bg-hover); text-decoration: none; }
.dropdown-item-custom i { width: 18px; color: var(--t-muted); }
.dropdown-divider { height: 1px; background: var(--border-soft); margin: 4px 0; }

/* ============ NOTIFICATION DROPDOWN ============ */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  display: none;
}
.notif-dropdown.show { display: block; }
.notif-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-dropdown-header h6 { margin: 0; font-size: 14px; font-weight: 600; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .12s;
  cursor: pointer;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 500; color: var(--t-base); }
.notif-item-text { font-size: 12px; color: var(--t-muted); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--t-light); margin-top: 3px; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h5 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--t-light); cursor: pointer; padding: 2px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 8px; }

/* ============ CHAT ============ */
.chat-shell { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - var(--topbar-height) - 48px); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.chat-rail { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.chat-rail-head { padding: 16px; border-bottom: 1px solid var(--border-soft); }
.chat-rail-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.chat-search { position: relative; }
.chat-search input {
  width: 100%;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
}
.chat-search input:focus { outline: none; border-color: var(--primary); }
.chat-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--t-light); font-size: 13px; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-conv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background .12s;
}
.chat-conv:hover { background: var(--bg-hover); }
.chat-conv.active { background: var(--primary-soft); }
.chat-conv-body { flex: 1; min-width: 0; }
.chat-conv-name { font-weight: 600; font-size: 13px; }
.chat-conv-preview { font-size: 12px; color: var(--t-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv-time { font-size: 11px; color: var(--t-light); }
.chat-conv-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-main { display: flex; flex-direction: column; }
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header-name { font-weight: 600; font-size: 14px; }
.chat-header-status { font-size: 12px; color: var(--t-muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; max-width: 70%; }
.chat-msg.sent { margin-left: auto; flex-direction: row-reverse; }
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg-muted);
  border: 1px solid var(--border-soft);
}
.chat-msg.sent .chat-bubble {
  background: var(--primary);
  color: #fff;
  border: none;
}
.chat-msg-time { font-size: 10px; color: var(--t-light); margin-top: 4px; }
.chat-date-sep { text-align: center; font-size: 11px; color: var(--t-light); padding: 8px 0; }
.chat-composer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.chat-composer textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  resize: none;
  max-height: 120px;
  font-size: 13px;
  background: var(--bg-muted);
}
.chat-composer textarea:focus { outline: none; border-color: var(--primary); background: var(--bg-card); }
.chat-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .18s;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-dark); }

/* ============ AUTH PAGES ============ */
.auth-shell { display: grid; grid-template-columns: 420px 1fr; min-height: 100vh; }
.auth-aside {
  background: linear-gradient(135deg, #0E6E5C 0%, #065F46 50%, #1E293B 100%);
  color: #fff;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
}
.auth-aside-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; }
.auth-aside-brand img { height: 48px; }
.auth-aside-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-aside h1 { font-family: 'Inter Tight', sans-serif; font-size: 28px; font-weight: 700; line-height: 1.2; margin-bottom: 14px; }
.auth-aside p { font-size: 14px; opacity: .8; line-height: 1.7; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-family: 'Inter Tight', sans-serif; font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { color: var(--t-muted); font-size: 14px; margin-bottom: 28px; }
.auth-form .field { margin-bottom: 18px; }
.auth-form .field-label { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; display: block; }
.auth-form .input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--t-base);
  transition: all .2s;
}
.auth-form .input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.auth-submit { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 6px; }

/* ============ CHECKBOX ROLES (User Create) ============ */
.role-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.role-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-muted);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .18s;
}
.role-check-item:hover { border-color: var(--primary-light); }
.role-check-item.checked { background: var(--primary-soft); border-color: var(--primary); }
.role-check-item input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }
.role-check-item .role-info { line-height: 1.3; }
.role-check-item .role-name { font-weight: 600; font-size: 13px; }
.role-check-item .role-desc { font-size: 11px; color: var(--t-muted); }

/* ============ MISC ============ */
.text-muted { color: var(--t-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-purple { color: var(--purple) !important; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: var(--t-light); margin-bottom: 14px; }
.empty-state h4 { color: var(--t-muted); font-weight: 600; margin-bottom: 6px; }
.empty-state p { color: var(--t-light); font-size: 13px; }

.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .d-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .d-sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .content { padding: 16px; }
  .hero { flex-direction: column; }
  .hero-actions { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chat-shell { grid-template-columns: 1fr; }
  .chat-rail { display: none; }
  .chat-rail.show { display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: 320px; z-index: 1050; background: var(--bg-card); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .table-wrap { overflow-x: auto; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-search { display: none; }
  .user-menu-info { display: none; }
  .hero-title { font-size: 22px; }
  .modal-box { max-width: 100%; margin: 10px; }
  .notif-dropdown { width: calc(100vw - 20px); right: -60px; }
  .workflow-steps { gap: 0; }
  .workflow-step { min-width: 80px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .status-pills { flex-direction: column; }
  .status-pill { justify-content: space-between; }
  html { font-size: 13px; }
}

/* ============ UTILITIES ============ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.rounded { border-radius: var(--radius); }
.overflow-hidden { overflow: hidden; }
.text-muted { color: var(--t-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ============ ROLE ASSIGNMENT GRID ============ */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.role-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg-card);
}
.role-card:hover { border-color: var(--primary-light); }
.role-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.role-card input[type="checkbox"] { display: none; }
.role-card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.role-card-desc {
  font-size: 12px;
  color: var(--t-muted);
  line-height: 1.5;
}
.role-card-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all .2s;
}
.role-card.selected .role-card-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ============ STATUS SUMMARY ============ */
.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-summary .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-muted);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--t-muted);
}
.status-summary .status-item .count {
  font-weight: 700;
  color: var(--t-base);
}

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  margin-bottom: 16px;
}
.filter-bar input,
.filter-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-body);
  min-width: 140px;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ============ TWO-COLUMN LAYOUT ============ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ============ NOTIFICATION ROWS ============ */
.notif-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .15s;
  cursor: pointer;
}
.notif-row:hover { background: var(--bg-hover); }
.notif-row.unread {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
}
.notif-row .notif-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.notif-row .notif-body { flex: 1; min-width: 0; }
.notif-row .notif-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-row .notif-msg { font-size: 12px; color: var(--t-muted); line-height: 1.5; }
.notif-row .notif-time { font-size: 11px; color: var(--t-light); white-space: nowrap; }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--t-light);
}
.empty-state i { font-size: 40px; margin-bottom: 10px; display: block; }
.empty-state p { font-size: 13px; max-width: 300px; margin: 0 auto; }

/* ============ TABLE WRAP ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============ AVATAR INITIALS ============ */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 20px 0;
}
.page-item .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--t-base);
  background: var(--bg-card);
  text-decoration: none;
  transition: all .15s;
}
.page-item .page-link:hover { background: var(--bg-muted); border-color: var(--primary); }
.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.page-item.disabled .page-link {
  color: var(--t-light);
  pointer-events: none;
  background: var(--bg-body);
}

@media (max-width: 768px) {
  .role-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { min-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .role-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
