/* ============================================================
   UMG-OS Stylesheet
   Brand: Udorn Medical Group
   Design: Minimal, Professional, Accessible
   ============================================================ */

/* Anuphan — Thai | Fira Sans — English */
@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@300;400;500;600;700&family=Fira+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');
/* Tabler Icons webfont */
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.11.0/dist/tabler-icons.min.css');

/* ============================================================
   CSS Variables - UMG Brand Colors
   ============================================================ */
:root {
  /* Primary Brand Blue */
  --blue-50:  #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --blue-300: #93C5FD;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-800: #1E40AF;
  --blue-900: #1E3A8A;

  /* UMG Specific Blues */
  --umg-primary:    #1E7ABF;   /* Main UMG blue from logo */
  --umg-primary-dark: #1560A0;
  --umg-primary-light: #3FA0E0;
  --umg-bg:         #EAF4FB;   /* Page background */

  /* Accent Red (from logo/tagline) */
  --umg-red:        #E31E24;
  --umg-red-dark:   #C0181D;
  --umg-red-light:  #FDECEA;

  /* Neutrals */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Status Colors */
  --success:  #10B981;
  --warning:  #F59E0B;
  --danger:   #EF4444;
  --info:     #3B82F6;

  /* UI */
  --white:    #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-main: 'Anuphan', 'Fira Sans', sans-serif;
  --font-en:   'Fira Sans', sans-serif;
  --font-th:   'Anuphan', sans-serif;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-main);
  font-size: var(--text-base);
  color: var(--gray-800);
  background-color: #F1F5F9;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

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

.login-page::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(30,122,191,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(30,122,191,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(30,122,191,0.05);
  padding: 40px 44px;
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
  animation: cardEntrance 0.5s ease-out;
}

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

.login-logo {
  text-align: center;
  margin-bottom: 8px;
}

.login-logo img {
  height: 70px;
  width: auto;
}

.login-tagline {
  text-align: center;
  color: var(--umg-red);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.login-title {
  text-align: center;
  margin-bottom: 4px;
}

.login-title h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--umg-primary);
}

.login-title p {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: 24px;
  margin-top: 2px;
}

.login-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 20px 0;
}

/* Form */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--umg-red);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: var(--text-sm);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--umg-primary);
  box-shadow: 0 0 0 3px rgba(30,122,191,0.12);
}

.form-control::placeholder { color: var(--gray-400); }

.form-control:invalid.touched { border-color: var(--danger); }

.input-wrapper {
  position: relative;
}

.input-wrapper .form-control {
  padding-right: 44px;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.input-icon:hover { color: var(--umg-primary); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #1E7ABF 0%, #1560A0 100%);
  color: var(--white);
  width: 100%;
  padding: 13px;
  font-size: var(--text-base);
  margin-top: 4px;
  box-shadow: 0 2px 6px rgba(30,122,191,0.30);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1560A0 0%, #0f4f87 100%);
  box-shadow: 0 4px 14px rgba(30,122,191,0.40);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover { background: var(--gray-200); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--umg-primary);
  color: var(--umg-primary);
}

.btn-outline:hover { background: var(--blue-50); }

.btn-sm { padding: 7px 14px; font-size: var(--text-xs); border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: var(--text-lg); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; border-left: 4px solid #EF4444; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; border-left: 4px solid #10B981; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; border-left: 4px solid #F59E0B; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ============================================================
   LAYOUT: SIDEBAR + MAIN
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  /* background: #0F2D4E; */
  background: linear-gradient(180deg, #0747a1 0%, #1477d2 60%, #1e97f3 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    /* เปลี่ยน padding เป็น 0 หรือปรับเฉพาะด้านบน/ล่าง เพื่อให้ชนซ้ายขวา */
    padding: 12px 0; 
    background-color: #ffffff; /* ย้ายพื้นหลังขาวมาไว้ที่นี่ */
    width: 100%;               /* มั่นใจว่ากว้างเต็มพื้นที่ */
    border-radius: 10px;       /* ถ้าอยากให้กรอบขาวมีมุมโค้ง */
}

.sidebar-logo img {
    display: block;
    max-height: 50px;
    width: auto;
    /* ลบพื้นหลังและ padding ออกจากตัว img */
    background-color: transparent;
    margin-left: 0px;
}

.sidebar-branch {
  margin-top: 8px;
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.sidebar-branch strong {
  display: block;
  /*color: rgba(255,255,255,0.85);*/
color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  /*color: rgba(255,255,255,0.35);*/
 color: rgba(255,255,255,0.5); 
  
  padding: 8px 20px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  /*color: rgba(255,255,255,0.65);*/
  color: rgba(255,255,255,0.85);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 8px;
  margin: 1px 0;
  text-decoration: none;
  position: relative;
}

.nav-item i {
  font-size: 18px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  line-height: 1;
}

.nav-item:hover {
  background: rgba(255,255,255,0.14);
  color: white;
  transform: translateX(2px);
}

.nav-item.active {
  /*background: rgba(30,122,191,0.25);*/
background: rgba(255,255,255,0.22);
  color: white;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: white;
  border-radius: 0 3px 3px 0;
  top: 8px;
  bottom: 8px;
}

.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--umg-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--umg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
}

.logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.logout-btn:hover { color: var(--umg-red); background: rgba(255,255,255,0.06); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-900);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--gray-400);
}

.breadcrumb a { color: var(--gray-400); }
.breadcrumb a:hover { color: var(--umg-primary); }
.breadcrumb .current { color: var(--gray-700); font-weight: 500; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-date {
  font-size: var(--text-sm);
  color: var(--gray-500);
}

.notification-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.notification-btn:hover { background: var(--gray-100); color: var(--umg-primary); }

.notification-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--umg-red);
  border-radius: 50%;
  border: 2px solid white;
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.07);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: #FAFBFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gray-900);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: 2px;
}

.card-body { padding: 24px; }

.card-footer {
  padding: 14px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.10); transform: translateY(-2px); }
.stat-card { transition: box-shadow 0.25s, transform 0.25s; }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.stat-icon i { font-size: 22px; line-height: 1; }

.stat-icon.blue   { background: var(--blue-50); color: var(--umg-primary); box-shadow: inset 0 0 0 1px rgba(30,122,191,0.12); }
.stat-icon.green  { background: #F0FDF4; color: #16A34A; box-shadow: inset 0 0 0 1px rgba(22,163,74,0.12); }
.stat-icon.orange { background: #FFF7ED; color: #EA580C; box-shadow: inset 0 0 0 1px rgba(234,88,12,0.12); }
.stat-icon.red    { background: #FEF2F2; color: #DC2626; box-shadow: inset 0 0 0 1px rgba(220,38,38,0.12); }
.stat-icon.purple { background: #F5F3FF;          color: #7C3AED; }
.stat-icon.teal   { background: #F0FDFA;          color: #0D9488; }

.stat-body {}
.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

.stat-change {
  font-size: var(--text-xs);
  margin-top: 4px;
  font-weight: 600;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  background: var(--gray-50);
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-blue    { background: var(--blue-50);   color: var(--blue-700); }
.badge-green   { background: #DCFCE7;           color: #166534; }
.badge-red     { background: #FEE2E2;           color: #991B1B; }
.badge-yellow  { background: #FEF3C7;           color: #92400E; }
.badge-gray    { background: var(--gray-100);   color: var(--gray-600); }
.badge-purple  { background: #EDE9FE;           color: #5B21B6; }

/* ============================================================
   CHECKLIST SPECIFIC
   ============================================================ */
.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.progress-bar-wrap {
  background: var(--gray-100);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #1477d2, #3FA0E0);
  transition: width 0.4s ease;
}

.checklist-section {
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-header {
  background: var(--gray-50);
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-200);
}

.section-title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--gray-800);
}

.section-icon { font-size: 18px; }

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: #FAFBFD; }

.checklist-item.checked { background: #F0FDF8; }

.item-checkbox {
  flex-shrink: 0;
  margin-top: 1px;
}

.item-checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--umg-primary);
  cursor: pointer;
  border-radius: 4px;
}

.item-content { flex: 1; }

.item-title {
  font-size: var(--text-sm);
  color: var(--gray-800);
  font-weight: 500;
  transition: color 0.2s;
}

.checklist-item.checked .item-title {
  color: var(--gray-400);
  text-decoration: line-through;
}

.item-required {
  font-size: 10px;
  color: var(--umg-red);
  font-weight: 600;
  margin-left: 6px;
}

.item-input {
  margin-top: 6px;
}

.item-input input,
.item-input textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: var(--text-sm);
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.item-input input:focus,
.item-input textarea:focus {
  border-color: var(--umg-primary);
  box-shadow: 0 0 0 2px rgba(30,122,191,0.1);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: var(--text-sm);
}

.pagination-info { color: var(--gray-500); }

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: var(--text-sm);
  color: var(--gray-600);
  cursor: pointer;
  background: white;
  transition: all 0.15s;
  font-family: var(--font-main);
}

.page-btn:hover { border-color: var(--umg-primary); color: var(--umg-primary); }
.page-btn.active { background: var(--umg-primary); border-color: var(--umg-primary); color: white; font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  animation: slideUp 0.25s ease-out;
}

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

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: var(--text-lg); font-weight: 700; color: var(--gray-900); }

.modal-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   FORM GRID
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.full { grid-template-columns: 1fr; }

@media (max-width: 600px) {
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   SEARCH + FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

.search-input input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.2s;
}

.search-input input:focus { border-color: var(--umg-primary); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
  gap: 0;
  overflow-x: auto;
}

.tab {
  padding: 11px 20px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.tab:hover { color: var(--umg-primary); }
.tab.active { color: var(--umg-primary); border-bottom-color: var(--umg-primary); font-weight: 700; }

/* ============================================================
   ROLE BADGES
   ============================================================ */
.role-super-admin { background: #EDE9FE; color: #5B21B6; }
.role-admin       { background: #DBEAFE; color: #1D4ED8; }
.role-manager     { background: #CFFAFE; color: #0E7490; }
.role-staff       { background: var(--gray-100); color: var(--gray-600); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-muted  { color: var(--gray-500); }
.text-primary{ color: var(--umg-primary); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.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; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Separator */
.separator {
  height: 1px;
  background: var(--gray-100);
  margin: 16px 0;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

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


/* ── Stat card top border by class ── */
.stat-card-blue   { border-top: 3px solid #1E7ABF !important; }
.stat-card-green  { border-top: 3px solid #16A34A !important; }
.stat-card-orange { border-top: 3px solid #EA580C !important; }
.stat-card-red    { border-top: 3px solid #DC2626 !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); }

/* ── Sidebar footer ── */
.sidebar-footer { background: rgba(0,0,0,0.12); }
.user-avatar { border: 1.5px solid rgba(255,255,255,0.3); }