*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.6;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #f0f7ff; border-radius: 10px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c62828 0%, #a52020 100%);
  border-radius: 10px;
  border: 2px solid #f0f7ff;
  transition: all 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #e74c3c 0%, #c62828 100%);
  border: 2px solid #e8f0ff;
}
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #a52020 0%, #8b1a1a 100%);
}
* { scrollbar-width: thin; scrollbar-color: #c62828 #f0f7ff; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.btn-primary:hover { background: #1565c0; color: #fff; border-color: #1565c0; }
.btn-success { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.btn-success:hover { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn-danger { background: #fce4ec; color: #c62828; border-color: #f8bbd0; }
.btn-danger:hover { background: #c62828; color: #fff; border-color: #c62828; }
.btn-warning { background: #fff3e0; color: #e65100; border-color: #ffe0b2; }
.btn-warning:hover { background: #e65100; color: #fff; border-color: #e65100; }
.btn-secondary { background: #f5f5f5; color: #455a64; border-color: #e0e0e0; }
.btn-secondary:hover { background: #455a64; color: #fff; border-color: #455a64; }
.btn-info { background: #e0f7fa; color: #00838f; border-color: #b2ebf2; }
.btn-info:hover { background: #00838f; color: #fff; border-color: #00838f; }
.btn-ghost { background: transparent; color: #666; border: 1px solid #ddd; }
.btn-ghost:hover { background: #f5f5f5; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { display: block; width: 100%; }

/* Navbar primary button (white on dark) */
.btn-white { background: white; color: #1a237e; font-weight: 700; border: none; padding: 8px 18px; border-radius: 6px; font-size: 13px; text-decoration: none; cursor: pointer; transition: background 0.2s; }
.btn-white:hover { background: #e8eaf6; }

/* === Badges === */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.badge-cef { background: #e8eaf6; color: #1a237e; }
.badge-clc { background: #e8f5e9; color: #2e7d32; }
.badge-csp { background: #fff8e1; color: #f57f17; }
.badge-cgs { background: #e8eaf6; color: #3949ab; }

/* Semantic badges */
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #ef6c00; }
.badge-danger  { background: #ffebee; color: #c62828; }
.badge-primary { background: #e6ecf3; color: #1a237e; }
.badge-secondary { background: #eceff1; color: #546e7a; }
.badge-info    { background: #e3f2fd; color: #1565c0; }

/* Role badge */
.role-badge {
  font-size: 10px;
  font-weight: 700;
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .03em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.alert-danger  { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.alert-warning { background: #fff3e0; color: #ef6c00; border-left: 4px solid #ef6c00; }
.alert-info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }

/* === Public / Login Pages === */
.public-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}
.login-card-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-card-header .login-icon { font-size: 2.4rem; }
.login-card-header h1 { font-size: 22px; color: #1a237e; margin-top: 8px; font-weight: 700; }
.login-card-header p  { font-size: 13px; color: #90a4ae; margin-top: 4px; }

/* Password toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input { width: 100%; padding-right: 42px; }
.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: #90a4ae;
  padding: 0;
  display: flex;
  align-items: center;
  line-height: 1;
}
.password-toggle:hover { color: #455a64; }

/* === NAVBAR === */
.navbar {
  background: #1a237e;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { display: flex; align-items: center; }
.nav-logo { font-size: 20px; }
.nav-title { font-size: 16px; font-weight: 700; color: white; }
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px 0 0;
  line-height: 1;
}

/* === APP LAYOUT === */
.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* === SIDEBAR === */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid #e8eaf6;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Sidebar header (mobile slide-in only) */
.sidebar-head { display: none; }
.sidebar-close-btn { display: none; }

.sidebar-inner {
  padding: 16px 0 8px;
  flex: 1;
  overflow-y: auto;
}

/* Sidebar footer */
.sidebar-footer { flex-shrink: 0; padding: 0 0 12px; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px 8px;
  flex-wrap: wrap;
}
.sidebar-role-badge {
  font-size: 10px;
  font-weight: 700;
  color: white;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .03em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 3px 12px 0;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: #444;
  background: #f5f6ff;
  border: none;
  cursor: pointer;
  transition: background .15s;
  text-align: left;
  box-sizing: border-box;
}
.sidebar-action-btn:hover { background: #e8eaf6; color: #1a237e; text-decoration: none; }
.sidebar-action-primary { background: #1a237e; color: white; }
.sidebar-action-primary:hover { background: #283593; color: white; }
.sidebar-action-signout { color: #b91c1c; }
.sidebar-action-signout:hover { background: #fff5f5; color: #b91c1c; }

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  padding: 0 16px 6px;
  margin-top: 4px;
}
.sidebar-divider { border-top: 1px solid #f0f0f0; margin: 10px 0 14px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  text-decoration: none;
  color: #444;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.sidebar-item:hover { background: #f5f6ff; color: #1a237e; text-decoration: none; }
.sidebar-item.active { background: #eef0fb; color: #1a237e; font-weight: 700; }
.sidebar-item.active.sidebar-all    { border-left-color: #1a237e; }
.sidebar-item.active.sidebar-cef    { border-left-color: #1a237e; }
.sidebar-item.active.sidebar-clc    { border-left-color: #2e7d32; }
.sidebar-item.active.sidebar-csp    { border-left-color: #f57f17; }
.sidebar-item.active.sidebar-cgs    { border-left-color: #3949ab; }
.sidebar-item.active.sidebar-status { border-left-color: #555; }
.sidebar-icon  { font-size: 15px; flex-shrink: 0; }
.sidebar-label { flex: 1; }
.sidebar-count {
  font-size: 11px;
  font-weight: 700;
  background: #e8eaf6;
  color: #1a237e;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}
.sidebar-item.active .sidebar-count { background: #1a237e; color: white; }
.sidebar-item.active.sidebar-clc .sidebar-count { background: #2e7d32; }
.sidebar-item.active.sidebar-csp .sidebar-count { background: #f57f17; }
.sidebar-item.active.sidebar-cgs .sidebar-count { background: #3949ab; }

/* Status dot in sidebar */
.sidebar-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dot-draft    { background: #90a4ae; }
.status-dot-pending  { background: #fb8c00; }
.status-dot-approved { background: #43a047; }
.status-dot-rejected { background: #e53935; }

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

/* Top bar — always visible inside main content */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 14px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-hamburger {
  background: #1a237e;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 700; color: #1a237e; display: none; }
.topbar-new-btn { flex-shrink: 0; }

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 20px 32px;
  overflow-x: hidden;
}

/* === CONTENT HEADER === */
.content-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.content-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a237e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.content-entity-icon { font-size: 18px; }
.content-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.content-status-tag.status-draft    { background: #eceff1; color: #546e7a; }
.content-status-tag.status-pending  { background: #fff3e0; color: #e65100; }
.content-status-tag.status-approved { background: #e8f5e9; color: #2e7d32; }
.content-status-tag.status-rejected { background: #ffebee; color: #c62828; }
.content-meta { font-size: 12px; color: #999; margin-left: auto; }

/* === CONTAINER === */
.container { max-width: 1300px; margin: 24px auto; padding: 0 20px; }

/* === TOOLBAR === */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.filter-form input, .filter-form select {
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  outline: none;
  transition: border 0.2s;
}
.filter-form input:focus, .filter-form select:focus { border-color: #1a237e; }
.filter-form input { flex: 1; min-width: 180px; }

/* === CARD === */
.card { background: white; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 15px; font-weight: 600; color: #1a237e; }
.card-body { padding: 20px; }

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  --stat-accent: #607d8b;
  background: var(--stat-accent);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  position: relative;
  overflow: hidden;
  min-height: 94px;
  color: white;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}
.stat-card.stat-total   { --stat-accent: #1a237e; }
.stat-card.stat-success { --stat-accent: #2e7d32; }
.stat-card.stat-danger  { --stat-accent: #c62828; }
.stat-card.stat-warning { --stat-accent: #e65100; }
.stat-card.stat-info    { --stat-accent: #0277bd; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.85; margin-top: 4px; }

/* === TABLE === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f8f9ff;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 2px solid #e8eaf6;
  text-align: left;
  white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tr:hover td { background: #fafbff; }
.data-table tr:last-child td { border-bottom: none; }
.indent-link { color: #1a237e; font-weight: 600; text-decoration: none; }
.indent-link:hover { text-decoration: underline; }
.muted  { color: #666; font-size: 13px; }
.amount { font-weight: 600; color: #2e7d32; }
.empty  { text-align: center; padding: 40px; color: #999; }
.actions { display: flex; gap: 6px; font-size: 15px; }
.actions a { text-decoration: none; cursor: pointer; transition: transform 0.1s; }
.actions a:hover { transform: scale(1.2); }

/* === STATUS BADGES === */
.status { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.status-draft    { background: #eceff1; color: #546e7a; }
.status-pending  { background: #fff3e0; color: #e65100; }
.status-approved { background: #e8f5e9; color: #2e7d32; }
.status-rejected { background: #ffebee; color: #c62828; }

/* === FORMS === */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group  { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border 0.2s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #1a237e; box-shadow: 0 0 0 2px rgba(26,35,126,0.08); }
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a237e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8eaf6;
  margin-bottom: 16px;
}
.form-row     { display: flex; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Login form specific */
.form-group-login { margin-bottom: 16px; }
.form-group-login label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #455a64;
  margin-bottom: 5px;
}
.form-group-login input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}
.form-group-login input:focus {
  border-color: #1a237e;
  box-shadow: 0 0 0 2px rgba(26,35,126,0.1);
}

/* === ITEMS TABLE IN FORM === */
.items-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.items-table th { background: #f0f2ff; color: #444; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 8px 10px; border: 1px solid #e0e0e0; text-align: left; }
.items-table td { border: 1px solid #e8e8e8; padding: 4px 6px; }
.items-table input, .items-table select { border: none; background: transparent; width: 100%; padding: 4px; font-size: 13px; outline: none; font-family: inherit; }
.items-table input:focus { background: #f0f4ff; border-radius: 3px; }
.items-table .col-sl     { width: 40px; text-align: center; color: #999; font-weight: 600; }
.items-table .col-qty    { width: 80px; }
.items-table .col-unit   { width: 70px; }
.items-table .col-price  { width: 120px; }
.items-table .col-total  { width: 130px; }
.items-table .col-action { width: 40px; text-align: center; }
.items-table .total-row td { background: #f8f9ff; font-weight: 700; }
.add-row-btn { margin-top: 8px; font-size: 12px; }

/* === VIEW PAGE === */
.view-header { background: #1a237e; color: white; padding: 20px 24px; border-radius: 10px 10px 0 0; }
.view-header h1 { font-size: 18px; font-weight: 700; }
.view-header .meta { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.view-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; }
.view-field { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.view-field label { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.3px; display: block; margin-bottom: 2px; }
.view-field span  { font-size: 14px; color: #1a1a2e; }

/* === PRINT === */
@media print {
  body > *:not(#printFrame) { display: none !important; }
  #printFrame { display: block !important; position: static !important; width: 100% !important; height: auto !important; border: none !important; }
}

/* === PAGINATION === */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #f0f0f0; flex-wrap: wrap; gap: 8px; }
.pagination-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-top: 12px; flex-wrap: wrap; gap: 8px; }
.page-info  { font-size: 13px; color: #666; }
.page-links { display: flex; gap: 4px; flex-wrap: wrap; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 6px; border: 1px solid #e0e0e0; background: white; color: #455a64; text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.2s; cursor: pointer; }
.page-btn:hover { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; text-decoration: none; }
.page-btn.active { background: #032e3f; color: white; border-color: #032e3f; cursor: default; }
.page-btn.disabled { color: #bdbdbd; cursor: default; pointer-events: none; }
.page-ellipsis { padding: 0 4px; color: #90a4ae; font-size: 14px; }

/* === MOBILE CARDS === */
.mobile-cards { display: none; }
.indent-card { border-bottom: 1px solid #f0f0f0; padding: 14px 16px; }
.indent-card:last-child { border-bottom: none; }
.card-top    { align-items: center; }
.card-row    { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; }
.card-label  { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.3px; min-width: 80px; }
.card-actions { display: flex; gap: 12px; margin-top: 8px; font-size: 17px; }
.card-actions a { text-decoration: none; }

/* === PAGE HEADER === */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 700; color: #1a237e; }
.breadcrumb { font-size: 12px; color: #888; margin-top: 2px; }
.breadcrumb a { color: #1a237e; text-decoration: none; }

/* === MODAL === */
#modalOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  overflow-y: auto;
}
#modalBox {
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 900px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
}
#modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  background: #1a237e;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
}
#modalTitle {
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#modalCloseBtn {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.15s;
}
#modalCloseBtn:hover { color: white; }
#modalBody {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
#modalFooter {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid #e8eaf6;
  background: #f8f9ff;
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
}
#modalFooter:empty { display: none; }
.modal-footer-actions { display: none !important; }
.modal-loading { text-align: center; padding: 40px; color: #888; font-size: 14px; }

/* === TOAST === */
.toast {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast-success { background: #2e7d32; color: white; }
.toast-error   { background: #c62828; color: white; }

/* === Admin Table (v/-style) === */
.table-responsive { overflow-x: auto; border-radius: 10px; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  border: 1px solid #e8ecf0;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f2f5;
  font-size: 13px;
  vertical-align: middle;
}
.table th {
  background: #032e3f;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 14px 16px;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover td { background: #f8f9ff; }
.table tbody tr:last-child td { border-bottom: none; }

/* === Filters Bar (v/-style) === */
.filters {
  margin-bottom: 20px;
  background: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e8ecf0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.filter-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-input {
  height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  font-size: 13px;
  min-width: 220px;
  outline: none;
  transition: border-color 0.2s;
}
.filter-select {
  height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.filter-input:focus, .filter-select:focus { border-color: #1a237e; }
.filter-form .btn { height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.filter-add-btn { margin-left: auto; }

/* === Admin Page Header === */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-page-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a237e;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Admin Card === */
.admin-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e8ecf0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 20px 24px;
  margin-bottom: 24px;
  overflow: hidden;
}
.admin-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a237e;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8eaf6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* === Status dot === */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-active   { background: #22c55e; }
.dot-inactive { background: #94a3b8; }

/* === Permission tick/cross === */
.perm-yes  { color: #2e7d32; font-weight: 700; }
.perm-no   { color: #94a3b8; }
.perm-role { color: #1a237e; font-weight: 600; }

/* === Inline form for table actions === */
.inline-form { display: inline; }
.locked-row td { opacity: .6; }

/* === Password expand row === */
.pwd-expand-row td { background: #fffbeb; padding: 8px 16px; }
.pwd-expand-row form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* === Create-user modal === */
.cu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.cu-overlay.open { display: flex; }
.cu-modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  overflow: hidden;
}
.cu-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  background: #1a237e;
  flex-shrink: 0;
}
.cu-modal-header h2 { font-size: 15px; font-weight: 700; color: white; margin: 0; }
.cu-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  padding: 0 2px;
  transition: color 0.15s;
}
.cu-close:hover { color: white; }
.cu-modal-body { padding: 20px 24px; }
.cu-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid #e8eaf6;
  background: #f8f9ff;
}

/* === Log action badge === */
.action-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === Responsive admin tables === */
@media (max-width: 600px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { border: 1px solid #e8eaf6; border-radius: 8px; margin-bottom: 8px; padding: 8px; }
  .table td { display: flex; justify-content: space-between; border: none; padding: 4px 4px; font-size: 12px; }
  .table td::before { content: attr(data-label); font-weight: 600; color: #888; flex-shrink: 0; margin-right: 8px; }
  .filter-input { min-width: 100%; }
  .admin-page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .form-grid, .form-grid-3, .view-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
@media (max-width: 768px) {
  .desktop-table { display: none; }
  .mobile-cards  { display: block; }
}
@media (max-width: 600px) {
  .container { padding: 0 10px; }
  #modalOverlay { padding: 0; align-items: stretch; }
  #modalBox { border-radius: 0; max-height: 100vh; height: 100vh; max-width: 100%; }
  #modalHeader { border-radius: 0; }
  #modalFooter { border-radius: 0; }
  .login-card { padding: 28px 20px; }
}

/* === SIDEBAR RESPONSIVE === */
@media (max-width: 960px) {
  .nav-hamburger { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-head { display: flex; }
  .sidebar-close-btn { display: block; }
  .main-content { padding: 16px 12px 28px; }
  .topbar-hamburger { display: flex; }
  .topbar-title { display: block; }
}
